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:37:36 +0000 (12:37 -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 4718f3b38e93aac09c2e670925e7247a72d04684..b40b3b6a0dc63fee58bbe7fa6083b35d68c77fa2 100644 (file)
--- a/urcu-bp.h
+++ b/urcu-bp.h
@@ -94,6 +94,7 @@ extern int rcu_read_ongoing(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))); \
@@ -102,6 +103,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);                     \
@@ -114,6 +116,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)),\
@@ -124,6 +127,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 5be986ca65a0d6aab3027812fdbc2f0b4acdffb5..18ea99ecf3808ddcbc81aa29f033c815d4483381 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 4b3185529bd886a0de8d906d465712a28ebb470c..511dbdf302456d46329bce98e1147b7c34a51543 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.029038 seconds and 4 git commands to generate.