Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Guoqing Jiang <guoqing.jiang@linux.dev>
Cc: dennis.dalessandro@cornelisnetworks.com, jgg@ziepe.ca,
	linux-rdma@vger.kernel.org
Subject: Re: [PATCH] RDMA/hfi1: Suppress compiler warnings
Date: Wed, 17 Aug 2022 20:28:40 +0300	[thread overview]
Message-ID: <Yv0lSAlIsClbOpHm@unreal> (raw)
In-Reply-To: <20220817142215.17251-1-guoqing.jiang@linux.dev>

On Wed, Aug 17, 2022 at 10:22:15PM +0800, Guoqing Jiang wrote:
> With W=1, the following compiler warnings appears.
> 
> In file included from ./include/trace/define_trace.h:102:0,
>                  from drivers/infiniband/hw/hfi1/trace_dbg.h:111,
>                  from drivers/infiniband/hw/hfi1/trace.h:15,
>                  from drivers/infiniband/hw/hfi1/trace.c:6:
> drivers/infiniband/hw/hfi1/./trace_dbg.h: In function ‘trace_event_get_offsets_hfi1_trace_template’:
> ./include/trace/trace_events.h:261:9: warning: function ‘trace_event_get_offsets_hfi1_trace_template’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
>   struct trace_event_raw_##call __maybe_unused *entry;  \
>          ^
> drivers/infiniband/hw/hfi1/./trace_dbg.h:25:1: note: in expansion of macro ‘DECLARE_EVENT_CLASS’
>  DECLARE_EVENT_CLASS(hfi1_trace_template,
>  ^~~~~~~~~~~~~~~~~~~
> In file included from ./include/trace/define_trace.h:102:0,
>                  from drivers/infiniband/hw/hfi1/trace_dbg.h:111,
>                  from drivers/infiniband/hw/hfi1/trace.h:15,
>                  from drivers/infiniband/hw/hfi1/trace.c:6:
> drivers/infiniband/hw/hfi1/./trace_dbg.h: In function ‘trace_event_raw_event_hfi1_trace_template’:
> ./include/trace/trace_events.h:386:9: warning: function ‘trace_event_raw_event_hfi1_trace_template’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
>   struct trace_event_raw_##call *entry;    \
>          ^
> drivers/infiniband/hw/hfi1/./trace_dbg.h:25:1: note: in expansion of macro ‘DECLARE_EVENT_CLASS’
>  DECLARE_EVENT_CLASS(hfi1_trace_template,
>  ^~~~~~~~~~~~~~~~~~~
> In file included from ./include/trace/define_trace.h:103:0,
>                  from drivers/infiniband/hw/hfi1/trace_dbg.h:111,
>                  from drivers/infiniband/hw/hfi1/trace.h:15,
>                  from drivers/infiniband/hw/hfi1/trace.c:6:
> drivers/infiniband/hw/hfi1/./trace_dbg.h: In function ‘perf_trace_hfi1_trace_template’:
> ./include/trace/perf.h:64:9: warning: function ‘perf_trace_hfi1_trace_template’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
>   struct hlist_head *head;     \
>          ^
> drivers/infiniband/hw/hfi1/./trace_dbg.h:25:1: note: in expansion of macro ‘DECLARE_EVENT_CLASS’
>  DECLARE_EVENT_CLASS(hfi1_trace_template,
>  ^~~~~~~~~~~~~~~~~~~
> 
> Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
> ---
>  drivers/infiniband/hw/hfi1/trace_dbg.h | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/infiniband/hw/hfi1/trace_dbg.h b/drivers/infiniband/hw/hfi1/trace_dbg.h
> index 582b6f68df3d..489395bfb5b3 100644
> --- a/drivers/infiniband/hw/hfi1/trace_dbg.h
> +++ b/drivers/infiniband/hw/hfi1/trace_dbg.h
> @@ -22,6 +22,11 @@
>  
>  #define MAX_MSG_LEN 512
>  
> +#pragma GCC diagnostic push
> +#ifndef __clang__
> +#pragma GCC diagnostic ignored "-Wsuggest-attribute=format"
> +#endif

I don't like it.

Or let's fix the code (don't know how) or disable this warning for whole
kernel.

Thanks

      reply	other threads:[~2022-08-17 17:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-17 14:22 [PATCH] RDMA/hfi1: Suppress compiler warnings Guoqing Jiang
2022-08-17 17:28 ` Leon Romanovsky [this message]

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=Yv0lSAlIsClbOpHm@unreal \
    --to=leon@kernel.org \
    --cc=dennis.dalessandro@cornelisnetworks.com \
    --cc=guoqing.jiang@linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=linux-rdma@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox