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:
Chris Fries
2017-03-08 08:08:38 -06:00
committed by Chris
parent 088db916ce
commit 9a53390dab
2 changed files with 14 additions and 1 deletions

View File

@@ -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)

View File

@@ -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"