aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2023-07-20 14:22:26 +0200
committerArnd Bergmann <arnd@arndb.de>2023-08-11 11:50:01 +0200
commit5ddc13aed5c9ee03dd6bad7254a5918e6f36f1fa (patch)
tree465abacc1820a7045e018ea2abcaf56370aa6179
parente5774836e047288c29840930c8fd541ec84cfbbb (diff)
downloadplayground-warnings-2.tar.gz
[RFC] extrawarn: enable more W=1 warnings by defaultwarnings-2
A number of warning options from the W=1 set are completely clean in current kernels, so we should just enable them by default, including a lot of warnings that are part of -Wextra, so just turn on -Wextra by default. The -Woverride-init and -Wmissing-format-attribute warnings are part of -Wextra but still produce some legitimate warnings that need to be fixed, so leave them at the W=1 level but turn them off otherwise. Signed-off-by: Arnd Bergmann <arnd@arndb.de> extrawarn: enable -Wextra by default Signed-off-by: Arnd Bergmann <arnd@arndb.de>
-rw-r--r--scripts/Makefile.extrawarn19
1 files changed, 8 insertions, 11 deletions
diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 1e6822b22c2601..d0e52354c9228a 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -72,6 +72,12 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init)
# Warn if there is an enum types mismatch
KBUILD_CFLAGS += $(call cc-option,-Wenum-conversion)
+KBUILD_CFLAGS += -Wextra
+KBUILD_CFLAGS += -Wunused -Wno-unused-parameter
+KBUILD_CFLAGS += -Wold-style-definition
+KBUILD_CFLAGS += -Wmissing-include-dirs
+KBUILD_CFLAGS += $(call cc-option, -Wpacked-not-aligned)
+
# backward compatibility
KBUILD_EXTRA_WARN ?= $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)
@@ -86,16 +92,11 @@ export KBUILD_EXTRA_WARN
#
ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),)
-KBUILD_CFLAGS += -Wextra -Wunused -Wno-unused-parameter
KBUILD_CFLAGS += -Wmissing-declarations
-KBUILD_CFLAGS += $(call cc-option, -Wrestrict)
KBUILD_CFLAGS += -Wmissing-format-attribute
KBUILD_CFLAGS += -Wmissing-prototypes
-KBUILD_CFLAGS += -Wold-style-definition
-KBUILD_CFLAGS += -Wmissing-include-dirs
KBUILD_CFLAGS += $(call cc-option, -Wunused-but-set-variable)
KBUILD_CFLAGS += $(call cc-option, -Wunused-const-variable)
-KBUILD_CFLAGS += $(call cc-option, -Wpacked-not-aligned)
KBUILD_CFLAGS += $(call cc-option, -Wformat-overflow)
KBUILD_CFLAGS += $(call cc-option, -Wformat-truncation)
KBUILD_CFLAGS += $(call cc-option, -Wstringop-overflow)
@@ -110,8 +111,7 @@ else
# Suppress them by using -Wno... except for W=1.
KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
-KBUILD_CFLAGS += $(call cc-disable-warning, restrict)
-KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned)
+KBUILD_CFLAGS += $(call cc-disable-warning, missing-format-attribute)
KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow)
KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation)
KBUILD_CFLAGS += $(call cc-disable-warning, stringop-overflow)
@@ -131,12 +131,9 @@ ifeq ($(call clang-min-version, 120000),y)
KBUILD_CFLAGS += -Wformat-insufficient-args
endif
endif
-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
+KBUILD_CFLAGS += -Wno-override-init
endif
endif