[lttng-dev] lttng-ust with --std=c99 -pedantic
Mathieu Desnoyers
mathieu.desnoyers at efficios.com
Wed Jun 20 09:47:46 EDT 2012
* John Steele Scott (toojays at toojays.net) wrote:
> On 20/06/12 03:15, Mathieu Desnoyers wrote:
> > * Mathieu Desnoyers (mathieu.desnoyers at efficios.com) wrote:
> >> * John Steele Scott (toojays at toojays.net) wrote:
> >>
> snip snip
> >>> The thing I forgot to mention is: okay, I can build now with
> >>> -pedantic, but I can't build with "-pedantic -Werror". This
> >>> application builds with "--std=c99 -pedantic -Werror" (among many
> >>> other flags). I can of course remove -Werror for my tests, but in the
> >>> longer term I would like to see lttng-ust enabled in our regular
> >>> build, and disabling -Werror for that is not something we want to do.
> >>> If I only had to disable it for the trace provider, I could negotiate
> >>> that, but disabling it for any module which uses tracepoints is
> >>> undesirable.
> >>>
> >>> I haven't yet looked at how difficult it would be do eliminate these
> >>> pedantic warnings. Do you have a feel for what is involved?
> >>> Preprocessor tricks warp my mind. :(
> >> I don't think we'll want to make the lttng probe module build under
> >> --std=c99 -pedandic -Werror, but I think we should focus on making sure
> >> the tracepoint part that is built within the application (with
> >> TRACEPOINT_CREATE_PROBES _not_ defined) builds fine in --std=c99
> >> -pedantic.
> >>
> >> Currently, building a simple test program with tracepoints under
> >> --std=c99 -pedantic gets me:
> >>
> >>
> >> In file included from ust_tests_hello.h:25:0,
> >> from hello.c:34:
> >> ../../include/lttng/tracepoint.h: In function ‘__tracepoints__init’:
> >> ../../include/lttng/tracepoint.h:261:3: warning: ISO C forbids conversion of object pointer to function pointer type [-pedantic]
> >> ../../include/lttng/tracepoint.h:265:3: warning: ISO C forbids conversion of object pointer to function pointer type [-pedantic]
> >> ../../include/lttng/tracepoint.h:270:3: warning: ISO C forbids conversion of object pointer to function pointer type [-pedantic]
> >> ../../include/lttng/tracepoint.h:274:3: warning: ISO C forbids conversion of object pointer to function pointer type [-pedantic]
> >> ../../include/lttng/tracepoint.h:278:3: warning: ISO C forbids conversion of object pointer to function pointer type [-pedantic]
> >>
> >> ---> see include/lttng/tracepoint.h __tracepoints__init():
> >> ----> This is caused by use of dlsym() to lookup a function pointer from
> >> a symbol. dlsym() returns "void *", and we cast it into function
> >> pointer type. Ideas on how to make this c99 pedantic compliant are
> >> welcome.
>
> I found this warning discussed in a GCC bug report. Jakub Jelinek's suggestion at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45289#c6 (load the result of dlsym into a void *, then memcpy to the function pointer), does make these go away (using GCC 4.4.6 on Centos 6.2).
Can you check if these can be reproduced with gcc 4.5 or 4.6 ? (without
the memcpy trick)
The bugzilla entry seems to imply that the warning went away from
-pedantic mode at some point.
Thanks,
Mathieu
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
More information about the lttng-dev
mailing list