From a4eaf8eabe829be8f7d7432ffaf83291a068b0ed Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Mon, 18 Jun 2012 10:10:36 -0400 Subject: [PATCH] Fix c99 compatibility: tp_rcu_dereference_bp() should not use braced-groups within expressions MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Allow tp_rcu_dereference_bp() to be used within programs compiled with --std=c99 -pedantic -Werror. Fixes the following: In file included from hello.c:34:0: ust_tests_hello.h: In function ‘__tracepoint_cb_ust_tests_hello___tptest’: ust_tests_hello.h:28:1: warning: ISO C forbids braced-groups within expressions [-pedantic] ust_tests_hello.h:28:1: warning: ISO C forbids conversion of object pointer to function pointer type [-pedantic] We can easily fix this one since tp_rcu_dereference_bp() really evaluates only a single expression. Signed-off-by: Mathieu Desnoyers --- include/lttng/tracepoint-rcu.h | 9 +++------ tests/hello/Makefile.am | 5 +++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/include/lttng/tracepoint-rcu.h b/include/lttng/tracepoint-rcu.h index a754048c..2e0a79fd 100644 --- a/include/lttng/tracepoint-rcu.h +++ b/include/lttng/tracepoint-rcu.h @@ -31,12 +31,9 @@ #define tp_rcu_read_lock_bp tracepoint_dlopen.rcu_read_lock_sym_bp #define tp_rcu_read_unlock_bp tracepoint_dlopen.rcu_read_unlock_sym_bp -#define tp_rcu_dereference_bp(p) \ - ({ \ - __typeof__(p) _________p1 = URCU_FORCE_CAST(__typeof__(p), \ - tracepoint_dlopen.rcu_dereference_sym_bp(URCU_FORCE_CAST(void *, p))); \ - (_________p1); \ - }) +#define tp_rcu_dereference_bp(p) \ + URCU_FORCE_CAST(__typeof__(p), \ + tracepoint_dlopen.rcu_dereference_sym_bp(URCU_FORCE_CAST(void *, p))) #define TP_RCU_LINK_TEST() tp_rcu_read_lock_bp diff --git a/tests/hello/Makefile.am b/tests/hello/Makefile.am index 0c4c3113..4abfd580 100644 --- a/tests/hello/Makefile.am +++ b/tests/hello/Makefile.am @@ -1,9 +1,10 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -Wsystem-headers noinst_PROGRAMS = hello -hello_SOURCES = hello.c tp.c ust_tests_hello.h +#hello_SOURCES = hello.c tp.c ust_tests_hello.h +hello_SOURCES = hello.c ust_tests_hello.h hello_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la -hello_CFLAGS = -Werror=old-style-definition +hello_CFLAGS = -Werror=old-style-definition --std=c99 -pedantic if LTTNG_UST_BUILD_WITH_LIBDL hello_LDADD += -ldl -- 2.34.1