* [lttng-dev] [RFC] [PATCH] -Werror=old-style-definition and UST tracepoints
@ 2012-06-08 18:26 Hollis Blanchard
2012-06-11 13:52 ` Mathieu Desnoyers
0 siblings, 1 reply; 2+ messages in thread
From: Hollis Blanchard @ 2012-06-08 18:26 UTC (permalink / raw)
I've defined a tracepoint without arguments:
TRACEPOINT_EVENT(
qemu_tb_hash,
flushall,
TP_ARGS(void),
TP_FIELDS()
)
When I build (with -Werror=old-style-definition), I get this error:
In file included from /home/hollisb/work/qemu.git/exec.c:59:0:
/home/hollisb/work/qemu.git/tracepoints.h:24:2: error: function declaration isn?t a prototype [-Werror=strict-prototypes]
/home/hollisb/work/qemu.git/tracepoints.h: In function ?__tracepoint_cb_qemu_tb_hash___flushall?:
/home/hollisb/work/qemu.git/tracepoints.h:24:2: error: old-style function definition [-Werror=old-style-definition]
cc1: all warnings being treated as errors
The preprocessed code looks like so:
extern struct
# 129 "/usr/local/include/lttng/tracepoint.h" 3
tracepoint
# 24 "/home/hollisb/work/qemu.git/tracepoints.h"
__tracepoint_qemu_tb_hash___flushall
# 19 "/home/hollisb/work/qemu.git/tracepoints.h"
; static __attribute__ (( always_inline )) __inline__ void
__tracepoint_cb_qemu_tb_hash___flushall
# 19 "/home/hollisb/work/qemu.git/tracepoints.h"
() { struct tracepoint_probe *__tp_probe; if (!tracepoint_dlopen.rcu_read_lock_sym_bp) return; tracepoint_dlopen.rcu_read_lock_sym_bp(); __tp_probe = ({ typeof(__tracepoint_qemu_tb_hash___flushall.probes) _________p1 = ((typeof(__tracepoint_qemu_tb_hash___flushall.probes)) (tracepoint_dlopen.rcu_dereference_sym_bp(((void *) (__tracepoint_qemu_tb_hash___flushall.probes))))); (_________p1); }); if (__builtin_expect(!!(!__tp_probe), 0)) goto end; do { void *__tp_cb = __tp_probe->func; void *__tp_data = __tp_probe->data; ((void (*)(void *__tp_data)) (__tp_cb)) (__tp_data); } while ((++__tp_probe)->func); end: tracepoint_dlopen.rcu_read_unlock_sym_bp(); } static __attribute__ (( always_inline )) __inline__ void
I believe the problem comes from -Werror=old-style-definition not liking
that empty "()", i.e. tracepoint_cb_qemu_tb_hash___flushall() { ... }.
The following patch seems to work for me; is there a reason it isn't
already written this way?
diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h
index 4b773bb..60d8c73 100644
--- a/include/lttng/tracepoint.h
+++ b/include/lttng/tracepoint.h
@@ -88,7 +88,7 @@ extern "C" {
#define _TP_EXDATA_VAR20(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) __tp_data,b,d,f,h,j,l,n,p,r,t
/* _TP_EXPROTO* extract tuples of type, var */
-#define _TP_EXPROTO0()
+#define _TP_EXPROTO0() void
#define _TP_EXPROTO2(a,b) a b
#define _TP_EXPROTO4(a,b,c,d) a b,c d
#define _TP_EXPROTO6(a,b,c,d,e,f) a b,c d,e f
If this is OK, I'm happy to resend as a proper patch.
--
Hollis Blanchard
Mentor Graphics, Embedded Systems Division
^ permalink raw reply [flat|nested] 2+ messages in thread
* [lttng-dev] [RFC] [PATCH] -Werror=old-style-definition and UST tracepoints
2012-06-08 18:26 [lttng-dev] [RFC] [PATCH] -Werror=old-style-definition and UST tracepoints Hollis Blanchard
@ 2012-06-11 13:52 ` Mathieu Desnoyers
0 siblings, 0 replies; 2+ messages in thread
From: Mathieu Desnoyers @ 2012-06-11 13:52 UTC (permalink / raw)
* Hollis Blanchard (hollis_blanchard at mentor.com) wrote:
[...]
> I believe the problem comes from -Werror=old-style-definition not liking
> that empty "()", i.e. tracepoint_cb_qemu_tb_hash___flushall() { ... }.
> The following patch seems to work for me; is there a reason it isn't
> already written this way?
Good catch !
Fixed as master commit:
commit 86637aa6452f66dee5f769461668c2ea059b3a30
Author: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
Date: Mon Jun 11 09:53:07 2012 -0400
Fix: tracepoint.h should not generate old-style definitions
and merged into stable-2.0.
Thanks!
Mathieu
>
> diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h
>
> index 4b773bb..60d8c73 100644
>
> --- a/include/lttng/tracepoint.h
>
> +++ b/include/lttng/tracepoint.h
>
> @@ -88,7 +88,7 @@ extern "C" {
>
> #define _TP_EXDATA_VAR20(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) __tp_data,b,d,f,h,j,l,n,p,r,t
>
>
>
> /* _TP_EXPROTO* extract tuples of type, var */
>
> -#define _TP_EXPROTO0()
>
> +#define _TP_EXPROTO0() void
>
> #define _TP_EXPROTO2(a,b) a b
>
> #define _TP_EXPROTO4(a,b,c,d) a b,c d
>
> #define _TP_EXPROTO6(a,b,c,d,e,f) a b,c d,e f
>
>
> If this is OK, I'm happy to resend as a proper patch.
>
> --
> Hollis Blanchard
> Mentor Graphics, Embedded Systems Division
>
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-06-11 13:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-08 18:26 [lttng-dev] [RFC] [PATCH] -Werror=old-style-definition and UST tracepoints Hollis Blanchard
2012-06-11 13:52 ` Mathieu Desnoyers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox