[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20260203162546.2254900-1-arnd@kernel.org>
Date: Tue, 3 Feb 2026 17:25:41 +0100
From: Arnd Bergmann <arnd@...nel.org>
To:
Cc: Arnd Bergmann <arnd@...db.de>,
linux-kernel@...r.kernel.org
Subject: [PATCH] tracing: turn off -Wsuggest-attribute=format for sample
From: Arnd Bergmann <arnd@...db.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@...db.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
Powered by blists - more mailing lists