lkml.org 
[lkml]   [2021]   [Jun]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [GIT PULL] fallthrough fixes for Clang for 5.14-rc1
On Mon, Jun 28, 2021 at 1:58 PM Gustavo A. R. Silva
<gustavoars@kernel.org> wrote:
>
> Please, pull the following patches that fix many fall-through warnings
> when building with Clang 12.0.0 and this[1] change reverted. Notice
> that in order to enable -Wimplicit-fallthrough for Clang, such change[1]
> is meant to be reverted at some point. So, these patches help to move
> in that direction.

I've pulled this, but I really don't like how random it is.

Just as an example - and there are many others - look at the patch to
net/netrom/nr_route.c.

It does

case 0:
nr_node->routes[0] = nr_node->routes[1];
fallthrough;
case 1:
nr_node->routes[1] = nr_node->routes[2];
+ fallthrough;
case 2:
break;

and then about a hundred lines later it does
case 0:
s->routes[0] = s->routes[1];
fallthrough;
case 1:
s->routes[1] = s->routes[2];
+ break;
case 2:
break;

Notice? One does a 'fallthrough' to the next case that does the
'break', and the other - very much equivalent case - does a 'break'.

So the whole "add 'fallthrough' or 'break'" decision doesn't seem to
have any pattern or rule at all.

Linus

\
 
 \ /
  Last update: 2021-06-29 05:13    [W:0.057 / U:0.440 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site