From: Mathieu Desnoyers Date: Wed, 17 Aug 2022 19:32:38 +0000 (-0400) Subject: Fix: add missing unused attribute to _rcu_dereference X-Git-Tag: v0.14.0~17 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=fada682f0d6e680f18e3243aa0af607dfafcbd32;p=urcu.git Fix: add missing unused attribute to _rcu_dereference 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 Change-Id: If3a78c2ec1c3ae0cab1ea5f9d40ede4e30f9bc81 --- diff --git a/include/urcu/static/pointer.h b/include/urcu/static/pointer.h index c276e68..9e46a57 100644 --- a/include/urcu/static/pointer.h +++ b/include/urcu/static/pointer.h @@ -99,7 +99,7 @@ extern "C" { #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); \