Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kbuild: move -Werror from KBUILD_CFLAGS to KBUILD_CPPFLAGS

CONFIG_WERROR turns warnings into errors, which happens only for *.c
files because -Werror is added to KBUILD_CFLAGS.

Adding it to KBUILD_CPPFLAGS makes more sense because preprocessors
understand the -Werror option.

For example, you can put a #warning directive in any preprocessed code.

warning: #warning "this is a warning message" [-Wcpp]

If -Werror is added, it is promoted to an error.

error: #warning "this is a warning message" [-Werror=cpp]

This commit moves -Werror to KBUILD_CPPFLAGS so it works in the same way
for *.c, *.S, *.lds.S or whatever needs preprocessing.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>

+2 -1
+2 -1
Makefile
··· 866 866 867 867 KBUILD_CFLAGS += $(stackp-flags-y) 868 868 869 - KBUILD_CFLAGS-$(CONFIG_WERROR) += -Werror 869 + KBUILD_CPPFLAGS-$(CONFIG_WERROR) += -Werror 870 + KBUILD_CPPFLAGS += $(KBUILD_CPPFLAGS-y) 870 871 KBUILD_CFLAGS-$(CONFIG_CC_NO_ARRAY_BOUNDS) += -Wno-array-bounds 871 872 872 873 KBUILD_RUSTFLAGS-$(CONFIG_WERROR) += -Dwarnings