mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
kernel: Add CC_WERROR config to turn warnings into errors
Add configuration option CONFIG_CC_WERROR to prevent warnings from creeping in. Signed-off-by: Chris Fries <cfries@google.com> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Change-Id: I323b5c3ddee31278da0e6d18b278a2c1327ebd04
This commit is contained in:
5
Makefile
5
Makefile
@@ -398,7 +398,6 @@ KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
|
||||
-fno-strict-aliasing -fno-common \
|
||||
-Werror-implicit-function-declaration \
|
||||
-Wno-format-security -Wno-builtin-macro-redefined \
|
||||
-Werror \
|
||||
-std=gnu89 $(call cc-option,-fno-PIE)
|
||||
|
||||
# re-define of __func__, __file__ to save rodata size
|
||||
@@ -731,6 +730,10 @@ endif
|
||||
KBUILD_CFLAGS += $(call cc-ifversion, -lt, 0409, \
|
||||
$(call cc-disable-warning,maybe-uninitialized,))
|
||||
|
||||
ifdef CONFIG_CC_WERROR
|
||||
KBUILD_CFLAGS += -Werror
|
||||
endif
|
||||
|
||||
# Tell gcc to never replace conditional load with a non-conditional one
|
||||
KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)
|
||||
|
||||
|
||||
@@ -1985,6 +1985,16 @@ config TEST_STATIC_KEYS
|
||||
|
||||
If unsure, say N.
|
||||
|
||||
config CC_WERROR
|
||||
bool "Treat all compile warnings as errors"
|
||||
default n
|
||||
help
|
||||
Select this option to set compiler warnings as errors,
|
||||
to prevent easily-fixable problems from creeping into
|
||||
the codebase.
|
||||
|
||||
If unsure, say N.
|
||||
|
||||
source "samples/Kconfig"
|
||||
|
||||
source "lib/Kconfig.kgdb"
|
||||
|
||||
Reference in New Issue
Block a user