Mark braced-groups within expressions with __extension__
authorLuca Boccassi <lboccass@brocade.com>
Wed, 25 Mar 2015 19:39:00 +0000 (19:39 +0000)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 6 Apr 2015 16:50:51 +0000 (12:50 -0400)
Braced-groups within expressions are not valid ISO C, so
if a macro uses them and it's included in a project built
with -pedantic, the build will fail. GCC and CLANG do
support them as extension, so marking them as such allows
the build to complete even with -pedantic.

Signed-off-by: Luca Boccassi <lboccass@brocade.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
urcu-bp.h
urcu-pointer.h
urcu/arch/ppc.h
urcu/compiler.h
urcu/static/urcu-pointer.h
urcu/system.h

index 833688f7b553089deb21e7a32187bb83d5b5fdf3..1a1545f2b6e847a1708d8472059d468f95a42d19 100644 (file)
--- a/urcu-bp.h
+++ b/urcu-bp.h
@@ -92,6 +92,7 @@ extern void rcu_read_unlock(void);
 
 extern void *rcu_dereference_sym_bp(void *p);
 #define rcu_dereference_bp(p)                                               \
+       __extension__                                                        \
        ({                                                                   \
                __typeof__(p) _________p1 = URCU_FORCE_CAST(__typeof__(p),   \
                        rcu_dereference_sym_bp(URCU_FORCE_CAST(void *, p))); \
@@ -100,6 +101,7 @@ extern void *rcu_dereference_sym_bp(void *p);
 
 extern void *rcu_cmpxchg_pointer_sym_bp(void **p, void *old, void *_new);
 #define rcu_cmpxchg_pointer_bp(p, old, _new)                                \
+       __extension__                                                        \
        ({                                                                   \
                __typeof__(*(p)) _________pold = (old);                      \
                __typeof__(*(p)) _________pnew = (_new);                     \
@@ -112,6 +114,7 @@ extern void *rcu_cmpxchg_pointer_sym_bp(void **p, void *old, void *_new);
 
 extern void *rcu_xchg_pointer_sym_bp(void **p, void *v);
 #define rcu_xchg_pointer_bp(p, v)                                           \
+       __extension__                                                        \
        ({                                                                   \
                __typeof__(*(p)) _________pv = (v);                          \
                __typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*(p)),\
@@ -122,6 +125,7 @@ extern void *rcu_xchg_pointer_sym_bp(void **p, void *v);
 
 extern void *rcu_set_pointer_sym_bp(void **p, void *v);
 #define rcu_set_pointer_bp(p, v)                                            \
+       __extension__                                                        \
        ({                                                                   \
                __typeof__(*(p)) _________pv = (v);                          \
                __typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*(p)), \
index 03bfe793c6aaf339a03d7aa0e64bed0b105a8646..9a5f94ab5817998bc7ac915a09817ddb5b7b0cde 100644 (file)
@@ -66,6 +66,7 @@ extern "C" {
 
 extern void *rcu_dereference_sym(void *p);
 #define rcu_dereference(p)                                                  \
+       __extension__                                                        \
        ({                                                                   \
                __typeof__(p) _________p1 =     URCU_FORCE_CAST(__typeof__(p), \
                        rcu_dereference_sym(URCU_FORCE_CAST(void *, p)));    \
@@ -74,6 +75,7 @@ extern void *rcu_dereference_sym(void *p);
 
 extern void *rcu_cmpxchg_pointer_sym(void **p, void *old, void *_new);
 #define rcu_cmpxchg_pointer(p, old, _new)                                   \
+       __extension__                                                        \
        ({                                                                   \
                __typeof__(*(p)) _________pold = (old);                      \
                __typeof__(*(p)) _________pnew = (_new);                     \
@@ -86,6 +88,7 @@ extern void *rcu_cmpxchg_pointer_sym(void **p, void *old, void *_new);
 
 extern void *rcu_xchg_pointer_sym(void **p, void *v);
 #define rcu_xchg_pointer(p, v)                                              \
+       __extension__                                                        \
        ({                                                                   \
                __typeof__(*(p)) _________pv = (v);                          \
                __typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*(p)), \
index 95393ea0be0ee89b888c64ad53322e41e30631c8..1068b288027bda8a5c1f47ce0229e484de827fc6 100644 (file)
@@ -58,6 +58,7 @@ extern "C" {
 #define cmm_smp_wmb()    __asm__ __volatile__ (LWSYNC_OPCODE:::"memory")
 
 #define mftbl()                                                \
+       __extension__                                   \
        ({                                              \
                unsigned long rval;                     \
                __asm__ __volatile__ ("mftbl %0" : "=r" (rval));        \
@@ -65,6 +66,7 @@ extern "C" {
        })
 
 #define mftbu()                                                \
+       __extension__                                   \
        ({                                              \
                unsigned long rval;                     \
                __asm__ __volatile__ ("mftbu %0" : "=r" (rval));        \
@@ -72,6 +74,7 @@ extern "C" {
        })
 
 #define mftb()                                         \
+       __extension__                                   \
        ({                                              \
                unsigned long long rval;                \
                __asm__ __volatile__ ("mftb %0" : "=r" (rval));         \
index e7817dbd019f8803abea56cd54fd749ebe6279d6..378f0eae8a59b3d0c1029566a174b0b6011e3009 100644 (file)
@@ -64,6 +64,7 @@
  * @member: name of the field within the object.
  */
 #define caa_container_of(ptr, type, member)                            \
+       __extension__                                                   \
        ({                                                              \
                const __typeof__(((type *) NULL)->member) * __ptr = (ptr); \
                (type *)((char *)__ptr - offsetof(type, member));       \
index a5b3e4b190852811b039c26be66f65c33bef64e6..06371e3dd1c066387db5316087346ccf9bbdf80b 100644 (file)
@@ -64,7 +64,9 @@ extern "C" {
  * meets the 10-line criterion in LGPL, allowing this function to be
  * expanded directly in non-LGPL code.
  */
-#define _rcu_dereference(p)     ({                                     \
+#define _rcu_dereference(p)                                            \
+                               __extension__                           \
+                               ({                                      \
                                __typeof__(p) _________p1 = CMM_LOAD_SHARED(p); \
                                cmm_smp_read_barrier_depends();         \
                                (_________p1);                          \
@@ -82,6 +84,7 @@ extern "C" {
  * expanded directly in non-LGPL code.
  */
 #define _rcu_cmpxchg_pointer(p, old, _new)                             \
+       __extension__                                                   \
        ({                                                              \
                __typeof__(*p) _________pold = (old);                   \
                __typeof__(*p) _________pnew = (_new);                  \
@@ -101,6 +104,7 @@ extern "C" {
  * expanded directly in non-LGPL code.
  */
 #define _rcu_xchg_pointer(p, v)                                \
+       __extension__                                   \
        ({                                              \
                __typeof__(*p) _________pv = (v);       \
                if (!__builtin_constant_p(v) ||         \
index 6f314595178e98385fd72e9d48c3f82de374081b..faae39055484875b237dd62dd0928e9903725da1 100644 (file)
@@ -32,6 +32,7 @@
  * Load a data from shared memory, doing a cache flush if required.
  */
 #define CMM_LOAD_SHARED(p)                     \
+       __extension__                   \
        ({                              \
                cmm_smp_rmc();          \
                _CMM_LOAD_SHARED(p);    \
  * Identify a shared store. A cmm_smp_wmc() or cmm_smp_mc() should
  * follow the store.
  */
-#define _CMM_STORE_SHARED(x, v)        ({ CMM_ACCESS_ONCE(x) = (v); })
+#define _CMM_STORE_SHARED(x, v)        __extension__ ({ CMM_ACCESS_ONCE(x) = (v); })
 
 /*
  * Store v into x, where x is located in shared memory. Performs the
  * required cache flush after writing. Returns v.
  */
 #define CMM_STORE_SHARED(x, v)                                         \
+       __extension__                                                   \
        ({                                                              \
                __typeof__(x) _v = _CMM_STORE_SHARED(x, v);             \
                cmm_smp_wmc();                                          \
This page took 0.029468 seconds and 4 git commands to generate.