[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251218220651.5cdde06f@pumpkin>
Date: Thu, 18 Dec 2025 22:06:51 +0000
From: David Laight <david.laight.linux@...il.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Vincent Mailhol <mailhol@...nel.org>, Nathan Chancellor
<nathan@...nel.org>, Nicolas Schier <nsc@...nel.org>, Nick Desaulniers
<nick.desaulniers+lkml@...il.com>, Bill Wendling <morbo@...gle.com>, Justin
Stitt <justinstitt@...gle.com>, Maarten Lankhorst
<maarten.lankhorst@...ux.intel.com>, Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>,
Simona Vetter <simona@...ll.ch>, Chris Mason <clm@...com>, David Sterba
<dsterba@...e.com>, linux-kbuild@...r.kernel.org,
linux-sparse@...r.kernel.org, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev, dri-devel@...ts.freedesktop.org,
linux-btrfs@...r.kernel.org
Subject: Re: [PATCH 0/2] kbuild: remove gcc's -Wtype-limits
On Fri, 19 Dec 2025 08:34:05 +1200
Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> On Fri, 19 Dec 2025 at 08:26, David Laight <david.laight.linux@...il.com> wrote:
> >
> > One possibility is to conditionally add _Pragma()
>
> No. That compiler warning is pure and utter garbage. I have pointed it
> out fopr *years*, and compiler people don't get it.
>
> So that warning just needs to die. It's shit. It's wrong.
True - especially for code like:
if (x < 0 || x > limit)
return ...
where the code is correct even with 'accidental' conversion of a
negative signed value to a large unsigned one.
clang seems to have a dozen similar warnings, all of which are a PITA
for kernel code - like rejecting !(4 << 16).
_Pragma() might be usable for -Wshadow, which is generally useful for
local variables (but not global functions like log() and j0()).
(I usually enable it and fix up the consequences.)
Things like the masked userspace access define which carefully
creates a readonly variable that shadows a user local would need
to disable that one.
David
Powered by blists - more mailing lists