Skip to content

Commit 53004ee

Browse files
xfs: Fix fall-through warnings for Clang
In preparation to enable -Wimplicit-fallthrough for Clang, fix the following warnings by replacing /* fall through */ comments, and its variants, with the new pseudo-keyword macro fallthrough: fs/xfs/libxfs/xfs_alloc.c:3167:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough] fs/xfs/libxfs/xfs_da_btree.c:286:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough] fs/xfs/libxfs/xfs_ag_resv.c:346:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough] fs/xfs/libxfs/xfs_ag_resv.c:388:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough] fs/xfs/xfs_bmap_util.c:246:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough] fs/xfs/xfs_export.c:88:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough] fs/xfs/xfs_export.c:96:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough] fs/xfs/xfs_file.c:867:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough] fs/xfs/xfs_ioctl.c:562:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough] fs/xfs/xfs_ioctl.c:1548:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough] fs/xfs/xfs_iomap.c:1040:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough] fs/xfs/xfs_inode.c:852:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough] fs/xfs/xfs_log.c:2627:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough] fs/xfs/xfs_trans_buf.c:298:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough] fs/xfs/scrub/bmap.c:275:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough] fs/xfs/scrub/btree.c:48:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough] fs/xfs/scrub/common.c:85:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough] fs/xfs/scrub/common.c:138:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough] fs/xfs/scrub/common.c:698:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough] fs/xfs/scrub/dabtree.c:51:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough] fs/xfs/scrub/repair.c:951:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough] fs/xfs/scrub/agheader.c:89:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough] Notice that Clang doesn't recognize /* fall through */ comments as implicit fall-through markings, so in order to globally enable -Wimplicit-fallthrough for Clang, these comments need to be replaced with fallthrough; in the whole codebase. Link: KSPP#115 Signed-off-by: Gustavo A. R. Silva <[email protected]>
1 parent 135436a commit 53004ee

17 files changed

+22
-20
lines changed

fs/xfs/libxfs/xfs_ag_resv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ xfs_ag_resv_alloc_extent(
354354
break;
355355
default:
356356
ASSERT(0);
357-
/* fall through */
357+
fallthrough;
358358
case XFS_AG_RESV_NONE:
359359
field = args->wasdel ? XFS_TRANS_SB_RES_FDBLOCKS :
360360
XFS_TRANS_SB_FDBLOCKS;
@@ -396,7 +396,7 @@ xfs_ag_resv_free_extent(
396396
break;
397397
default:
398398
ASSERT(0);
399-
/* fall through */
399+
fallthrough;
400400
case XFS_AG_RESV_NONE:
401401
xfs_trans_mod_sb(tp, XFS_TRANS_SB_FDBLOCKS, (int64_t)len);
402402
return;

fs/xfs/libxfs/xfs_alloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3174,7 +3174,7 @@ xfs_alloc_vextent(
31743174
}
31753175
args->agbno = XFS_FSB_TO_AGBNO(mp, args->fsbno);
31763176
args->type = XFS_ALLOCTYPE_NEAR_BNO;
3177-
/* FALLTHROUGH */
3177+
fallthrough;
31783178
case XFS_ALLOCTYPE_FIRST_AG:
31793179
/*
31803180
* Rotate through the allocation groups looking for a winner.

fs/xfs/libxfs/xfs_da_btree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ xfs_da3_node_read_verify(
282282
__this_address);
283283
break;
284284
}
285-
/* fall through */
285+
fallthrough;
286286
case XFS_DA_NODE_MAGIC:
287287
fa = xfs_da3_node_verify(bp);
288288
if (fa)

fs/xfs/scrub/agheader.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ xchk_superblock(
8686
case -ENOSYS:
8787
case -EFBIG:
8888
error = -EFSCORRUPTED;
89+
fallthrough;
8990
default:
9091
break;
9192
}

fs/xfs/scrub/bmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ xchk_bmap_iextent_xref(
271271
case XFS_DATA_FORK:
272272
if (xfs_is_reflink_inode(info->sc->ip))
273273
break;
274-
/* fall through */
274+
fallthrough;
275275
case XFS_ATTR_FORK:
276276
xchk_xref_is_not_shared(info->sc, agbno,
277277
irec->br_blockcount);

fs/xfs/scrub/btree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ __xchk_btree_process_error(
4444
/* Note the badness but don't abort. */
4545
sc->sm->sm_flags |= errflag;
4646
*error = 0;
47-
/* fall through */
47+
fallthrough;
4848
default:
4949
if (cur->bc_flags & XFS_BTREE_ROOT_IN_INODE)
5050
trace_xchk_ifork_btree_op_error(sc, cur, level,

fs/xfs/scrub/common.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ __xchk_process_error(
8181
/* Note the badness but don't abort. */
8282
sc->sm->sm_flags |= errflag;
8383
*error = 0;
84-
/* fall through */
84+
fallthrough;
8585
default:
8686
trace_xchk_op_error(sc, agno, bno, *error,
8787
ret_ip);
@@ -134,7 +134,7 @@ __xchk_fblock_process_error(
134134
/* Note the badness but don't abort. */
135135
sc->sm->sm_flags |= errflag;
136136
*error = 0;
137-
/* fall through */
137+
fallthrough;
138138
default:
139139
trace_xchk_file_op_error(sc, whichfork, offset, *error,
140140
ret_ip);
@@ -694,7 +694,7 @@ xchk_get_inode(
694694
if (error)
695695
return -ENOENT;
696696
error = -EFSCORRUPTED;
697-
/* fall through */
697+
fallthrough;
698698
default:
699699
trace_xchk_op_error(sc,
700700
XFS_INO_TO_AGNO(mp, sc->sm->sm_ino),

fs/xfs/scrub/dabtree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ xchk_da_process_error(
4747
/* Note the badness but don't abort. */
4848
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT;
4949
*error = 0;
50-
/* fall through */
50+
fallthrough;
5151
default:
5252
trace_xchk_file_op_error(sc, ds->dargs.whichfork,
5353
xfs_dir2_da_to_db(ds->dargs.geo,

fs/xfs/scrub/repair.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ xrep_ino_dqattach(
947947
xrep_force_quotacheck(sc, XFS_DQTYPE_GROUP);
948948
if (XFS_IS_PQUOTA_ON(sc->mp) && !sc->ip->i_pdquot)
949949
xrep_force_quotacheck(sc, XFS_DQTYPE_PROJ);
950-
/* fall through */
950+
fallthrough;
951951
case -ESRCH:
952952
error = 0;
953953
break;

fs/xfs/xfs_bmap_util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ xfs_bmap_count_blocks(
242242
*/
243243
*count += btblocks - 1;
244244

245-
/* fall through */
245+
fallthrough;
246246
case XFS_DINODE_FMT_EXTENTS:
247247
*nextents = xfs_bmap_count_leaves(ifp, count);
248248
break;

0 commit comments

Comments
 (0)