@@ -17,6 +17,10 @@
#ifndef DIRS_H
#define DIRS_H 1
+#ifdef __cplusplus
+extern "C" {
+#endif
+
const char *ovs_sysconfdir(void); /* /usr/local/etc */
const char *ovs_pkgdatadir(void); /* /usr/local/share/openvswitch */
const char *ovs_rundir(void); /* /usr/local/var/run/openvswitch */
@@ -24,4 +28,8 @@ const char *ovs_logdir(void); /* /usr/local/var/log/openvswitch */
const char *ovs_dbdir(void); /* /usr/local/etc/openvswitch */
const char *ovs_bindir(void); /* /usr/local/bin */
+#ifdef __cplusplus
+}
+#endif
+
#endif /* dirs.h */
@@ -21,6 +21,10 @@
#include "ovsdb-types.h"
#include "openvswitch/shash.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define MAX_OVSDB_ATOM_RANGE_SIZE 4096
struct ds;
@@ -282,4 +286,8 @@ bool ovsdb_token_is_delim(unsigned char);
struct ovsdb_error *ovsdb_atom_range_check_size(int64_t range_start,
int64_t range_end);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* ovsdb-data.h */
@@ -26,6 +26,10 @@
#include "openvswitch/shash.h"
#include "uuid.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* A local copy of a row in an OVSDB table, replicated from an OVSDB server.
* This structure is used as a header for a larger structure that translates
* the "struct ovsdb_datum"s into easier-to-use forms, via the ->parse() and
@@ -161,4 +165,8 @@ void ovsdb_idl_txn_verify(const struct ovsdb_idl_row *,
struct ovsdb_idl_txn *ovsdb_idl_txn_get(const struct ovsdb_idl_row *);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* ovsdb-idl-provider.h */
@@ -44,6 +44,10 @@
#include "ovsdb-condition.h"
#include "skiplist.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct json;
struct ovsdb_datum;
struct ovsdb_idl_class;
@@ -409,4 +413,9 @@ struct ovsdb_idl_row *ovsdb_idl_index_forward_to(
int ovsdb_idl_index_compare(struct ovsdb_idl_index_cursor *,
struct ovsdb_idl_row *a,
struct ovsdb_idl_row *b);
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* ovsdb-idl.h */
@@ -19,6 +19,10 @@
#include "ovsdb-data.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
enum map_op_type {
MAP_OP_UPDATE,
MAP_OP_INSERT,
@@ -42,4 +46,8 @@ void map_op_list_add(struct map_op_list *, struct map_op *,
struct map_op *map_op_list_first(struct map_op_list *);
struct map_op *map_op_list_next(struct map_op_list *, struct map_op *);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* ovsdb-map-op.h */
@@ -20,6 +20,10 @@
#include "ovsdb-data.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
enum set_op_type {
SET_OP_INSERT,
SET_OP_DELETE
@@ -42,4 +46,8 @@ void set_op_list_add(struct set_op_list *, struct set_op *,
struct set_op *set_op_list_first(struct set_op_list *);
struct set_op *set_op_list_next(struct set_op_list *, struct set_op *);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* ovsdb-set-op.h */
@@ -22,6 +22,10 @@
#include "compiler.h"
#include "uuid.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct json;
/* An atomic type: one that OVSDB regards as a single unit of data. */
@@ -227,4 +231,8 @@ static inline bool ovsdb_type_is_map(const struct ovsdb_type *type)
return type->value.type != OVSDB_TYPE_VOID;
}
+#ifdef __cplusplus
+}
+#endif
+
#endif /* ovsdb-types.h */
@@ -19,6 +19,10 @@
#include "hash.h"
#include "openvswitch/hmap.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct json;
struct uuid;
@@ -113,4 +117,8 @@ struct json *smap_to_json(const struct smap *);
bool smap_equal(const struct smap *, const struct smap *);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* smap.h */
@@ -18,6 +18,10 @@
#include "openvswitch/uuid.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* An initializer or expression for an all-zero UUID. */
#define UUID_ZERO ((struct uuid) { .parts = { 0, 0, 0, 0 } })
@@ -69,4 +73,8 @@ int uuid_is_partial_string(const char *);
int uuid_is_partial_match(const struct uuid *, const char *match);
void uuid_set_bits_v4(struct uuid *);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* uuid.h */
@@ -137,7 +137,12 @@ def printCIDLHeader(schemaFile):
#include "ovsdb-data.h"
#include "ovsdb-idl-provider.h"
#include "smap.h"
-#include "uuid.h"''' % {'prefix': prefix.upper()})
+#include "uuid.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+''' % {'prefix': prefix.upper()})
for tableName, table in sorted(schema.tables.items()):
structName = "%s%s" % (prefix, tableName.lower())
@@ -305,6 +310,10 @@ bool %(s)s_is_updated(const struct %(s)s *, enum %(s)s_column_id);
print("\nextern struct ovsdb_idl_class %sidl_class;" % prefix)
print("\nconst char * %sget_db_version(void);" % prefix)
+ print('''
+#ifdef __cplusplus
+}
+#endif''')
print("\n#endif /* %(prefix)sIDL_HEADER */" % {'prefix': prefix.upper()})
def printEnum(type, members):
This patch adds 'extern "C"' in a couple of header files so that they can be compiled with C++ compilers. Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> --- lib/dirs.h | 8 ++++++++ lib/ovsdb-data.h | 8 ++++++++ lib/ovsdb-idl-provider.h | 8 ++++++++ lib/ovsdb-idl.h | 9 +++++++++ lib/ovsdb-map-op.h | 8 ++++++++ lib/ovsdb-set-op.h | 8 ++++++++ lib/ovsdb-types.h | 8 ++++++++ lib/smap.h | 8 ++++++++ lib/uuid.h | 8 ++++++++ ovsdb/ovsdb-idlc.in | 11 ++++++++++- 10 files changed, 83 insertions(+), 1 deletion(-)