* [PATCH] bcache: mark expected switch fall-throughs in STRTO_H
@ 2017-10-09 21:54 Gustavo A. R. Silva
2017-10-09 22:52 ` Michael Lyle
2017-10-10 6:31 ` Coly Li
0 siblings, 2 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2017-10-09 21:54 UTC (permalink / raw)
To: Kent Overstreet, Shaohua Li
Cc: linux-bcache, linux-raid, linux-kernel, Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.
Cc: Kent Overstreet <kent.overstreet@gmail.com>
Cc: Shaohua Li <shli@kernel.org>
Cc: linux-bcache@vger.kernel.org
Cc: linux-raid@vger.kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
drivers/md/bcache/util.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/md/bcache/util.c b/drivers/md/bcache/util.c
index 176d3c2..da9194b 100644
--- a/drivers/md/bcache/util.c
+++ b/drivers/md/bcache/util.c
@@ -32,20 +32,27 @@ int bch_ ## name ## _h(const char *cp, type *res) \
case 'y': \
case 'z': \
u++; \
+ /* fall through */ \
case 'e': \
u++; \
+ /* fall through */ \
case 'p': \
u++; \
+ /* fall through */ \
case 't': \
u++; \
+ /* fall through */ \
case 'g': \
u++; \
+ /* fall through */ \
case 'm': \
u++; \
+ /* fall through */ \
case 'k': \
u++; \
if (e++ == cp) \
return -EINVAL; \
+ /* fall through */ \
case '\n': \
case '\0': \
if (*e == '\n') \
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] bcache: mark expected switch fall-throughs in STRTO_H
2017-10-09 21:54 [PATCH] bcache: mark expected switch fall-throughs in STRTO_H Gustavo A. R. Silva
@ 2017-10-09 22:52 ` Michael Lyle
2017-10-10 6:31 ` Coly Li
1 sibling, 0 replies; 3+ messages in thread
From: Michael Lyle @ 2017-10-09 22:52 UTC (permalink / raw)
To: Gustavo A. R. Silva, Kent Overstreet, Shaohua Li
Cc: linux-bcache, linux-raid, linux-kernel
On 10/09/2017 02:54 PM, Gustavo A. R. Silva wrote:
> In preparation to enabling -Wimplicit-fallthrough, mark switch cases
> where we are expecting to fall through.
>
> Cc: Kent Overstreet <kent.overstreet@gmail.com>
> Cc: Shaohua Li <shli@kernel.org>
> Cc: linux-bcache@vger.kernel.org
> Cc: linux-raid@vger.kernel.org
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com
Reviewed-by: Michael Lyle <mlyle@lyle.org>
Looks good to me.
Thanks,
Mike
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] bcache: mark expected switch fall-throughs in STRTO_H
2017-10-09 21:54 [PATCH] bcache: mark expected switch fall-throughs in STRTO_H Gustavo A. R. Silva
2017-10-09 22:52 ` Michael Lyle
@ 2017-10-10 6:31 ` Coly Li
1 sibling, 0 replies; 3+ messages in thread
From: Coly Li @ 2017-10-10 6:31 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Kent Overstreet, Shaohua Li, linux-bcache, linux-raid,
linux-kernel
On 2017/10/10 上午5:54, Gustavo A. R. Silva wrote:
> In preparation to enabling -Wimplicit-fallthrough, mark switch cases
> where we are expecting to fall through.
>
> Cc: Kent Overstreet <kent.overstreet@gmail.com>
> Cc: Shaohua Li <shli@kernel.org>
> Cc: linux-bcache@vger.kernel.org
> Cc: linux-raid@vger.kernel.org
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
It seems for gcc7, and -Wimplicit-fallthrough is equal to
-Wimplicit-fallthrough=3, code comments work.
Reviewed-by: Coly Li <colyli@suse.de>
Thanks.
Coly
> ---
> drivers/md/bcache/util.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/md/bcache/util.c b/drivers/md/bcache/util.c
> index 176d3c2..da9194b 100644
> --- a/drivers/md/bcache/util.c
> +++ b/drivers/md/bcache/util.c
> @@ -32,20 +32,27 @@ int bch_ ## name ## _h(const char *cp, type *res) \
> case 'y': \
> case 'z': \
> u++; \
> + /* fall through */ \
> case 'e': \
> u++; \
> + /* fall through */ \
> case 'p': \
> u++; \
> + /* fall through */ \
> case 't': \
> u++; \
> + /* fall through */ \
> case 'g': \
> u++; \
> + /* fall through */ \
> case 'm': \
> u++; \
> + /* fall through */ \
> case 'k': \
> u++; \
> if (e++ == cp) \
> return -EINVAL; \
> + /* fall through */ \
> case '\n': \
> case '\0': \
> if (*e == '\n') \
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-10 6:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-09 21:54 [PATCH] bcache: mark expected switch fall-throughs in STRTO_H Gustavo A. R. Silva
2017-10-09 22:52 ` Michael Lyle
2017-10-10 6:31 ` Coly Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).