diff options
author | Bart Van Assche <bvanassche@acm.org> | 2022-04-21 15:18:32 -0700 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2022-04-22 12:42:52 -0700 |
commit | 7a1206adf33595a50b669d4027b72ad0786fb12f (patch) | |
tree | e457033728e97b955c12940656e2ac859ce6d708 | |
parent | b964b79d495d058f645f5a63357699a6c295025e (diff) | |
download | f2fs-tools-7a1206adf33595a50b669d4027b72ad0786fb12f.tar.gz |
Annotate switch/case fallthrough
Just like in the Linux kernel source code, annotate switch/case
fallthrough.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r-- | fsck/fsck.c | 1 | ||||
-rw-r--r-- | fsck/main.c | 1 | ||||
-rw-r--r-- | include/f2fs_fs.h | 6 | ||||
-rw-r--r-- | tools/f2fscrypt.c | 1 |
4 files changed, 9 insertions, 0 deletions
diff --git a/fsck/fsck.c b/fsck/fsck.c index 798779c..19a28b0 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 8676f17..aef797e 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 1beb78b..e96394f 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 _WIN32 #undef HAVE_LINUX_TYPES_H #endif diff --git a/tools/f2fscrypt.c b/tools/f2fscrypt.c index 293173f..f2fbf0b 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); |