Add a config option "ERROR_ON_WARNING" that adds the "-Werror" flag to
gcc, which turns warnings into errors.
BUG=chromium-os:5542
TEST=none
Change-Id: I8d85b8ba443585025a49618c3bca6d9bb7813359
Signed-off-by: Simon Que <sque@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42075
Reviewed-by: Mandeep Singh Baines <msb@chromium.org>
NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
CHECKFLAGS += $(NOSTDINC_FLAGS)
+ifdef CONFIG_ERROR_ON_WARNING
+KBUILD_CFLAGS += -Werror
+endif
+
# warn about C99 declaration after statement
KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
config TEST_KSTRTOX
tristate "Test kstrto*() family of functions at runtime"
+
+config ERROR_ON_WARNING
+ bool "Treat compiler warnings as errors"
+ help
+ If you say Y here, the Makefile will pass the "-Werror" option to the
+ compiler. This will cause the compiler to fail on any warning, as if
+ it were an error.
+
+ If unsure, say N.