kernel: Add CC_WERROR config to turn warnings into errors

Add configuration option CONFIG_CC_WERROR to prevent warnings
from creeping in.

Bug: 141372918
Change-Id: Ie2d067c0177d8f13e9aaa9a78867998e390f89ee
Signed-off-by: Chenglu Lin <[email protected]>
This commit is contained in:
Chenglu Lin 2019-09-23 13:15:50 +08:00 • committed by Alexander Winkowski
commit d57b564745
No known key found for this signature in database
GPG key ID: 72762A66704CDE44
2 changed files with 14 additions and 0 deletions

View file

@ -764,6 +764,10 @@ else ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
KBUILD_CFLAGS += -Os
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)
KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races)