Skip to content

Commit 80b6093

Browse files
committed
kbuild: add -Wundef to KBUILD_CPPFLAGS for W=1 builds
The use of an undefined macro in an #if directive is warned, but only in *.c files. No warning from other files such as *.S, *.lds.S. Since -Wundef is a preprocessor-related warning, it should be added to KBUILD_CPPFLAGS instead of KBUILD_CFLAGS. My previous attempt [1] uncovered several issues. I could not finish fixing them all. This commit adds -Wundef to KBUILD_CPPFLAGS for W=1 builds in order to block new breakages. (The kbuild test robot tests with W=1) We can fix the warnings one by one. After fixing all of them, we can make it default in the top Makefile, and remove -Wundef from KBUILD_CFLAGS. [1]: https://lore.kernel.org/all/20221012180118.331005-2-masahiroy@kernel.org/ Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
1 parent efa80b0 commit 80b6093

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

scripts/Makefile.extrawarn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ KBUILD_CFLAGS += -Wno-sign-compare
3838
KBUILD_CFLAGS += -Wno-type-limits
3939
KBUILD_CFLAGS += -Wno-shift-negative-value
4040

41+
KBUILD_CPPFLAGS += -Wundef
4142
KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN1
4243

4344
else

0 commit comments

Comments
 (0)