diff options
author | Yi-Hung Wei <yihung.wei@gmail.com> | 2017-09-12 15:43:03 -0700 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2017-09-13 13:30:53 -0700 |
commit | 5e8bed8373ddacf34262e080a7570074a67b4e4b (patch) | |
tree | 32e18183329f67067abc405968ec41347a4dce2c /include/openflow | |
parent | 4a0a2c24a46acd2c96707d87811b6cf19f29f071 (diff) | |
download | openvswitch-5e8bed8373ddacf34262e080a7570074a67b4e4b.tar.gz |
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 <yihung.wei@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'include/openflow')
-rw-r--r-- | include/openflow/openflow-common.h | 7 |
1 files changed, 5 insertions, 2 deletions
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 <boost/static_assert.hpp> +#define OFP_ASSERT BOOST_STATIC_ASSERT +#endif /* __cplusplus < 201103L */ /* Version number: * Non-experimental versions released: 0x01 0x02 |