mbox series

[GIT,PULL] fallthrough fixes for Clang for 5.17-rc1

Message ID 20220111191456.GA11976@embeddedor (mailing list archive)
State Handled Elsewhere
Headers show
Series [GIT,PULL] fallthrough fixes for Clang for 5.17-rc1 | expand

Pull-request

git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git tags/fallthrough-fixes-clang-5.17-rc1

Message

Gustavo A. R. Silva Jan. 11, 2022, 7:14 p.m. UTC
The following changes since commit 136057256686de39cc3a07c2e39ef6bc43003ff6:

  Linux 5.16-rc2 (2021-11-21 13:47:39 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git tags/fallthrough-fixes-clang-5.17-rc1

for you to fetch changes up to ceec16f8fd660c7827e72aec74021f1acc1f7240:

  fbdev: sh7760fb: document fallthrough cases (2021-11-22 18:43:20 -0600)

----------------------------------------------------------------
fallthrough fixes for Clang for 5.17-rc1

Hi Linus,

Please, pull the following patches that fix some fall-through warnings
when building with Clang and -Wimplicit-fallthrough.

Thanks!
--
Gustavo

----------------------------------------------------------------
Gustavo A. R. Silva (1):
      MIPS: mm: tlbex: Fix fall-through warning for Clang

Randy Dunlap (1):
      fbdev: sh7760fb: document fallthrough cases

 arch/mips/mm/tlbex.c           | 1 +
 drivers/video/fbdev/sh7760fb.c | 2 ++
 2 files changed, 3 insertions(+)

Comments

Linus Torvalds Jan. 12, 2022, 1:02 a.m. UTC | #1
On Tue, Jan 11, 2022 at 11:08 AM Gustavo A. R. Silva
<gustavoars@kernel.org> wrote:
>
> Please, pull the following patches that fix some fall-through warnings
> when building with Clang and -Wimplicit-fallthrough.

Ugh. I started pulling that, and then I actually looked at this one:

> Gustavo A. R. Silva (1):
>       MIPS: mm: tlbex: Fix fall-through warning for Clang

and that's just too ugly to live.

It was ugly before, but now it's just insane.

It literally has an if-statement with a block statement that contains
other cases.

Fine, that's not illegal, and Duff's device made the model famous.

But in this case, there's no actual _reason_ for it. It literally
looks like a mistake to me.

There's no reason to have that block statement in the first place, and
there's *doubly* no reason to add a "fallthrough" to other case
statements that then just do a "break" anyway.

I notice that we actually had that exact same pattern earlier, see
line 2166 in that same line. And it's equally bogus there. Actually,
it's even more bogus there, because the indentation is wrong too!

So I _think_ that patch should do something like the attached, but I
didn't actually test this in any way (I didn't check my mips
cross-build setup), and this is all so ugly that I have to avert my
eyes to even attach that patch to this email.

I also don't understand why it's doing that 'switch ()' on the
current_cpu_type(), only to avoid the 'cpu_has_mips_r2_exec_hazard'
test, Which is just _another_ switch on current_cpu_type().

All this code is completely incomprehensibly oddly written. It looks
like some kind of cut-and-paste thing with no actual understanding of
the code. And I refuse to make it worse than it already is by adding
even *more* mindless blather to it.

               Linus