In the OVSDB IDL, we use C++ keywords such as "new", "mutable", "class"
for variable and field names. This series updates these names so that
they don't conflict with the C++ keywords, which should improve the
ability to use the IDL from C++ code. This series focuses primarily on
code that exists in the tree; To address such problems for generated
field names that come from an OVSDB schema, a subsequent patch will
still be required. For instance, the ovs-vswitchd schema has a column
named "protected". This ends up as a field name in the generated
lib/vswitch-idl.[ch] code, which causes similar problems to those
addressed by this series.

This series was tested this far using the following diff, but since not
all of the compile errors are addressed yet - specifically those
mentioned above - I'm not submitting the below with this series:

diff --git a/include/openvswitch/automake.mk b/include/openvswitch/automake.mk
index eabeb1e971f3..aaab92b59d9d 100644
--- a/include/openvswitch/automake.mk
+++ b/include/openvswitch/automake.mk
@@ -31,7 +31,8 @@ openvswitchinclude_HEADERS = \
        include/openvswitch/version.h \
        include/openvswitch/vconn.h \
        include/openvswitch/vlog.h \
-       include/openvswitch/nsh.h
+       include/openvswitch/nsh.h \
+       lib/vswitch-idl.h

 if HAVE_CXX
 # OVS does not use C++ itself, but it provides public header files
@@ -44,7 +45,7 @@ nodist_include_openvswitch_libcxxtest_la_SOURCES = 
include/openvswitch/cxxtest.c
 include/openvswitch/cxxtest.cc: include/openvswitch/automake.mk
        $(AM_V_GEN)for header in $(openvswitchinclude_HEADERS); do      \
          echo $$header;                                                \
-       done | sed 's,^include/\(.*\)$$,#include <\1>,' > $@
+       done | sed -e 's,^include/\(.*\)$$,#include <\1>,' -e 
's,^lib/\(.*\)$$,#include <\1>,'  > $@
 endif

 # OVS does not use C++ itself, but it provides public header files
diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in
index 9c674e7f5e80..d5562add4410 100755
--- a/ovsdb/ovsdb-idlc.in
+++ b/ovsdb/ovsdb-idlc.in
@@ -136,7 +136,11 @@ 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())
@@ -1050,6 +1054,10 @@ const char *
 {
     return "%s";
 }
+
+#ifdef  __cplusplus
+}
+#endif
 """ % (prefix, schema.version))
 
 


Joe Stringer (4):
  ovsdb-idl: Avoid class declaration.
  ovsdb-idl: Avoid mutable type specifier.
  ovsdb-idl: Avoid new expression.
  ovsdb-idl: Rename 'old' to 'old_datum'.

 lib/db-ctl-base.c        |   4 +-
 lib/ovsdb-data.h         |   8 +-
 lib/ovsdb-idl-provider.h |  42 +++----
 lib/ovsdb-idl.c          | 307 ++++++++++++++++++++++++-----------------------
 ovsdb/ovsdb-idlc.in      |   6 +-
 5 files changed, 187 insertions(+), 180 deletions(-)

-- 
2.13.3

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to