[ltt-dev] [UST PATCH] Fixes container_of macro redefinition warnings

David Goulet david.goulet at polymtl.ca
Wed Sep 22 16:52:47 EDT 2010


On urcu commit 453629a9317adef5b96c3d55e4dcd98db680997a, the
container_of macro was moved to urcu/compiler.h. Since, multiple
warnings appear about redefinition

Signed-off-by: David Goulet <david.goulet at polymtl.ca>
---
 include/ust/core.h           |    2 ++
 include/ust/kcompat/simple.h |    3 ++-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/include/ust/core.h b/include/ust/core.h
index 0172614..d5a1f4d 100644
--- a/include/ust/core.h
+++ b/include/ust/core.h
@@ -141,8 +141,10 @@ static __inline__ int get_count_order(unsigned int count)
 	return order;
 }
 
+#ifndef container_of
 #define container_of(ptr, type, member) ({                      \
         const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
         (type *)( (char *)__mptr - offsetof(type,member) );})
+#endif /* containter_of */
 
 #endif /* UST_CORE_H */
diff --git a/include/ust/kcompat/simple.h b/include/ust/kcompat/simple.h
index 762d802..586b2ed 100644
--- a/include/ust/kcompat/simple.h
+++ b/include/ust/kcompat/simple.h
@@ -28,10 +28,11 @@
  * @member:	the name of the member within the struct.
  *
  */
+#ifndef container_of
 #define container_of(ptr, type, member) ({			\
 	const typeof( ((type *)0)->member ) *__mptr = (ptr);	\
 	(type *)( (char *)__mptr - offsetof(type,member) );})
-
+#endif /* container_of */
 
 /* libkcompat: from rcupdate.h */
 
-- 
1.7.3





More information about the lttng-dev mailing list