Skip to content

Commit f5982cc

Browse files
arndbakpm00
authored andcommitted
kbuild: turn on -Wextra by default
Patch series "kbuild: enable more warnings by default", v3. All the warning fixes I sent for these warnings have been merged into mainline or linux-next, so let's turn them on by default. This patch (of 6): The -Wextra option controls a number of different warnings that differ slightly by compiler version. Some are useful in general, others are better left at W=1 or higher. Based on earlier work, the ones that should be disabled by default are left for the higher warning levels already, and a lot of the useful ones have no remaining output when enabled. Move the -Wextra option up into the set of default-enabled warnings and just rely on the individual ones getting disabled as needed. The -Wunused warning was always grouped with this, so turn it on by default as well, except for the -Wunused-parameter warning that really has no value at all for the kernel since many interfaces have intentionally unused arguments. Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Arnd Bergmann <[email protected]> Acked-by: Nathan Chancellor <[email protected]> Cc: Kees Cook <[email protected]> Cc: Masahiro Yamada <[email protected]> Cc: Nicolas Schier <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent eb6a933 commit f5982cc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

scripts/Makefile.extrawarn

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,14 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init)
8282
# Warn if there is an enum types mismatch
8383
KBUILD_CFLAGS += $(call cc-option,-Wenum-conversion)
8484

85+
KBUILD_CFLAGS += -Wextra
86+
KBUILD_CFLAGS += -Wunused
87+
8588
#
8689
# W=1 - warnings which may be relevant and do not occur too often
8790
#
8891
ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),)
8992

90-
KBUILD_CFLAGS += -Wextra -Wunused -Wno-unused-parameter
9193
KBUILD_CFLAGS += $(call cc-option, -Wrestrict)
9294
KBUILD_CFLAGS += -Wmissing-format-attribute
9395
KBUILD_CFLAGS += -Wold-style-definition
@@ -190,6 +192,7 @@ else
190192

191193
# The following turn off the warnings enabled by -Wextra
192194
KBUILD_CFLAGS += -Wno-sign-compare
195+
KBUILD_CFLAGS += -Wno-unused-parameter
193196

194197
endif
195198

0 commit comments

Comments
 (0)