Fix: add missing unused attribute to _rcu_dereference
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 17 Aug 2022 19:32:38 +0000 (15:32 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 17 Aug 2022 19:34:00 +0000 (15:34 -0400)
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

include/urcu/static/pointer.h

index c276e68ef770c13c6d6b0c1cf79b9bd055ae4ee0..9e46a5769c92fc99142adf55989aa0d37581647c 100644 (file)
@@ -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);    \
This page took 0.027238 seconds and 4 git commands to generate.