[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ce28bb9bc25cb3f1197f75950a0cfe14947f9002.camel@perches.com>
Date: Wed, 16 Sep 2020 13:19:26 -0700
From: Joe Perches <joe@...ches.com>
To: Nick Desaulniers <ndesaulniers@...gle.com>,
Trond Myklebust <trond.myklebust@...merspace.com>,
Anna Schumaker <anna.schumaker@...app.com>
Cc: "Gustavo A . R . Silva" <gustavo@...eddedor.com>,
Nathan Chancellor <natechancellor@...il.com>,
Hongxiang Lou <louhongxiang@...wei.com>,
Miaohe Lin <linmiaohe@...wei.com>, linux-nfs@...r.kernel.org,
linux-kernel@...r.kernel.org, clang-built-linux@...glegroups.com
Subject: Re: [PATCH v2] nfs: remove incorrect fallthrough label
On Wed, 2020-09-16 at 13:02 -0700, Nick Desaulniers wrote:
> There is no case after the default from which to fallthrough to. Clang
> will error in this case (unhelpfully without context, see link below)
> and GCC will with -Wswitch-unreachable.
>
> The previous commit should have just replaced the comment with a break
> statement.
> If we consider implicit fallthrough to be a design mistake of C, then
> all case statements should be terminated with one of the following
> statements:
>
> * break
> * continue
> * return
> * __attribute__(__fallthrough__)
Just fallthrough. __attribute__((__fallthrough__)
is only used once in code for the #define.
And maybe add see: Documentation/process/deprecated.rst
> * goto (plz no)
goto is a valid style inside a switch/case label block.
There are more than 1500 of these goto <label> uses in the
kernel so the 'please no' here doesn't seem reasonable.
> * (call of function with __attribute__(__noreturn__))
I guess panic counts. I count 11 of those.
Are there any other uses of functions with __noreturn
in switch/case label blocks?
Powered by blists - more mailing lists