Reproduced with gcc-8, gcc-10, gcc-11 in O2:
14:39:19 In file included from ../../include/urcu/pointer.h:39,
14:39:19 from ../../include/urcu-pointer.h:1,
14:39:19 from ../../include/urcu/rcuhlist.h:30,
14:39:19 from ../../include/urcu/cds.h:28,
14:39:19 from test_build.c:30:
14:39:19 test_build.c: In function ‘test_build_rcu_dereference’:
14:39:19 ../../include/urcu/static/pointer.h:102:55: warning: variable ‘_________p0’ set but not used [-Wunused-but-set-variable]
14:39:19 102 | __typeof__(p) _________p0 = { 0 }; \
14:39:19 | ^~~~~~~~~~~
14:39:19 ../../include/urcu/pointer.h:47:33: note: in expansion of macro ‘_rcu_dereference’
14:39:19 47 | #define rcu_dereference _rcu_dereference
14:39:19 | ^~~~~~~~~~~~~~~~
14:39:19 test_build.c:133:9: note: in expansion of macro ‘rcu_dereference’
14:39:19 133 | rcu_dereference(opaque_const);
14:39:19 | ^~~~~~~~~~~~~~~
14:39:19 mv -f .deps/test_urcu_multiflavor_single_unit_dynlink_cxx-test_urcu_multiflavor_single_unit_cxx.Tpo .deps/test_urcu_multiflavor_single_unit_dynlink_cxx-test_urcu_multiflavor_single_unit_cxx.Po
14:39:19 ../../include/urcu/static/pointer.h:102:55: warning: variable ‘_________p0’ set but not used [-Wunused-but-set-variable]
14:39:19 102 | __typeof__(p) _________p0 = { 0 }; \
14:39:19 | ^~~~~~~~~~~
14:39:19 ../../include/urcu/pointer.h:47:33: note: in expansion of macro ‘_rcu_dereference’
14:39:19 47 | #define rcu_dereference _rcu_dereference
14:39:19 | ^~~~~~~~~~~~~~~~
14:39:19 test_build.c:135:9: note: in expansion of macro ‘rcu_dereference’
14:39:19 135 | rcu_dereference(clear_const);
14:39:19 | ^~~~~~~~~~~~~~~
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: If3a78c2ec1c3ae0cab1ea5f9d40ede4e30f9bc81
#ifdef __URCU_DEREFERENCE_USE_ATOMIC_CONSUME
# define _rcu_dereference(p) __extension__ ({ \
__typeof__(__extension__ ({ \
- __typeof__(p) _________p0 = { 0 }; \
+ __typeof__(p) __attribute__((unused)) _________p0 = { 0 }; \
_________p0; \
})) _________p1; \
__atomic_load(&(p), &_________p1, __ATOMIC_CONSUME); \