[ltt-dev] [PATCH 5/6] api: move useful parts to compiler.h

Paolo Bonzini pbonzini at redhat.com
Wed Aug 10 04:40:56 EDT 2011


---
 tests/api.h     |   14 +-------------
 urcu/compiler.h |   11 +++++++++++
 2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/tests/api.h b/tests/api.h
index e36a570..dcd76f7 100644
--- a/tests/api.h
+++ b/tests/api.h
@@ -27,21 +27,9 @@
  * to redistribute under later versions of GPL might not be available.
  */
 
+#include <urcu/compiler.h>
 #include <urcu/arch.h>
 
-#ifndef __always_inline
-#define __always_inline inline
-#endif
-
-#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
-#define BUILD_BUG_ON_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1)
-
-/* This version of stringify will deal with commas... */
-#define __stringify_in_c(...) #__VA_ARGS__
-#define stringify_in_c(...)   __stringify_in_c(__VA_ARGS__) " "
-#define __ASM_CONST(x)        x##UL
-#define ASM_CONST(x)          __ASM_CONST(x)
-
 
 /*
  * Machine parameters.
diff --git a/urcu/compiler.h b/urcu/compiler.h
index 54904cc..5b5a1e8 100644
--- a/urcu/compiler.h
+++ b/urcu/compiler.h
@@ -61,4 +61,15 @@
 		(type *)((char *)__ptr - offsetof(type, member));	\
 	})
 
+#ifndef __always_inline
+#define __always_inline inline
+#endif
+
+#define CAA_BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
+#define CAA_BUILD_BUG_ON_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1)
+
+/* This version of stringify will deal with commas... */
+#define __caa_stringify_in_c(...) #__VA_ARGS__
+#define caa_stringify_in_c(...)   __caa_stringify_in_c(__VA_ARGS__) " "
+
 #endif /* _URCU_COMPILER_H */
-- 
1.7.6






More information about the lttng-dev mailing list