[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOdnFZJK+MjSgQpg8MZoMPOM+G8kfhNaH6sTaLU=eP7nK+g@mail.gmail.com>
Date: Tue, 6 Sep 2022 22:05:21 -0700
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Masahiro Yamada <masahiroy@...nel.org>
Cc: linux-kbuild@...r.kernel.org,
Michal Marek <michal.lkml@...kovi.net>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] kbuild: move -Werror from KBUILD_CFLAGS to KBUILD_CPPFLAGS
On Mon, Sep 5, 2022 at 1:37 AM Masahiro Yamada <masahiroy@...nel.org> wrote:
>
> CONFIG_WERROR makes warnings into errors, but it only happens for *.c
> files because -Werror is added to KBUILD_CFLAGS.
>
> For example, you can put a #warning directive in any preprocessed
> source file:
>
> #warning "blah blah ..."
>
> If it is placed in a *.c file, it emits a warning by default, and it
> is promoted to an error when CONFIG_WERROR is enabled:
>
> error: #warning "blah blah ..." [-Werror=cpp]
>
> If it is placed in a *.S file, it is still a warning.
>
> Move it 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@...nel.org>
Thanks for the patch. I see in lore you sent many more cleanups but
didn't cc me explicitly...I should probably subscribe to that mailing
list! I probably won't have time to review many patches until after
Linux Plumbers Conf next week.
Reviewed-by: Nick Desaulniers <ndesaulniers@...gle.com>
> ---
>
> Makefile | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index ebcb75442d7f..027d9163eff6 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -788,7 +788,8 @@ stackp-flags-$(CONFIG_STACKPROTECTOR_STRONG) := -fstack-protector-strong
>
> KBUILD_CFLAGS += $(stackp-flags-y)
>
> -KBUILD_CFLAGS-$(CONFIG_WERROR) += -Werror
> +KBUILD_CPPFLAGS-$(CONFIG_WERROR) += -Werror
> +KBUILD_CPPFLAGS += $(KBUILD_CPPFLAGS-y)
> KBUILD_CFLAGS-$(CONFIG_CC_NO_ARRAY_BOUNDS) += -Wno-array-bounds
> KBUILD_CFLAGS += $(KBUILD_CFLAGS-y) $(CONFIG_CC_IMPLICIT_FALLTHROUGH)
>
> --
> 2.34.1
>
--
Thanks,
~Nick Desaulniers
Powered by blists - more mailing lists