Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Borislav Petkov <bp@alien8.de>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
	patches@lists.linux.dev, kernel test robot <lkp@intel.com>,
	Kees Cook <keescook@chromium.org>
Subject: Re: [PATCH] x86/boot: Address clang -Wimplicit-fallthrough in vsprintf()
Date: Fri, 17 May 2024 08:18:33 -0700	[thread overview]
Message-ID: <20240517151833.GB3660288@thelio-3990X> (raw)
In-Reply-To: <20240517095110.GAZkcojmJQoY_zU-OT@fat_crate.local>

On Fri, May 17, 2024 at 11:51:10AM +0200, Borislav Petkov wrote:
> On Thu, May 16, 2024 at 07:03:41AM -0700, Nathan Chancellor wrote:
> > After enabling -Wimplicit-fallthrough for the x86 boot code, clang
> > warns:
> > 
> >   arch/x86/boot/printf.c:257:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
> >     257 |                 case 'u':
> >         |                 ^
> > 
> > Clang is a little more pedantic than GCC, which does not warn when
> > falling through to a case that is just break or return.
> 
> Is anyone fixing Clang?
> 
> :-P

There was a patch to make Clang match GCC's behavior a few years ago but
I think Kees made a good argument that GCC's behavior leaves potential
bugs on the table, so that was not pursued further.

https://reviews.llvm.org/D91895#2417170

It was brought up to GCC as well but they did not want to change their
behavior:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91432

Cheers,
Nathan

  reply	other threads:[~2024-05-17 15:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-16 14:03 [PATCH] x86/boot: Address clang -Wimplicit-fallthrough in vsprintf() Nathan Chancellor
2024-05-16 23:08 ` Justin Stitt
2024-05-17  9:51 ` Borislav Petkov
2024-05-17 15:18   ` Nathan Chancellor [this message]
2024-05-23 11:57     ` Borislav Petkov
2024-05-23 23:12       ` Kees Cook
2024-05-24 16:39         ` Borislav Petkov

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=20240517151833.GB3660288@thelio-3990X \
    --to=nathan@kernel.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=justinstitt@google.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=mingo@redhat.com \
    --cc=morbo@google.com \
    --cc=patches@lists.linux.dev \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).