Header file lib/tun-metadata.h declares functions using enum ofperr
without including a definition for this enum. While this is Ok for C
where enums can be implicitly converted to/from int, C++ compilers throw
an error about this, for example (for clang++):

error: ISO C++ forbids forward references to 'enum' types

For GCC, this can be reproduced with command `g++ lib/tun-metadata.h
-Iinclude` from the root of Open vSwitch repository. This patch includes
the necessary header file and also conditionally adds extern "C"
directive.

Signed-off-by: Dmitry Mityugov <[email protected]>
---
 lib/tun-metadata.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/tun-metadata.h b/lib/tun-metadata.h
index 67dedae25..efbf9c4b2 100644
--- a/lib/tun-metadata.h
+++ b/lib/tun-metadata.h
@@ -22,9 +22,14 @@
 #include "openvswitch/dynamic-string.h"
 #include "netlink.h"
 #include "openvswitch/ofpbuf.h"
+#include "openvswitch/ofp-errors.h"
 #include "openflow/openflow.h"
 #include "openvswitch/tun-metadata.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct flow_tnl;
 struct match;
 struct mf_field;
@@ -77,4 +82,8 @@ void tun_metadata_to_nx_match(struct ofpbuf *b, enum 
ofp_version oxm,
                               const struct match *);
 void tun_metadata_match_format(struct ds *, const struct match *);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* tun-metadata.h */
-- 
2.54.0

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

Reply via email to