fallthrough fixes for Clang for 5.17-rc1
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(+)
Quoted 3 lines · Gustavo A. R. Silva
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:
Quoted 2 lines
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
arch/mips/mm/tlbex.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
arch/mips/mm/tlbex.c +6 -7
@@ -2161,15 +2161,14 @@ static void build_r4000_tlb_load_handler(void)switch (current_cpu_type ()) {default : -if (cpu_has_mips_r2_exec_hazard) { +if (cpu_has_mips_r2_exec_hazard)uasm_i_ehb (&p); - fallthrough; +break ;case CPU_CAVIUM_OCTEON :case CPU_CAVIUM_OCTEON_PLUS :case CPU_CAVIUM_OCTEON2 : -break ; - } +break ; }/* Examine entrylo 0 or 1 based on ptr. */
@@ -2237,14 +2236,14 @@ static void build_r4000_tlb_load_handler(void)switch (current_cpu_type ()) {default : -if (cpu_has_mips_r2_exec_hazard) { +if (cpu_has_mips_r2_exec_hazard)uasm_i_ehb (&p); +break ;case CPU_CAVIUM_OCTEON :case CPU_CAVIUM_OCTEON_PLUS :case CPU_CAVIUM_OCTEON2 : -break ; - } +break ; }/* Examine entrylo 0 or 1 based on ptr. */