bcache: mark expected switch fall-throughs in STRTO_H
Subsystems (2)
PATCH 1/1 bcache: mark expected switch fall-throughs in STRTO_H
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.
Cc Kent Overstreet <[email protected]>
Cc Shaohua Li <[email protected]>
Signed-off-by Gustavo A. R. Silva <[email protected]>
--- drivers/md/bcache/util.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/md/bcache/util.c +7 -0
@@ -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' ) \
Signature · 1 line
2.7.4
Quoted 8 lines · Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.
Cc Kent Overstreet <[email protected]>Cc Shaohua Li <[email protected]>Signed-off-by Gustavo A. R. Silva <[email protected]
Reviewed-by Michael Lyle <[email protected]>
Looks good to me.
Thanks,
Mike
Quoted 8 lines · Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.
Cc Kent Overstreet <[email protected]>Cc Shaohua Li <[email protected]>Signed-off-by Gustavo A. R. Silva <[email protected]>
It seems for gcc7, and -Wimplicit-fallthrough is equal to -Wimplicit-fallthrough=3, code comments work.
Reviewed-by Coly Li <[email protected]>
Thanks.
Coly
Quoted 37 lines
--- drivers/md/bcache/util.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/md/bcache/util.c +7
-0@@ -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' ) \