mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>, linux-kernel@vger.kernel.org
Subject: [PATCH] tracing: turn off -Wsuggest-attribute=format for sample
Date: Tue,  3 Feb 2026 17:25:41 +0100	[thread overview]
Message-ID: <20260203162546.2254900-1-arnd@kernel.org> (raw)

From: Arnd Bergmann <arnd@arndb.de>

The foo_bar tracing sample produces a few harmless warnings when
-Wsuggest-attribute=format is enabled, which can lead to failed
build in combination with -Werror:

In file included from include/trace/define_trace.h:132,
                 from samples/trace_events/trace-events-sample.h:640,
                 from samples/trace_events/trace-events-sample.c:12:
samples/trace_events/./trace-events-sample.h: In function 'trace_event_get_offsets_foo_bar':
include/trace/stages/stage5_get_offsets.h:33:31: error: function 'trace_event_get_offsets_foo_bar' might be a candidate for 'gnu_printf' format attribute [-Werror=suggest-attribute=format]
   33 |         { (void)sizeof(struct _test_no_array_##item *); }
      |                               ^~~~~~~~~~~~~~~

This seems to be a false positive and I can't see an obvious way to
annotate it, so instead just shut up that warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 samples/trace_events/trace-events-sample.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/samples/trace_events/trace-events-sample.c b/samples/trace_events/trace-events-sample.c
index ecc7db237f2e..9993fb5d5f98 100644
--- a/samples/trace_events/trace-events-sample.c
+++ b/samples/trace_events/trace-events-sample.c
@@ -9,6 +9,8 @@
  * creates the handles for the trace points.
  */
 #define CREATE_TRACE_POINTS
+__diag_ignore(GCC, all, "-Wsuggest-attribute=format",
+             "trace_event_get_offsets_foo_bar can't easily be annotated as __printf");
 #include "trace-events-sample.h"
 
 static const char *random_strings[] = {
-- 
2.39.5


                 reply	other threads:[~2026-02-03 16:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260203162546.2254900-1-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®