linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xen/trace: avoid clang warning on function pointers
@ 2019-07-12  8:58 Arnd Bergmann
  2019-07-12  9:16 ` Sedat Dilek
  2019-07-12 17:41 ` Nathan Chancellor
  0 siblings, 2 replies; 5+ messages in thread
From: Arnd Bergmann @ 2019-07-12  8:58 UTC (permalink / raw)
  To: Steven Rostedt, Ingo Molnar
  Cc: Arnd Bergmann, Jeremy Fitzhardinge, Sakari Ailus, Mike Rapoport,
	Petr Mladek, Bjorn Helgaas, linux-kernel, clang-built-linux

clang-9 does not like the way that the is_signed_type() compares
function pointers deep inside of the trace even macros:

In file included from arch/x86/xen/trace.c:21:
In file included from include/trace/events/xen.h:475:
In file included from include/trace/define_trace.h:102:
In file included from include/trace/trace_events.h:467:
include/trace/events/xen.h:69:7: error: ordered comparison of function pointers ('xen_mc_callback_fn_t' (aka 'void (*)(void *)') and 'xen_mc_callback_fn_t') [-Werror,-Wordered-compare-function-pointers]
                    __field(xen_mc_callback_fn_t, fn)
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/trace/trace_events.h:415:29: note: expanded from macro '__field'
 #define __field(type, item)     __field_ext(type, item, FILTER_OTHER)
                                ^
include/trace/trace_events.h:401:6: note: expanded from macro '__field_ext'
                                 is_signed_type(type), filter_type);    \
                                 ^
include/linux/trace_events.h:540:44: note: expanded from macro 'is_signed_type'
 #define is_signed_type(type)    (((type)(-1)) < (type)1)
                                              ^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/trace/trace_events.h:77:16: note: expanded from macro 'TRACE_EVENT'
                             PARAMS(tstruct),                  \
                             ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/tracepoint.h:95:25: note: expanded from macro 'PARAMS'
 #define PARAMS(args...) args
                        ^
include/trace/trace_events.h:455:2: note: expanded from macro 'DECLARE_EVENT_CLASS'
        tstruct;                                                        \
        ^~~~~~~

I guess the warning is reasonable in principle, though this seems to
be the only instance we get in the entire kernel today.
Shut up the warning by making it a void pointer in the exported
structure.

Fixes: c796f213a693 ("xen/trace: add multicall tracing")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 include/trace/events/xen.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/trace/events/xen.h b/include/trace/events/xen.h
index 9a0e8af21310..f75b77414ac1 100644
--- a/include/trace/events/xen.h
+++ b/include/trace/events/xen.h
@@ -66,7 +66,7 @@ TRACE_EVENT(xen_mc_callback,
 	    TP_PROTO(xen_mc_callback_fn_t fn, void *data),
 	    TP_ARGS(fn, data),
 	    TP_STRUCT__entry(
-		    __field(xen_mc_callback_fn_t, fn)
+		    __field(void *, fn)
 		    __field(void *, data)
 		    ),
 	    TP_fast_assign(
-- 
2.20.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] xen/trace: avoid clang warning on function pointers
  2019-07-12  8:58 [PATCH] xen/trace: avoid clang warning on function pointers Arnd Bergmann
@ 2019-07-12  9:16 ` Sedat Dilek
  2019-07-12 17:41 ` Nathan Chancellor
  1 sibling, 0 replies; 5+ messages in thread
From: Sedat Dilek @ 2019-07-12  9:16 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Steven Rostedt, Ingo Molnar, Jeremy Fitzhardinge, Sakari Ailus,
	Mike Rapoport, Petr Mladek, Bjorn Helgaas, linux-kernel,
	Clang-Built-Linux ML

On Fri, Jul 12, 2019 at 10:59 AM Arnd Bergmann <arnd@arndb.de> wrote:
>
> clang-9 does not like the way that the is_signed_type() compares
> function pointers deep inside of the trace even macros:
>
> In file included from arch/x86/xen/trace.c:21:
> In file included from include/trace/events/xen.h:475:
> In file included from include/trace/define_trace.h:102:
> In file included from include/trace/trace_events.h:467:
> include/trace/events/xen.h:69:7: error: ordered comparison of function pointers ('xen_mc_callback_fn_t' (aka 'void (*)(void *)') and 'xen_mc_callback_fn_t') [-Werror,-Wordered-compare-function-pointers]
>                     __field(xen_mc_callback_fn_t, fn)
>                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/trace/trace_events.h:415:29: note: expanded from macro '__field'
>  #define __field(type, item)     __field_ext(type, item, FILTER_OTHER)
>                                 ^
> include/trace/trace_events.h:401:6: note: expanded from macro '__field_ext'
>                                  is_signed_type(type), filter_type);    \
>                                  ^
> include/linux/trace_events.h:540:44: note: expanded from macro 'is_signed_type'
>  #define is_signed_type(type)    (((type)(-1)) < (type)1)
>                                               ^
> note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
> include/trace/trace_events.h:77:16: note: expanded from macro 'TRACE_EVENT'
>                              PARAMS(tstruct),                  \
>                              ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/tracepoint.h:95:25: note: expanded from macro 'PARAMS'
>  #define PARAMS(args...) args
>                         ^
> include/trace/trace_events.h:455:2: note: expanded from macro 'DECLARE_EVENT_CLASS'
>         tstruct;                                                        \
>         ^~~~~~~
>
> I guess the warning is reasonable in principle, though this seems to
> be the only instance we get in the entire kernel today.
> Shut up the warning by making it a void pointer in the exported
> structure.
>

Thanks for bringing this up (again), Arnd.

As this is a known CBL issue please add...

Link: https://github.com/ClangBuiltLinux/linux/issues/97

...and...

Tested-by: Sedat Dilek <sedat.dilek@gmail.com>

For the sake of completeness see also the comments of Steven Rostedt
and user "Honeybyte" in the above Link - if not known/read.

- Sedat -

P.S.: I am using this patch since 6 months in my
for-5.x/clang-warningfree local Git repository.

> Fixes: c796f213a693 ("xen/trace: add multicall tracing")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  include/trace/events/xen.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/trace/events/xen.h b/include/trace/events/xen.h
> index 9a0e8af21310..f75b77414ac1 100644
> --- a/include/trace/events/xen.h
> +++ b/include/trace/events/xen.h
> @@ -66,7 +66,7 @@ TRACE_EVENT(xen_mc_callback,
>             TP_PROTO(xen_mc_callback_fn_t fn, void *data),
>             TP_ARGS(fn, data),
>             TP_STRUCT__entry(
> -                   __field(xen_mc_callback_fn_t, fn)
> +                   __field(void *, fn)
>                     __field(void *, data)
>                     ),
>             TP_fast_assign(
> --
> 2.20.0
>
> --
> You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20190712085908.4146364-1-arnd%40arndb.de.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xen/trace: avoid clang warning on function pointers
  2019-07-12  8:58 [PATCH] xen/trace: avoid clang warning on function pointers Arnd Bergmann
  2019-07-12  9:16 ` Sedat Dilek
@ 2019-07-12 17:41 ` Nathan Chancellor
  2019-09-23 22:06   ` Nick Desaulniers
  1 sibling, 1 reply; 5+ messages in thread
From: Nathan Chancellor @ 2019-07-12 17:41 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Steven Rostedt, Ingo Molnar, Jeremy Fitzhardinge, Sakari Ailus,
	Mike Rapoport, Petr Mladek, Bjorn Helgaas, linux-kernel,
	clang-built-linux

On Fri, Jul 12, 2019 at 10:58:48AM +0200, Arnd Bergmann wrote:
> clang-9 does not like the way that the is_signed_type() compares
> function pointers deep inside of the trace even macros:
> 
> In file included from arch/x86/xen/trace.c:21:
> In file included from include/trace/events/xen.h:475:
> In file included from include/trace/define_trace.h:102:
> In file included from include/trace/trace_events.h:467:
> include/trace/events/xen.h:69:7: error: ordered comparison of function pointers ('xen_mc_callback_fn_t' (aka 'void (*)(void *)') and 'xen_mc_callback_fn_t') [-Werror,-Wordered-compare-function-pointers]
>                     __field(xen_mc_callback_fn_t, fn)
>                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/trace/trace_events.h:415:29: note: expanded from macro '__field'
>  #define __field(type, item)     __field_ext(type, item, FILTER_OTHER)
>                                 ^
> include/trace/trace_events.h:401:6: note: expanded from macro '__field_ext'
>                                  is_signed_type(type), filter_type);    \
>                                  ^
> include/linux/trace_events.h:540:44: note: expanded from macro 'is_signed_type'
>  #define is_signed_type(type)    (((type)(-1)) < (type)1)
>                                               ^
> note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
> include/trace/trace_events.h:77:16: note: expanded from macro 'TRACE_EVENT'
>                              PARAMS(tstruct),                  \
>                              ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/tracepoint.h:95:25: note: expanded from macro 'PARAMS'
>  #define PARAMS(args...) args
>                         ^
> include/trace/trace_events.h:455:2: note: expanded from macro 'DECLARE_EVENT_CLASS'
>         tstruct;                                                        \
>         ^~~~~~~
> 
> I guess the warning is reasonable in principle, though this seems to
> be the only instance we get in the entire kernel today.
> Shut up the warning by making it a void pointer in the exported
> structure.
> 
> Fixes: c796f213a693 ("xen/trace: add multicall tracing")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Nick suggested this as well, I think it's reasonable to work around it
in this one location since this is indeed the only instance of this
warning that I see in the kernel tree across all of my builds.

Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xen/trace: avoid clang warning on function pointers
  2019-07-12 17:41 ` Nathan Chancellor
@ 2019-09-23 22:06   ` Nick Desaulniers
  2019-09-23 22:07     ` Nick Desaulniers
  0 siblings, 1 reply; 5+ messages in thread
From: Nick Desaulniers @ 2019-09-23 22:06 UTC (permalink / raw)
  To: Steven Rostedt, Ingo Molnar
  Cc: Arnd Bergmann, Jeremy Fitzhardinge, Sakari Ailus, Mike Rapoport,
	Petr Mladek, Bjorn Helgaas, LKML, clang-built-linux,
	Nathan Chancellor

On Fri, Jul 12, 2019 at 10:41 AM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> On Fri, Jul 12, 2019 at 10:58:48AM +0200, Arnd Bergmann wrote:
> > clang-9 does not like the way that the is_signed_type() compares
> > function pointers deep inside of the trace even macros:
> >
> > In file included from arch/x86/xen/trace.c:21:
> > In file included from include/trace/events/xen.h:475:
> > In file included from include/trace/define_trace.h:102:
> > In file included from include/trace/trace_events.h:467:
> > include/trace/events/xen.h:69:7: error: ordered comparison of function pointers ('xen_mc_callback_fn_t' (aka 'void (*)(void *)') and 'xen_mc_callback_fn_t') [-Werror,-Wordered-compare-function-pointers]
> >                     __field(xen_mc_callback_fn_t, fn)
> >                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > include/trace/trace_events.h:415:29: note: expanded from macro '__field'
> >  #define __field(type, item)     __field_ext(type, item, FILTER_OTHER)
> >                                 ^
> > include/trace/trace_events.h:401:6: note: expanded from macro '__field_ext'
> >                                  is_signed_type(type), filter_type);    \
> >                                  ^
> > include/linux/trace_events.h:540:44: note: expanded from macro 'is_signed_type'
> >  #define is_signed_type(type)    (((type)(-1)) < (type)1)
> >                                               ^
> > note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
> > include/trace/trace_events.h:77:16: note: expanded from macro 'TRACE_EVENT'
> >                              PARAMS(tstruct),                  \
> >                              ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > include/linux/tracepoint.h:95:25: note: expanded from macro 'PARAMS'
> >  #define PARAMS(args...) args
> >                         ^
> > include/trace/trace_events.h:455:2: note: expanded from macro 'DECLARE_EVENT_CLASS'
> >         tstruct;                                                        \
> >         ^~~~~~~
> >
> > I guess the warning is reasonable in principle, though this seems to
> > be the only instance we get in the entire kernel today.
> > Shut up the warning by making it a void pointer in the exported
> > structure.
> >
> > Fixes: c796f213a693 ("xen/trace: add multicall tracing")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> Nick suggested this as well, I think it's reasonable to work around it
> in this one location since this is indeed the only instance of this
> warning that I see in the kernel tree across all of my builds.
>
> Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>


Steven, Ingo, would one of you mind picking up this fix, please?  See
for multiple reports:
https://github.com/ClangBuiltLinux/linux/issues/216
-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xen/trace: avoid clang warning on function pointers
  2019-09-23 22:06   ` Nick Desaulniers
@ 2019-09-23 22:07     ` Nick Desaulniers
  0 siblings, 0 replies; 5+ messages in thread
From: Nick Desaulniers @ 2019-09-23 22:07 UTC (permalink / raw)
  To: Steven Rostedt, Ingo Molnar
  Cc: Arnd Bergmann, Jeremy Fitzhardinge, Sakari Ailus, Mike Rapoport,
	Petr Mladek, Bjorn Helgaas, LKML, clang-built-linux,
	Nathan Chancellor

On Mon, Sep 23, 2019 at 3:06 PM Nick Desaulniers
<ndesaulniers@google.com> wrote:
> Steven, Ingo, would one of you mind picking up this fix, please?  See
> for multiple reports:
> https://github.com/ClangBuiltLinux/linux/issues/216

Sorry, https://github.com/ClangBuiltLinux/linux/issues/97 is the link.
--
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-09-23 22:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-12  8:58 [PATCH] xen/trace: avoid clang warning on function pointers Arnd Bergmann
2019-07-12  9:16 ` Sedat Dilek
2019-07-12 17:41 ` Nathan Chancellor
2019-09-23 22:06   ` Nick Desaulniers
2019-09-23 22:07     ` Nick Desaulniers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).