Add type checking in urcu-pointer.h macros
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Mon, 5 Oct 2009 19:29:09 +0000 (15:29 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Mon, 5 Oct 2009 19:29:09 +0000 (15:29 -0400)
Ensure we have type-checking around dynamic linking macro wrappers.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
urcu-pointer.c
urcu-pointer.h

index 93d49875d6226fcaf18ec4aba147c28994ad6f0d..da8b1ea7e76d0c702af5adb37f32361597525022 100644 (file)
@@ -30,7 +30,7 @@
 
 extern void synchronize_rcu(void);
 
-void *rcu_dereference(void *p)
+void *rcu_dereference_sym(void *p)
 {
        return _rcu_dereference(p);
 }
index 0a3524fa1e0b7b65cd6ec8154c9a45b2bf36abb5..d3718b020e070d95724db18513c022d784a136a0 100644 (file)
 
 #else /* !_LGPL_SOURCE */
 
-extern void *rcu_dereference(void *p);
+extern void *rcu_dereference_sym(void *p);
+#define rcu_dereference(p)                                                  \
+       ({                                                                   \
+               typeof(p) _________p1 =                                      \
+                       rcu_dereference_sym((void *)(p));                    \
+               (_________p1);                                               \
+       })
 
 extern void *rcu_cmpxchg_pointer_sym(void **p, void *old, void *_new);
-#define rcu_cmpxchg_pointer(p, old, _new)              \
-       rcu_cmpxchg_pointer_sym((void **)(p), (old), (_new))
+#define rcu_cmpxchg_pointer(p, old, _new)                                   \
+       ({                                                                   \
+               typeof(*p) _________p1 =                                     \
+                       rcu_cmpxchg_pointer_sym((void **)(p), (old), (_new));\
+               (_________p1);                                               \
+       })
 
 extern void *rcu_xchg_pointer_sym(void **p, void *v);
-#define rcu_xchg_pointer(p, v)                         \
-       rcu_xchg_pointer_sym((void **)(p), (v))
+#define rcu_xchg_pointer(p, v)                                              \
+       ({                                                                   \
+               typeof(*p) _________p1 =                                     \
+                       rcu_xchg_pointer_sym((void **)(p), (v));             \
+               (_________p1);                                               \
+       })
 
 extern void *rcu_set_pointer_sym(void **p, void *v);
-#define rcu_set_pointer(p, v)                          \
-       rcu_set_pointer_sym((void **)(p), (v))
-
-extern void *rcu_assign_pointer_sym(void **p, void *v);
+#define rcu_set_pointer(p, v)                                               \
+       ({                                                                   \
+               typeof(*p) _________p1 =                                     \
+                       rcu_set_pointer_sym((void **)(p), (v));              \
+       })
 
 #endif /* !_LGPL_SOURCE */
 
This page took 0.026254 seconds and 4 git commands to generate.