[ovs-dev,v2,08/23] Move BLDASSERT macros to compiler header file
diff mbox

Message ID d245e3bd2b1def3bf9559ff93ed783daed4b554f.1457026916.git.ben@skyportsystems.com
State Not Applicable
Headers show

Commit Message

ben@skyportsystems.com March 3, 2016, 6:20 p.m. UTC
From: Ben Warren <ben@skyportsystems.com>

Signed-off-by: Ben Warren <ben@skyportsystems.com>
---
 include/openvswitch/compiler.h | 30 ++++++++++++++++++++++++++++++
 lib/util.h                     | 28 ----------------------------
 2 files changed, 30 insertions(+), 28 deletions(-)

Patch
diff mbox

diff --git a/include/openvswitch/compiler.h b/include/openvswitch/compiler.h
index 60c408b..1d3af9f 100644
--- a/include/openvswitch/compiler.h
+++ b/include/openvswitch/compiler.h
@@ -228,4 +228,34 @@ 
 #define OVS_PREFETCH_WRITE(addr)
 #endif
 
+/* Formerly in lib/util.h */
+#ifdef __CHECKER__
+#define BUILD_ASSERT(EXPR) ((void) 0)
+#define BUILD_ASSERT_DECL(EXPR) extern int (*build_assert(void))[1]
+#elif !defined(__cplusplus)
+/* Build-time assertion building block. */
+#define BUILD_ASSERT__(EXPR) \
+        sizeof(struct { unsigned int build_assert_failed : (EXPR) ? 1 : -1; })
+
+/* Build-time assertion for use in a statement context. */
+#define BUILD_ASSERT(EXPR) (void) BUILD_ASSERT__(EXPR)
+
+/* Build-time assertion for use in a declaration context. */
+#define BUILD_ASSERT_DECL(EXPR) \
+        extern int (*build_assert(void))[BUILD_ASSERT__(EXPR)]
+#else /* __cplusplus */
+#include <boost/static_assert.hpp>
+#define BUILD_ASSERT BOOST_STATIC_ASSERT
+#define BUILD_ASSERT_DECL BOOST_STATIC_ASSERT
+#endif /* __cplusplus */
+
+#ifdef __GNUC__
+#define BUILD_ASSERT_GCCONLY(EXPR) BUILD_ASSERT(EXPR)
+#define BUILD_ASSERT_DECL_GCCONLY(EXPR) BUILD_ASSERT_DECL(EXPR)
+#else
+#define BUILD_ASSERT_GCCONLY(EXPR) ((void) 0)
+#define BUILD_ASSERT_DECL_GCCONLY(EXPR) ((void) 0)
+#endif
+
+
 #endif /* compiler.h */
diff --git a/lib/util.h b/lib/util.h
index cd71360..8111039 100644
--- a/lib/util.h
+++ b/lib/util.h
@@ -39,34 +39,6 @@ 
 #endif
 #endif
 
-#ifdef __CHECKER__
-#define BUILD_ASSERT(EXPR) ((void) 0)
-#define BUILD_ASSERT_DECL(EXPR) extern int (*build_assert(void))[1]
-#elif !defined(__cplusplus)
-/* Build-time assertion building block. */
-#define BUILD_ASSERT__(EXPR) \
-        sizeof(struct { unsigned int build_assert_failed : (EXPR) ? 1 : -1; })
-
-/* Build-time assertion for use in a statement context. */
-#define BUILD_ASSERT(EXPR) (void) BUILD_ASSERT__(EXPR)
-
-/* Build-time assertion for use in a declaration context. */
-#define BUILD_ASSERT_DECL(EXPR) \
-        extern int (*build_assert(void))[BUILD_ASSERT__(EXPR)]
-#else /* __cplusplus */
-#include <boost/static_assert.hpp>
-#define BUILD_ASSERT BOOST_STATIC_ASSERT
-#define BUILD_ASSERT_DECL BOOST_STATIC_ASSERT
-#endif /* __cplusplus */
-
-#ifdef __GNUC__
-#define BUILD_ASSERT_GCCONLY(EXPR) BUILD_ASSERT(EXPR)
-#define BUILD_ASSERT_DECL_GCCONLY(EXPR) BUILD_ASSERT_DECL(EXPR)
-#else
-#define BUILD_ASSERT_GCCONLY(EXPR) ((void) 0)
-#define BUILD_ASSERT_DECL_GCCONLY(EXPR) ((void) 0)
-#endif
-
 extern char *program_name;
 
 #define __ARRAY_SIZE_NOCHECK(ARRAY) (sizeof(ARRAY) / sizeof((ARRAY)[0]))