From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Linus Torvalds <torvalds@linux-foundation.org>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: Kees Cook <keescook@chromium.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [GIT PULL] fallthrough fixes for Clang for 5.14-rc1
Date: Mon, 28 Jun 2021 22:46:28 -0500 [thread overview]
Message-ID: <4a2ef94c-c5cb-c6d4-d36a-e6f5c23c076b@embeddedor.com> (raw)
In-Reply-To: <CAHk-=wik-iqVYJyDxfPsOk_8vt1BrsKF-H-nunAYHw3HHuvZqA@mail.gmail.com>
On 6/28/21 22:12, Linus Torvalds wrote:
> 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.
I see, you're right.
I still have another PR with more of these fixes (the last ones before finally
being able to enable -Wimplicit-fallthrough for Clang :) ) pending to be sent
later this week. I'll double check and fix any similar issues before sending it.
Thanks for the feedback.
--
Gustavo
next prev parent reply other threads:[~2021-06-29 3:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-28 20:59 [GIT PULL] fallthrough fixes for Clang for 5.14-rc1 Gustavo A. R. Silva
2021-06-29 3:12 ` Linus Torvalds
2021-06-29 3:46 ` Gustavo A. R. Silva [this message]
2021-06-29 3:50 ` pr-tracker-bot
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=4a2ef94c-c5cb-c6d4-d36a-e6f5c23c076b@embeddedor.com \
--to=gustavo@embeddedor.com \
--cc=gustavoars@kernel.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.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