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 <[email protected]>
---
 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(-)

diff --git a/lib/dirs.h b/lib/dirs.h
index 811a51fcedf9..26af4bc41f47 100644
--- a/lib/dirs.h
+++ b/lib/dirs.h
@@ -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 */
diff --git a/lib/ovsdb-data.h b/lib/ovsdb-data.h
index 72c8fe35bce3..c7bb095cd93a 100644
--- a/lib/ovsdb-data.h
+++ b/lib/ovsdb-data.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 */
diff --git a/lib/ovsdb-idl-provider.h b/lib/ovsdb-idl-provider.h
index a3eccb4c0ce6..d15ab1db58a6 100644
--- a/lib/ovsdb-idl-provider.h
+++ b/lib/ovsdb-idl-provider.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 */
diff --git a/lib/ovsdb-idl.h b/lib/ovsdb-idl.h
index b00b10543734..67d48cf0c16b 100644
--- a/lib/ovsdb-idl.h
+++ b/lib/ovsdb-idl.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 */
diff --git a/lib/ovsdb-map-op.h b/lib/ovsdb-map-op.h
index 140b0f3889f8..282f0534ee67 100644
--- a/lib/ovsdb-map-op.h
+++ b/lib/ovsdb-map-op.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 */
diff --git a/lib/ovsdb-set-op.h b/lib/ovsdb-set-op.h
index 802cd7cf002f..419080b8a3e2 100644
--- a/lib/ovsdb-set-op.h
+++ b/lib/ovsdb-set-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 */
diff --git a/lib/ovsdb-types.h b/lib/ovsdb-types.h
index 81cc862130c8..222d0ec15281 100644
--- a/lib/ovsdb-types.h
+++ b/lib/ovsdb-types.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 */
diff --git a/lib/smap.h b/lib/smap.h
index edf591cf156d..838e2e4bb20e 100644
--- a/lib/smap.h
+++ b/lib/smap.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 */
diff --git a/lib/uuid.h b/lib/uuid.h
index dba6e1c11ea1..69a71cc60952 100644
--- a/lib/uuid.h
+++ b/lib/uuid.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 */
diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in
index 24e86b772fbe..c3973e4f5982 100755
--- a/ovsdb/ovsdb-idlc.in
+++ b/ovsdb/ovsdb-idlc.in
@@ -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):
-- 
2.7.4

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to