]> Git Repo - linux.git/commitdiff
xfs: Fix fall-through warnings for Clang
authorGustavo A. R. Silva <[email protected]>
Tue, 20 Apr 2021 22:54:36 +0000 (17:54 -0500)
committerGustavo A. R. Silva <[email protected]>
Wed, 26 May 2021 19:51:26 +0000 (14:51 -0500)
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: https://github.com/KSPP/linux/issues/115
Signed-off-by: Gustavo A. R. Silva <[email protected]>
17 files changed:
fs/xfs/libxfs/xfs_ag_resv.c
fs/xfs/libxfs/xfs_alloc.c
fs/xfs/libxfs/xfs_da_btree.c
fs/xfs/scrub/agheader.c
fs/xfs/scrub/bmap.c
fs/xfs/scrub/btree.c
fs/xfs/scrub/common.c
fs/xfs/scrub/dabtree.c
fs/xfs/scrub/repair.c
fs/xfs/xfs_bmap_util.c
fs/xfs/xfs_export.c
fs/xfs/xfs_file.c
fs/xfs/xfs_inode.c
fs/xfs/xfs_ioctl.c
fs/xfs/xfs_iomap.c
fs/xfs/xfs_log.c
fs/xfs/xfs_trans_buf.c

index e32a1833d5231e2a971b939d453eef1ca6c72fa5..637d954e148fb745765a6a208110cc05a1221eef 100644 (file)
@@ -354,7 +354,7 @@ xfs_ag_resv_alloc_extent(
                break;
        default:
                ASSERT(0);
-               /* fall through */
+               fallthrough;
        case XFS_AG_RESV_NONE:
                field = args->wasdel ? XFS_TRANS_SB_RES_FDBLOCKS :
                                       XFS_TRANS_SB_FDBLOCKS;
@@ -396,7 +396,7 @@ xfs_ag_resv_free_extent(
                break;
        default:
                ASSERT(0);
-               /* fall through */
+               fallthrough;
        case XFS_AG_RESV_NONE:
                xfs_trans_mod_sb(tp, XFS_TRANS_SB_FDBLOCKS, (int64_t)len);
                return;
index 82b7cbb1f24f34c4b1ebe55b672c8a17f3030f0b..af3d5f9271f614b9a3bd330e174928917294cf32 100644 (file)
@@ -3174,7 +3174,7 @@ xfs_alloc_vextent(
                }
                args->agbno = XFS_FSB_TO_AGBNO(mp, args->fsbno);
                args->type = XFS_ALLOCTYPE_NEAR_BNO;
-               /* FALLTHROUGH */
+               fallthrough;
        case XFS_ALLOCTYPE_FIRST_AG:
                /*
                 * Rotate through the allocation groups looking for a winner.
index 83ac9771bfb581f5ba8403add87acdd38f340c10..747ec77912c3f514f3da0d5f259072ce483a651b 100644 (file)
@@ -282,7 +282,7 @@ xfs_da3_node_read_verify(
                                                __this_address);
                                break;
                        }
-                       /* fall through */
+                       fallthrough;
                case XFS_DA_NODE_MAGIC:
                        fa = xfs_da3_node_verify(bp);
                        if (fa)
index 7a2f9b5f2db5bbaa69765a87d91f9f9eaa9b8ac0..f96e84793cc962218446ec6b827cbbb5254cb13d 100644 (file)
@@ -86,6 +86,7 @@ xchk_superblock(
        case -ENOSYS:
        case -EFBIG:
                error = -EFSCORRUPTED;
+               fallthrough;
        default:
                break;
        }
index b5ebf1d1b4db45d29000d736186172648283de62..77d5c4a0f09f26bd4d824cc9875697c4469c4e6a 100644 (file)
@@ -271,7 +271,7 @@ xchk_bmap_iextent_xref(
        case XFS_DATA_FORK:
                if (xfs_is_reflink_inode(info->sc->ip))
                        break;
-               /* fall through */
+               fallthrough;
        case XFS_ATTR_FORK:
                xchk_xref_is_not_shared(info->sc, agbno,
                                irec->br_blockcount);
index a94bd8122c604df27ac7e6cc1e38d55e214da458..bd1172358964e1269b80d962d477a56937a86dbc 100644 (file)
@@ -44,7 +44,7 @@ __xchk_btree_process_error(
                /* Note the badness but don't abort. */
                sc->sm->sm_flags |= errflag;
                *error = 0;
-               /* fall through */
+               fallthrough;
        default:
                if (cur->bc_flags & XFS_BTREE_ROOT_IN_INODE)
                        trace_xchk_ifork_btree_op_error(sc, cur, level,
index aa874607618a22e0dbc763f5e540994619231057..ce9a44ea6948617ab5a47586dd6c18e12bff8503 100644 (file)
@@ -81,7 +81,7 @@ __xchk_process_error(
                /* Note the badness but don't abort. */
                sc->sm->sm_flags |= errflag;
                *error = 0;
-               /* fall through */
+               fallthrough;
        default:
                trace_xchk_op_error(sc, agno, bno, *error,
                                ret_ip);
@@ -134,7 +134,7 @@ __xchk_fblock_process_error(
                /* Note the badness but don't abort. */
                sc->sm->sm_flags |= errflag;
                *error = 0;
-               /* fall through */
+               fallthrough;
        default:
                trace_xchk_file_op_error(sc, whichfork, offset, *error,
                                ret_ip);
@@ -694,7 +694,7 @@ xchk_get_inode(
                if (error)
                        return -ENOENT;
                error = -EFSCORRUPTED;
-               /* fall through */
+               fallthrough;
        default:
                trace_xchk_op_error(sc,
                                XFS_INO_TO_AGNO(mp, sc->sm->sm_ino),
index 653f3280e1c1894c6deb972c7cbe3e4c8429e643..9f0dbb47c82c09b75c1ef2080b927cd198a8f9bd 100644 (file)
@@ -47,7 +47,7 @@ xchk_da_process_error(
                /* Note the badness but don't abort. */
                sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT;
                *error = 0;
-               /* fall through */
+               fallthrough;
        default:
                trace_xchk_file_op_error(sc, ds->dargs.whichfork,
                                xfs_dir2_da_to_db(ds->dargs.geo,
index c2857d854c83ffef5c264e367d071c70eed2e729..b8202dd08939282885c4b600ad67f351703999bc 100644 (file)
@@ -947,7 +947,7 @@ xrep_ino_dqattach(
                        xrep_force_quotacheck(sc, XFS_DQTYPE_GROUP);
                if (XFS_IS_PQUOTA_ON(sc->mp) && !sc->ip->i_pdquot)
                        xrep_force_quotacheck(sc, XFS_DQTYPE_PROJ);
-               /* fall through */
+               fallthrough;
        case -ESRCH:
                error = 0;
                break;
index a5e9d7d34023f21643a4ca4fd1c9a903abafdb2b..cc628475f9b653eb173d24d73fec85b0e3794c90 100644 (file)
@@ -242,7 +242,7 @@ xfs_bmap_count_blocks(
                 */
                *count += btblocks - 1;
 
-               /* fall through */
+               fallthrough;
        case XFS_DINODE_FMT_EXTENTS:
                *nextents = xfs_bmap_count_leaves(ifp, count);
                break;
index 465fd9e048d4f30dadf2808011ab97f656ea2a5a..1da59bdff245c1902e11e51e09fc120a0ad0e0b4 100644 (file)
@@ -84,7 +84,7 @@ xfs_fs_encode_fh(
        case FILEID_INO32_GEN_PARENT:
                fid->i32.parent_ino = XFS_I(parent)->i_ino;
                fid->i32.parent_gen = parent->i_generation;
-               /*FALLTHRU*/
+               fallthrough;
        case FILEID_INO32_GEN:
                fid->i32.ino = XFS_I(inode)->i_ino;
                fid->i32.gen = inode->i_generation;
@@ -92,7 +92,7 @@ xfs_fs_encode_fh(
        case FILEID_INO32_GEN_PARENT | XFS_FILEID_TYPE_64FLAG:
                fid64->parent_ino = XFS_I(parent)->i_ino;
                fid64->parent_gen = parent->i_generation;
-               /*FALLTHRU*/
+               fallthrough;
        case FILEID_INO32_GEN | XFS_FILEID_TYPE_64FLAG:
                fid64->ino = XFS_I(inode)->i_ino;
                fid64->gen = inode->i_generation;
index 396ef36dcd0a101fc91c3fe7d20e5d565f7e12f1..3c0749ab9e4072a55888b59d9aec78a534a45c3e 100644 (file)
@@ -863,7 +863,7 @@ xfs_break_layouts(
                        error = xfs_break_dax_layouts(inode, &retry);
                        if (error || retry)
                                break;
-                       /* fall through */
+                       fallthrough;
                case BREAK_WRITE:
                        error = xfs_break_leased_layouts(inode, iolock, &retry);
                        break;
index 0369eb22c1bb0fd04e8b97f99703494a23bf69b5..f2846997c3a8ad1a396ce18f87c5502843ba7435 100644 (file)
@@ -848,7 +848,7 @@ xfs_init_new_inode(
                        xfs_inode_inherit_flags(ip, pip);
                if (pip && (pip->i_diflags2 & XFS_DIFLAG2_ANY))
                        xfs_inode_inherit_flags2(ip, pip);
-               /* FALLTHROUGH */
+               fallthrough;
        case S_IFLNK:
                ip->i_df.if_format = XFS_DINODE_FMT_EXTENTS;
                ip->i_df.if_bytes = 0;
index 3925bfcb236570bf75241e466b15d2aa70f30461..c4dc6c72ac37d27f53a473e292da312d036860f1 100644 (file)
@@ -558,7 +558,7 @@ xfs_ioc_attrmulti_one(
        case ATTR_OP_REMOVE:
                value = NULL;
                *len = 0;
-               /* fall through */
+               fallthrough;
        case ATTR_OP_SET:
                error = mnt_want_write_file(parfilp);
                if (error)
@@ -1544,7 +1544,7 @@ xfs_ioc_getbmap(
        switch (cmd) {
        case XFS_IOC_GETBMAPA:
                bmx.bmv_iflags = BMV_IF_ATTRFORK;
-               /*FALLTHRU*/
+               fallthrough;
        case XFS_IOC_GETBMAP:
                /* struct getbmap is a strict subset of struct getbmapx. */
                recsize = sizeof(struct getbmap);
index d154f42e2dc68405868b368415d26bb5615d6ebd..d8cd2583dedbf02e963b4793f896148e6dbaaa32 100644 (file)
@@ -1036,7 +1036,7 @@ retry:
                        prealloc_blocks = 0;
                        goto retry;
                }
-               /*FALLTHRU*/
+               fallthrough;
        default:
                goto out_unlock;
        }
index c19a82adea1edbbd2c989a76df615b4f4aec9e34..a002425377b5d98e36c612146bbf49da4b8e3c8e 100644 (file)
@@ -2626,6 +2626,7 @@ xlog_covered_state(
        case XLOG_STATE_COVER_IDLE:
                if (iclogs_changed == 1)
                        return XLOG_STATE_COVER_IDLE;
+               fallthrough;
        case XLOG_STATE_COVER_NEED:
        case XLOG_STATE_COVER_NEED2:
                break;
index 9aced0a00003cabe268cf4b57b769f88cefbd5b7..d11d032da0b41d51b794c519c4c454403c3a1464 100644 (file)
@@ -294,7 +294,7 @@ xfs_trans_read_buf_map(
        default:
                if (tp && (tp->t_flags & XFS_TRANS_DIRTY))
                        xfs_force_shutdown(tp->t_mountp, SHUTDOWN_META_IO_ERROR);
-               /* fall through */
+               fallthrough;
        case -ENOMEM:
        case -EAGAIN:
                return error;
This page took 0.085286 seconds and 4 git commands to generate.