api: reimplement BUILD_BUG_ON in compiler.h
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 17 Aug 2011 09:33:58 +0000 (05:33 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 17 Aug 2011 09:33:58 +0000 (05:33 -0400)
Even though it's just two lines of code, I'm reimplementing it
cleanly out of paranoia.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
tests/api.h
urcu/compiler.h

index 49c96f7d969eb4fa01bb35b7efc0c50266e88d79..c5d716f65f47a861988cc864182f44994f46d4f1 100644 (file)
  * to redistribute under later versions of GPL might not be available.
  */
 
+#include <urcu/compiler.h>
 #include <urcu/arch.h>
 
-#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
-#define BUILD_BUG_ON_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1)
-
 /*
  * Machine parameters.
  */
index 54904cc4078ed144f8a25bc4778cea1ef7fd1319..489677b3aefe1ad6dd294006d903721f375f66a7 100644 (file)
@@ -61,4 +61,7 @@
                (type *)((char *)__ptr - offsetof(type, member));       \
        })
 
+#define CAA_BUILD_BUG_ON_ZERO(cond) (sizeof(struct { int:-!!(cond); }))
+#define CAA_BUILD_BUG_ON(cond) ((void)BUILD_BUG_ON_ZERO(cond))
+
 #endif /* _URCU_COMPILER_H */
This page took 0.025533 seconds and 4 git commands to generate.