Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark braced-groups within expressions with __extension__ #4

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions urcu-bp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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))); \
Expand All @@ -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); \
Expand All @@ -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)),\
Expand All @@ -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)), \
Expand Down
3 changes: 3 additions & 0 deletions urcu-pointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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))); \
Expand All @@ -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); \
Expand All @@ -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)), \
Expand Down
3 changes: 3 additions & 0 deletions urcu/arch/ppc.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,23 @@ extern "C" {
#define cmm_smp_wmb() __asm__ __volatile__ (LWSYNC_OPCODE:::"memory")

#define mftbl() \
__extension__ \
({ \
unsigned long rval; \
__asm__ __volatile__ ("mftbl %0" : "=r" (rval)); \
rval; \
})

#define mftbu() \
__extension__ \
({ \
unsigned long rval; \
__asm__ __volatile__ ("mftbu %0" : "=r" (rval)); \
rval; \
})

#define mftb() \
__extension__ \
({ \
unsigned long long rval; \
__asm__ __volatile__ ("mftb %0" : "=r" (rval)); \
Expand Down
1 change: 1 addition & 0 deletions urcu/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)); \
Expand Down
6 changes: 5 additions & 1 deletion urcu/static/urcu-pointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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); \
Expand All @@ -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); \
Expand All @@ -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) || \
Expand Down
4 changes: 3 additions & 1 deletion urcu/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -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); \
Expand All @@ -41,13 +42,14 @@
* 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(); \
Expand Down