diff mbox series

[7/9] extrawarn: do not disable -Wmain at W=1 level

Message ID 20230811140327.3754597-8-arnd@kernel.org (mailing list archive)
State New, archived
Headers show
Series Kbuild: warning options cleanup and more warnings | expand

Commit Message

Arnd Bergmann Aug. 11, 2023, 2:03 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

There is only one function in architecture independent code that has
a local variable named main(), and it seems fine to warn about this
at the W=1 level, so move it there to declutter the normal command
line slightly.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 scripts/Makefile.extrawarn | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 8abe90270b335..8fd76da9042f8 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -29,10 +29,6 @@  KBUILD_CFLAGS-$(CONFIG_CC_NO_ARRAY_BOUNDS) += -Wno-array-bounds
 ifdef CONFIG_CC_IS_CLANG
 # The kernel builds with '-std=gnu11' so use of GNU extensions is acceptable.
 KBUILD_CFLAGS += -Wno-gnu
-else
-
-# gcc inanely warns about local variables called 'main'
-KBUILD_CFLAGS += -Wno-main
 endif
 
 # These warnings generated too much noise in a regular build.
@@ -143,6 +139,8 @@  KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast)
 KBUILD_CFLAGS += -Wno-tautological-constant-out-of-range-compare
 KBUILD_CFLAGS += $(call cc-disable-warning, unaligned-access)
 KBUILD_CFLAGS += $(call cc-disable-warning, cast-function-type-strict)
+else
+KBUILD_CFLAGS += -Wno-main
 endif
 
 endif