Annotate switch/case fallthrough

commit 7a1206adf33595a50b669d4027b72ad0786fb12f
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

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>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
This commit is contained in:
Bart Van Assche 2022-04-21 15:18:32 -07:00 committed by dongsenhao
parent 5a3dc5cd85
commit 094b306b3b
4 changed files with 9 additions and 0 deletions

View File

@ -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;

View File

@ -370,6 +370,7 @@ void f2fs_parse_options(int argc, char *argv[])
exit(0);
case '?':
option = optopt;
fallthrough;
default:
err = EUNKNOWN_OPT;
break;

View File

@ -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

View File

@ -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);