Skip to content

Commit b73aa53

Browse files
Baoquan Heakpm00
Baoquan He
authored andcommitted
panic: suppress gnu_printf warning
with GCC 13.2.1 and W=1, there's compiling warning like this: kernel/panic.c: In function `__warn': kernel/panic.c:676:17: warning: function `__warn' might be a candidate for `gnu_printf' format attribute [-Wsuggest-attribute=format] 676 | vprintk(args->fmt, args->args); | ^~~~~~~ The normal __printf(x,y) adding can't fix it. So add workaround which disables -Wsuggest-attribute=format to mute it. Link: https://lkml.kernel.org/r/20240107091641.579849-1-bhe@redhat.com Signed-off-by: Baoquan He <bhe@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 3911fb6 commit b73aa53

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

kernel/panic.c

+5
Original file line numberDiff line numberDiff line change
@@ -666,8 +666,13 @@ void __warn(const char *file, int line, void *caller, unsigned taint,
666666
pr_warn("WARNING: CPU: %d PID: %d at %pS\n",
667667
raw_smp_processor_id(), current->pid, caller);
668668

669+
#pragma GCC diagnostic push
670+
#ifndef __clang__
671+
#pragma GCC diagnostic ignored "-Wsuggest-attribute=format"
672+
#endif
669673
if (args)
670674
vprintk(args->fmt, args->args);
675+
#pragma GCC diagnostic pop
671676

672677
print_modules();
673678

0 commit comments

Comments
 (0)