Re: [PATCH 0/2] kbuild: enable CONFIG_WERROR for more build steps

From: Thomas Weißschuh
Date: Tue Aug 12 2025 - 06:25:43 EST


Hi Miguel,

On Tue, Aug 12, 2025 at 11:21:24AM +0200, Miguel Ojeda wrote:
> On Tue, Aug 12, 2025 at 7:31 AM Thomas Weißschuh
> <thomas.weissschuh@xxxxxxxxxxxxx> wrote:
> >
> > CONFIG_WERROR is useful for all build steps, not only compilation of C and
> > Rust sources linked into the kernel.
> >
> > Also enable it for assembler and linker invocations, userprogs, as well as
> > C and Rust hostprogs.
> >
> > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
>
> The Rust part is:
>
> https://lore.kernel.org/rust-for-linux/20240519211235.589325-1-ojeda@xxxxxxxxxx/

Thanks for the pointer. We can keep the logic in Makefile.extrawarn.
But adding FLAGS-y machinery for all of the flags will be a bit noisy.
Having one ifdef CONFIG_WERROR around everything is much easier to read.

> However, Masahiro back then mentioned that we shouldn't make the C
> host flags depend on `WERROR` since `HOSTCC` builds Kconfig and, for
> consistency, not for Rust host progs either:
>
> https://lore.kernel.org/rust-for-linux/CAK7LNATPx2wTEM=KDmGtcH8vVTB4suOhh-CUQKP54F8wtPWDiw@xxxxxxxxxxxxxx/

That does make sense.

> Perhaps it could make sense to explicitly exclude certain bits, like
> Kconfig, from `WERROR`, and apply it for everything else instead.

The users will still pass -Werror explicitly, we can't filter that out.

Let's skip hostprogs for now. Another possibility would be to use -Werror
for hostprogs unconditionally. Various tools/ are doing that for example.


Thomas