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

From: Nathan Chancellor
Date: Tue Aug 12 2025 - 16:56:20 EST


On Tue, Aug 12, 2025 at 12:50:44PM +0200, Miguel Ojeda wrote:
> On Tue, Aug 12, 2025 at 12:25 PM Thomas Weißschuh
> > Another possibility would be to use -Werror
> > for hostprogs unconditionally. Various tools/ are doing that for example.
>
> Not sure what Kbuild thinks about that -- we have a small risk of
> breaking things with newer compilers, but that may be not too bad for
> just hostprogs (unlike when it was attempted to make it default `y`).
...
> appear -- so that should be fine, but it does make it way more urgent
> if they are errors every time, though, since it blocks other testing
> too).

Yeah I am conflicted. On the one hand, KBUILD_HOSTCFLAGS only has -Wall
and a couple of extra warnings so the risk of new warnings breaking the
build is pretty low. You can see the rate at which warnings get added or
removed from -Wall in clang in the warning-wall.c test:

https://github.com/llvm/llvm-project/commits/main/clang/test/Misc/warning-wall.c

I'm obviously on top of testing upstream LLVM against hostprogs because
LLVM= makes it easy to set HOSTCC. I suspect that GCC trunk sees less
testing against the hostprogs unless the user has it in their PATH
somehow.

On the other hand, the recent changes to -Wuninitialized and the
addition of -Wuninitialized-const-pointer were extremely disruptive only
because of -Werror... I would have no problems with fast tracking fixes
for hostprogs -Werror usage but I am not sure all maintainers will. This
would also impact vendored host programs like dtc, which may be harder
to update.

We could try it for a development cycle in -next to see if anything gets
noticed. Always easy to back out retrospectively as well. Alternatively,
we could just recommend people use HOSTCFLAGS=-Werror if they desire it.

Cheers,
Nathan