diff --git a/Makefile b/Makefile index 30d8c2eedf60..8527294abbc5 100644 --- a/Makefile +++ b/Makefile @@ -582,6 +582,10 @@ else KBUILD_CFLAGS += -O2 endif +ifdef CONFIG_CC_WERROR +KBUILD_CFLAGS += -Werror +endif + include $(srctree)/arch/$(SRCARCH)/Makefile # Tell gcc to never replace conditional load with a non-conditional one diff --git a/arch/arm/configs/lineageos_wt88047_defconfig b/arch/arm/configs/lineageos_wt88047_defconfig index 37d6f6329e77..69e07962114e 100644 --- a/arch/arm/configs/lineageos_wt88047_defconfig +++ b/arch/arm/configs/lineageos_wt88047_defconfig @@ -570,6 +570,7 @@ CONFIG_SCHEDSTATS=y CONFIG_IPC_LOGGING=y # CONFIG_FTRACE is not set CONFIG_PANIC_ON_DATA_CORRUPTION=y +CONFIG_CC_WERROR=y CONFIG_KEYS=y CONFIG_SECURITY_PERF_EVENTS_RESTRICT=y CONFIG_SECURITY=y diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 191e3f255877..762fc6da14bf 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -1608,6 +1608,16 @@ config PANIC_ON_DATA_CORRUPTION recoverable data corruption scenarios to system-halting panics, for easier detection and debug. +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"