summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--lib/Kconfig.debug10
2 files changed, 14 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 87ade657894c..654da5024e24 100644
--- a/Makefile
+++ b/Makefile
@@ -657,6 +657,10 @@ KBUILD_CFLAGS += -O2
endif
endif
+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)
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index a3a9196432d0..535b49d349c0 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -2028,6 +2028,16 @@ config BUG_ON_DATA_CORRUPTION
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"