To silence the `Missing break in switch (MISSING_BREAK)` warning. Coverity-id: 569459 Signed-off-by: Gao Xiang <hsiang...@linux.alibaba.com> --- include/erofs/defs.h | 6 ++++++ lib/namei.c | 1 + lib/rebuild.c | 2 +- lib/zmap.c | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/include/erofs/defs.h b/include/erofs/defs.h index 21e0f09d..0f3e7546 100644 --- a/include/erofs/defs.h +++ b/include/erofs/defs.h @@ -369,6 +369,12 @@ unsigned long __roundup_pow_of_two(unsigned long n) #define __erofs_likely(x) __builtin_expect(!!(x), 1) #define __erofs_unlikely(x) __builtin_expect(!!(x), 0) +#if __has_attribute(__fallthrough__) +# define fallthrough __attribute__((__fallthrough__)) +#else +# define fallthrough do {} while (0) /* fallthrough */ +#endif + #ifdef __cplusplus } #endif diff --git a/lib/namei.c b/lib/namei.c index 5da8ed98..d6013e5c 100644 --- a/lib/namei.c +++ b/lib/namei.c @@ -102,6 +102,7 @@ int erofs_read_inode_from_disk(struct erofs_inode *vi) switch (vi->i_mode & S_IFMT) { case S_IFDIR: vi->dot_omitted = (ifmt >> EROFS_I_DOT_OMITTED_BIT) & 1; + fallthrough; case S_IFREG: case S_IFLNK: vi->u.i_blkaddr = le32_to_cpu(copied.i_u.startblk_lo) | diff --git a/lib/rebuild.c b/lib/rebuild.c index 576d9d05..c580f81f 100644 --- a/lib/rebuild.c +++ b/lib/rebuild.c @@ -231,7 +231,7 @@ static int erofs_rebuild_update_inode(struct erofs_sb_info *dst_sb, case S_IFCHR: if (erofs_inode_is_whiteout(inode)) inode->i_parent->whiteouts = true; - /* fallthrough */ + fallthrough; case S_IFBLK: case S_IFIFO: case S_IFSOCK: diff --git a/lib/zmap.c b/lib/zmap.c index 99f40887..43e76e55 100644 --- a/lib/zmap.c +++ b/lib/zmap.c @@ -474,7 +474,7 @@ static int z_erofs_map_blocks_fo(struct erofs_inode *vi, end = (m.lcn << lclusterbits) | m.clusterofs; map->m_flags |= EROFS_MAP_FULL_MAPPED; m.delta[0] = 1; - /* fallthrough */ + fallthrough; case Z_EROFS_LCLUSTER_TYPE_NONHEAD: /* get the corresponding first chunk */ err = z_erofs_extent_lookback(&m, m.delta[0]); -- 2.43.5