Message ID | 20221206040731.442499-2-masahiroy@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/2] kbuild: move -Werror from KBUILD_CFLAGS to KBUILD_CPPFLAGS | expand |
On Tue, Dec 06, 2022 at 01:07:31PM +0900, Masahiro Yamada wrote: > 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 warnings, and 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 we fix all of them, we can > make this 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> Looks like the robot already found a few so this clearly works as intended. > --- > > scripts/Makefile.extrawarn | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn > index 6bbba36c5969..40cd13eca82e 100644 > --- a/scripts/Makefile.extrawarn > +++ b/scripts/Makefile.extrawarn > @@ -38,6 +38,7 @@ KBUILD_CFLAGS += -Wno-sign-compare > KBUILD_CFLAGS += -Wno-type-limits > KBUILD_CFLAGS += -Wno-shift-negative-value > > +KBUILD_CPPFLAGS += -Wundef > KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN1 > > else > -- > 2.34.1 > >
On Mon, Dec 5, 2022 at 8:07 PM Masahiro Yamada <masahiroy@kernel.org> wrote: > > 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 warnings, and 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 we fix all of them, we can > make this default in the top Makefile, and remove -Wundef from > KBUILD_CFLAGS. I like that approach. Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> > > [1]: https://lore.kernel.org/all/20221012180118.331005-2-masahiroy@kernel.org/ > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> > --- > > scripts/Makefile.extrawarn | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn > index 6bbba36c5969..40cd13eca82e 100644 > --- a/scripts/Makefile.extrawarn > +++ b/scripts/Makefile.extrawarn > @@ -38,6 +38,7 @@ KBUILD_CFLAGS += -Wno-sign-compare > KBUILD_CFLAGS += -Wno-type-limits > KBUILD_CFLAGS += -Wno-shift-negative-value > > +KBUILD_CPPFLAGS += -Wundef > KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN1 > > else > -- > 2.34.1 >
diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index 6bbba36c5969..40cd13eca82e 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -38,6 +38,7 @@ KBUILD_CFLAGS += -Wno-sign-compare KBUILD_CFLAGS += -Wno-type-limits KBUILD_CFLAGS += -Wno-shift-negative-value +KBUILD_CPPFLAGS += -Wundef KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN1 else
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 warnings, and 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 we fix all of them, we can make this 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> --- scripts/Makefile.extrawarn | 1 + 1 file changed, 1 insertion(+)