Re: [PATCH 0/2] kbuild: remove gcc's -Wtype-limits

David Laight <[email protected]> Thu, 18 Dec 2025 20:26:44 +0000
Newsgroups org.kernel.vger.linux-sparse,dev.linux.lists.llvm,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-btrfs,org.kernel.vger.linux-kbuild,org.kernel.vger.linux-kernel
Message-ID <20251218202644.0bd24aa8@pumpkin>
On Thu, 18 Dec 2025 19:50:00 +0100
Vincent Mailhol <[email protected]> wrote:

> I often read on the mailing list people saying "who cares about W=2
> builds anyway?". At least I do. Not that I want to fix all of them,
> but on some occasions, such as new driver submissions, I have often
> found a couple valid diagnostics in the W=2 output.
> 
> That said, the annoying thing is that W=2 is heavily polluted by one
> warning: -Wtype-limits. Try a gcc W=2 build on any file and see the
> results for yourself. I suspect this to be the reason why so few
> people are using W=2.

One possibility is to conditionally add _Pragma() inside #defines to
turn off the warning for the main false positives (I guess all the
BUILD_BUG_xxxx and statically_true are the main ones).
But don't 'bloat' the #define expansions for normal builds.

	David