* [PATCH] tracing: turn off -Wsuggest-attribute=format for sample
@ 2026-02-03 16:25 Arnd Bergmann
0 siblings, 0 replies; only message in thread
From: Arnd Bergmann @ 2026-02-03 16:25 UTC (permalink / raw)
Cc: Arnd Bergmann, linux-kernel
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-02-03 16:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-03 16:25 [PATCH] tracing: turn off -Wsuggest-attribute=format for sample Arnd Bergmann
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®