Just like in the Linux kernel source code, annotate switch/case fallthrough.
Signed-off-by: Bart Van Assche <[email protected]> --- fsck/fsck.c | 1 + fsck/main.c | 1 + include/f2fs_fs.h | 6 ++++++ tools/f2fscrypt.c | 1 + 4 files changed, 9 insertions(+) diff --git a/fsck/fsck.c b/fsck/fsck.c index 798779cfaf8a..19a28b0eedad 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -1669,6 +1669,7 @@ static int __chk_dentries(struct f2fs_sb_info *sbi, int casefolded, switch (ret) { case 1: fixed = 1; + fallthrough; case 0: child->dots++; break; diff --git a/fsck/main.c b/fsck/main.c index 8676f17555c5..aef797e98405 100644 --- a/fsck/main.c +++ b/fsck/main.c @@ -370,6 +370,7 @@ void f2fs_parse_options(int argc, char *argv[]) exit(0); case '?': option = optopt; + fallthrough; default: err = EUNKNOWN_OPT; break; diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h index dd62bc89a926..73dc48e25ec0 100644 --- a/include/f2fs_fs.h +++ b/include/f2fs_fs.h @@ -73,6 +73,12 @@ #define static_assert _Static_assert #endif +#ifdef __clang__ +#define fallthrough do {} while (0) /* fall through */ +#else +#define fallthrough __attribute__((__fallthrough__)) +#endif + #ifdef ANDROID_WINDOWS_HOST #undef HAVE_LINUX_TYPES_H #endif diff --git a/tools/f2fscrypt.c b/tools/f2fscrypt.c index 293173fcb5b4..f2fbf0bf3878 100644 --- a/tools/f2fscrypt.c +++ b/tools/f2fscrypt.c @@ -726,6 +726,7 @@ static void do_add_key(int argc, char **argv, const struct cmd_desc *cmd) break; default: fprintf(stderr, "Unrecognized option: %c\n", opt); + fallthrough; case '?': fputs("USAGE:\n ", stderr); fputs(cmd->cmd_help, stderr); _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
