All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <natechancellor@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@redhat.com>,
	Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Mike Rapoport <rppt@linux.ibm.com>,
	Petr Mladek <pmladek@suse.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com
Subject: Re: [PATCH] xen/trace: avoid clang warning on function pointers
Date: Fri, 12 Jul 2019 10:41:42 -0700	[thread overview]
Message-ID: <20190712174142.GB127917@archlinux-threadripper> (raw)
In-Reply-To: <20190712085908.4146364-1-arnd@arndb.de>

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>

  parent reply	other threads:[~2019-07-12 17:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2019-09-23 22:06   ` Nick Desaulniers
2019-09-23 22:07     ` Nick Desaulniers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190712174142.GB127917@archlinux-threadripper \
    --to=natechancellor@gmail.com \
    --cc=arnd@arndb.de \
    --cc=bhelgaas@google.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=jeremy.fitzhardinge@citrix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=rppt@linux.ibm.com \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.