From 5e8bed8373ddacf34262e080a7570074a67b4e4b Mon Sep 17 00:00:00 2001 From: Yi-Hung Wei Date: Tue, 12 Sep 2017 15:43:03 -0700 Subject: Fix C++ build issue when static_assert() is not available This patch prevents compile errors if the C++ compiler does not support C++11 or the support is not enabled. VMWare-BZ: #1953215 Fixes: 994bfc298502 ("Automatically verify that OVS header files work OK in C++ also.") Signed-off-by: Yi-Hung Wei Signed-off-by: Ben Pfaff --- include/openflow/openflow-common.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'include/openflow') diff --git a/include/openflow/openflow-common.h b/include/openflow/openflow-common.h index d66551997..ea6bb41bc 100644 --- a/include/openflow/openflow-common.h +++ b/include/openflow/openflow-common.h @@ -59,9 +59,12 @@ #define OFP_ASSERT(EXPR) \ extern int (*build_assert(void))[ sizeof(struct { \ unsigned int build_assert_failed : (EXPR) ? 1 : -1; })] -#else /* __cplusplus */ +#elif __cplusplus >= 201103L #define OFP_ASSERT(EXPR) static_assert(EXPR, "assertion failed") -#endif /* __cplusplus */ +#else /* __cplusplus < 201103L */ +#include +#define OFP_ASSERT BOOST_STATIC_ASSERT +#endif /* __cplusplus < 201103L */ /* Version number: * Non-experimental versions released: 0x01 0x02 -- cgit v1.2.1