Linux kbuild/kconfig development
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Masahiro Yamada <masahiroy@kernel.org>,
	Nicolas Schier <nicolas@fjasle.eu>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>,
	Aleksei Vetrov <vvvvvv@google.com>,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	llvm@lists.linux.dev, patches@lists.linux.dev,
	stable@vger.kernel.org
Subject: Re: [PATCH] kbuild: Fully disable -Wenum-{compare-conditional,enum-conversion}
Date: Wed, 16 Oct 2024 14:24:27 -0700	[thread overview]
Message-ID: <20241016212427.GA695927@thelio-3990X> (raw)
In-Reply-To: <a22ab6cb-6eb6-44df-9e82-b6e95b9ae08e@app.fastmail.com>

On Wed, Oct 16, 2024 at 06:31:27PM +0000, Arnd Bergmann wrote:
> 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 and I talked about this offline in the ClangBuiltLinux meeting
today. I am going to run my usual test matrix against a tree with
-Wenum-compare-conditional turned on to see how many instances of these
warnings are in the tree and how difficult it would be to silence them
to address the first point above. I will move -Wenum-enum-conversion to
W=2 and send that as v2 soon to satisfy point two, which should clear up
the blockage for the Android folks.

While disabling the warnings for clang-19 and newer and leaving them on
for clang-18 and older would technically address the issue at hand, it
won't result in increased coverage because the whole point of the change
that caused this in clang-19 is enabling the warning for C code, so
clang-18 and older won't ever emit these warnings.

Cheers,
Nathan

      reply	other threads:[~2024-10-16 21:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-16 18:01 [PATCH] kbuild: Fully disable -Wenum-{compare-conditional,enum-conversion} Nathan Chancellor
2024-10-16 18:31 ` Arnd Bergmann
2024-10-16 21:24   ` Nathan Chancellor [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241016212427.GA695927@thelio-3990X \
    --to=nathan@kernel.org \
    --cc=arnd@arndb.de \
    --cc=justinstitt@google.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=masahiroy@kernel.org \
    --cc=morbo@google.com \
    --cc=ndesaulniers@google.com \
    --cc=nicolas@fjasle.eu \
    --cc=patches@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=vvvvvv@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox