mirror of
https://github.com/openvswitch/ovs
synced 2025-10-25 15:07:05 +00:00
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: 994bfc2985 ("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>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user