[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <a22ab6cb-6eb6-44df-9e82-b6e95b9ae08e@app.fastmail.com>
Date: Wed, 16 Oct 2024 18:31:27 +0000
From: "Arnd Bergmann" <arnd@...db.de>
To: "Nathan Chancellor" <nathan@...nel.org>,
"Masahiro Yamada" <masahiroy@...nel.org>
Cc: "Nicolas Schier" <nicolas@...sle.eu>,
"Nick Desaulniers" <ndesaulniers@...gle.com>,
"Bill Wendling" <morbo@...gle.com>, "Justin Stitt" <justinstitt@...gle.com>,
"Aleksei Vetrov" <vvvvvv@...gle.com>, linux-kbuild@...r.kernel.org,
linux-kernel@...r.kernel.org, llvm@...ts.linux.dev, patches@...ts.linux.dev,
stable@...r.kernel.org
Subject: Re: [PATCH] kbuild: Fully disable -Wenum-{compare-conditional,enum-conversion}
On Wed, Oct 16, 2024, at 18:01, Nathan Chancellor wrote:
> -Wenum-enum-conversion and -Wenum-compare-conditional were strengthened
> in clang-19 to warn in C mode, which caused the kernel to move them to
> W=1 in commit 75b5ab134bb5 ("kbuild: Move
> -Wenum-{compare-conditional,enum-conversion} into W=1") because there
> were numerous instances of each that would break builds with -Werror.
> Unfortunately, this is not a full solution, as more and more developers,
> subsystems, and distributors are building with W=1 as well, so they
> continue to see the numerous instances of these warnings.
>
> Since the move to W=1, there have not been many new instances that have
> appeared through various build reports and the ones that have appeared
> seem to be following similar existing patterns, suggesting that most
> instances of these warnings will not be real issues. The only
> alternatives for silencing these warnings are adding casts (which is
> generally seen as an ugly practice) or refactoring the enums to macro
> defines or a unified enum (which may be undesirable because of type
> safety in other parts of the code).
>
> Disable the warnings altogether so that W=1 users do not see them.
I don't think we have to go all the way of completely disabling
the warnings here, they are still potentially useful. I can see
three ways of being less aggressive with them:
- keep -Wno-enum-compare-conditional in W=1 and fix up the
remaining warnings for that, iirc the Wno-enum-enum-conversion
is the one that causes the problems.
- Move them to W=2 instead of always disabled
- Leave the warnings enabled for clang-18 and older.
Arnd
Powered by blists - more mailing lists