mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
Use fallthrough macro
As of the Linux 5.9 kernel a fallthrough macro has been added which should be used to anotate all intentional fallthrough paths. Once all of the kernel code paths have been updated to use fallthrough the -Wimplicit-fallthrough option will because the default. To avoid warnings in the OpenZFS code base when this happens apply the fallthrough macro. Additional reading: https://lwn.net/Articles/794944/ Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com> Reviewed-by: George Melikov <mail@gmelikov.ru> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #12441
This commit is contained in:
committed by
Tony Hutter
parent
d8a97a7be2
commit
143476ce8d
@@ -377,7 +377,7 @@ kcf_provider_zero_refcnt(kcf_provider_desc_t *desc)
|
||||
mutex_exit(&desc->pd_lock);
|
||||
break;
|
||||
}
|
||||
/* FALLTHRU */
|
||||
fallthrough;
|
||||
|
||||
case CRYPTO_HW_PROVIDER:
|
||||
case CRYPTO_LOGICAL_PROVIDER:
|
||||
|
||||
+1
-1
@@ -976,7 +976,7 @@ aes_encrypt_atomic(crypto_provider_handle_t provider,
|
||||
case AES_GMAC_MECH_INFO_TYPE:
|
||||
if (plaintext->cd_length != 0)
|
||||
return (CRYPTO_ARGUMENTS_BAD);
|
||||
/* FALLTHRU */
|
||||
fallthrough;
|
||||
case AES_GCM_MECH_INFO_TYPE:
|
||||
length_needed = plaintext->cd_length + aes_ctx.ac_tag_len;
|
||||
break;
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
#define lcode_c
|
||||
#define LUA_CORE
|
||||
|
||||
#if defined(HAVE_IMPLICIT_FALLTHROUGH)
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||
#endif
|
||||
|
||||
#include <sys/lua/lua.h>
|
||||
|
||||
#include "lcode.h"
|
||||
|
||||
+1
-1
@@ -676,7 +676,7 @@ static void freeobj (lua_State *L, GCObject *o) {
|
||||
case LUA_TUSERDATA: luaM_freemem(L, o, sizeudata(gco2u(o))); break;
|
||||
case LUA_TSHRSTR:
|
||||
G(L)->strt.nuse--;
|
||||
/* FALLTHROUGH */
|
||||
fallthrough;
|
||||
case LUA_TLNGSTR: {
|
||||
luaM_freemem(L, o, sizestring(gco2ts(o)));
|
||||
break;
|
||||
|
||||
+1
-1
@@ -477,7 +477,7 @@ static int llex (LexState *ls, SemInfo *seminfo) {
|
||||
else if (!lisdigit(ls->current)) return '.';
|
||||
/* else go through */
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
fallthrough;
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9': {
|
||||
read_numeral(ls, seminfo);
|
||||
|
||||
@@ -501,7 +501,7 @@ static const char *match (MatchState *ms, const char *s, const char *p) {
|
||||
}
|
||||
case '+': /* 1 or more repetitions */
|
||||
s++; /* 1 match already done */
|
||||
/* FALLTHROUGH */
|
||||
fallthrough;
|
||||
case '*': /* 0 or more repetitions */
|
||||
s = max_expand(ms, s, p, ep);
|
||||
break;
|
||||
|
||||
+1
-1
@@ -492,7 +492,7 @@ const TValue *luaH_get (Table *t, const TValue *key) {
|
||||
return luaH_getint(t, k); /* use specialized version */
|
||||
/* else go through */
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
fallthrough;
|
||||
default: {
|
||||
Node *n = mainposition(t, key);
|
||||
do { /* check whether `key' is somewhere in the chain */
|
||||
|
||||
@@ -269,7 +269,7 @@ zfs_ace_fuid_size(void *acep)
|
||||
entry_type == OWNING_GROUP ||
|
||||
entry_type == ACE_EVERYONE)
|
||||
return (sizeof (zfs_ace_hdr_t));
|
||||
/*FALLTHROUGH*/
|
||||
fallthrough;
|
||||
default:
|
||||
return (sizeof (zfs_ace_t));
|
||||
}
|
||||
@@ -2153,7 +2153,7 @@ zfs_zaccess_aces_check(znode_t *zp, uint32_t *working_mode,
|
||||
break;
|
||||
case OWNING_GROUP:
|
||||
who = gowner;
|
||||
/*FALLTHROUGH*/
|
||||
fallthrough;
|
||||
case ACE_IDENTIFIER_GROUP:
|
||||
checkit = zfs_groupmember(zfsvfs, who, cr);
|
||||
break;
|
||||
|
||||
@@ -974,7 +974,7 @@ zfs_lookup(vnode_t *dvp, const char *nm, vnode_t **vpp,
|
||||
cnp->cn_flags |= SAVENAME;
|
||||
break;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
fallthrough;
|
||||
case DELETE:
|
||||
if (error == 0)
|
||||
cnp->cn_flags |= SAVENAME;
|
||||
|
||||
@@ -269,7 +269,7 @@ zfs_ace_fuid_size(void *acep)
|
||||
entry_type == OWNING_GROUP ||
|
||||
entry_type == ACE_EVERYONE)
|
||||
return (sizeof (zfs_ace_hdr_t));
|
||||
/*FALLTHROUGH*/
|
||||
fallthrough;
|
||||
default:
|
||||
return (sizeof (zfs_ace_t));
|
||||
}
|
||||
@@ -2317,7 +2317,7 @@ zfs_zaccess_aces_check(znode_t *zp, uint32_t *working_mode,
|
||||
break;
|
||||
case OWNING_GROUP:
|
||||
who = gowner;
|
||||
/*FALLTHROUGH*/
|
||||
fallthrough;
|
||||
case ACE_IDENTIFIER_GROUP:
|
||||
checkit = zfs_groupmember(zfsvfs, who, cr);
|
||||
break;
|
||||
|
||||
@@ -430,7 +430,7 @@ zfs_inode_set_ops(zfsvfs_t *zfsvfs, struct inode *ip)
|
||||
case S_IFBLK:
|
||||
(void) sa_lookup(ITOZ(ip)->z_sa_hdl, SA_ZPL_RDEV(zfsvfs), &rdev,
|
||||
sizeof (rdev));
|
||||
/*FALLTHROUGH*/
|
||||
fallthrough;
|
||||
case S_IFIFO:
|
||||
case S_IFSOCK:
|
||||
init_special_inode(ip, ip->i_mode, rdev);
|
||||
|
||||
+4
-4
@@ -1066,10 +1066,10 @@ abd_raidz_gen_iterate(abd_t **cabds, abd_t *dabd,
|
||||
switch (parity) {
|
||||
case 3:
|
||||
len = MIN(caiters[2].iter_mapsize, len);
|
||||
/* falls through */
|
||||
fallthrough;
|
||||
case 2:
|
||||
len = MIN(caiters[1].iter_mapsize, len);
|
||||
/* falls through */
|
||||
fallthrough;
|
||||
case 1:
|
||||
len = MIN(caiters[0].iter_mapsize, len);
|
||||
}
|
||||
@@ -1179,11 +1179,11 @@ abd_raidz_rec_iterate(abd_t **cabds, abd_t **tabds,
|
||||
case 3:
|
||||
len = MIN(xiters[2].iter_mapsize, len);
|
||||
len = MIN(citers[2].iter_mapsize, len);
|
||||
/* falls through */
|
||||
fallthrough;
|
||||
case 2:
|
||||
len = MIN(xiters[1].iter_mapsize, len);
|
||||
len = MIN(citers[1].iter_mapsize, len);
|
||||
/* falls through */
|
||||
fallthrough;
|
||||
case 1:
|
||||
len = MIN(xiters[0].iter_mapsize, len);
|
||||
len = MIN(citers[0].iter_mapsize, len);
|
||||
|
||||
@@ -749,7 +749,7 @@ dsl_prop_set_sync_impl(dsl_dataset_t *ds, const char *propname,
|
||||
ASSERT(err == 0 || err == ENOENT);
|
||||
err = zap_remove(mos, zapobj, inheritstr, tx);
|
||||
ASSERT(err == 0 || err == ENOENT);
|
||||
/* FALLTHRU */
|
||||
fallthrough;
|
||||
case (ZPROP_SRC_NONE | ZPROP_SRC_RECEIVED):
|
||||
/*
|
||||
* remove propname$recvd
|
||||
|
||||
+1
-1
@@ -9710,7 +9710,7 @@ spa_activity_in_progress(spa_t *spa, zpool_wait_activity_t activity,
|
||||
case ZPOOL_WAIT_RESILVER:
|
||||
if ((*in_progress = vdev_rebuild_active(spa->spa_root_vdev)))
|
||||
break;
|
||||
/* fall through */
|
||||
fallthrough;
|
||||
case ZPOOL_WAIT_SCRUB:
|
||||
{
|
||||
boolean_t scanning, paused, is_scrub;
|
||||
|
||||
@@ -1287,7 +1287,7 @@ vdev_label_read_bootenv(vdev_t *rvd, nvlist_t *bootenv)
|
||||
nvlist_free(config);
|
||||
break;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
fallthrough;
|
||||
default:
|
||||
/* Check for FreeBSD zfs bootonce command string */
|
||||
buf = abd_to_buf(abd);
|
||||
|
||||
@@ -142,7 +142,7 @@ static const struct {
|
||||
a.b[6] = mul_lt[a.b[6]]; \
|
||||
a.b[5] = mul_lt[a.b[5]]; \
|
||||
a.b[4] = mul_lt[a.b[4]]; \
|
||||
/* falls through */ \
|
||||
fallthrough; \
|
||||
case 4: \
|
||||
a.b[3] = mul_lt[a.b[3]]; \
|
||||
a.b[2] = mul_lt[a.b[2]]; \
|
||||
|
||||
@@ -362,7 +362,7 @@ zfs_replay_create_acl(void *arg1, void *arg2, boolean_t byteswap)
|
||||
zfsvfs->z_fuid_replay = zfs_replay_fuids(fuidstart,
|
||||
(void *)&name, lracl->lr_fuidcnt, lracl->lr_domcnt,
|
||||
lr->lr_uid, lr->lr_gid);
|
||||
/*FALLTHROUGH*/
|
||||
fallthrough;
|
||||
case TX_CREATE_ACL_ATTR:
|
||||
if (name == NULL) {
|
||||
lrattr = (lr_attr_t *)(caddr_t)(lracl + 1);
|
||||
@@ -394,7 +394,7 @@ zfs_replay_create_acl(void *arg1, void *arg2, boolean_t byteswap)
|
||||
zfsvfs->z_fuid_replay = zfs_replay_fuids(fuidstart,
|
||||
(void *)&name, lracl->lr_fuidcnt, lracl->lr_domcnt,
|
||||
lr->lr_uid, lr->lr_gid);
|
||||
/*FALLTHROUGH*/
|
||||
fallthrough;
|
||||
case TX_MKDIR_ACL_ATTR:
|
||||
if (name == NULL) {
|
||||
lrattr = (lr_attr_t *)(caddr_t)(lracl + 1);
|
||||
@@ -519,8 +519,7 @@ zfs_replay_create(void *arg1, void *arg2, boolean_t byteswap)
|
||||
zfs_replay_fuid_domain(start, &start,
|
||||
lr->lr_uid, lr->lr_gid);
|
||||
name = (char *)start;
|
||||
|
||||
/*FALLTHROUGH*/
|
||||
fallthrough;
|
||||
case TX_CREATE:
|
||||
if (name == NULL)
|
||||
name = (char *)start;
|
||||
@@ -537,8 +536,7 @@ zfs_replay_create(void *arg1, void *arg2, boolean_t byteswap)
|
||||
zfs_replay_fuid_domain(start, &start,
|
||||
lr->lr_uid, lr->lr_gid);
|
||||
name = (char *)start;
|
||||
|
||||
/*FALLTHROUGH*/
|
||||
fallthrough;
|
||||
case TX_MKDIR:
|
||||
if (name == NULL)
|
||||
name = (char *)(lr + 1);
|
||||
|
||||
@@ -214,7 +214,7 @@ zio_compress_to_feature(enum zio_compress comp)
|
||||
case ZIO_COMPRESS_ZSTD:
|
||||
return (SPA_FEATURE_ZSTD_COMPRESS);
|
||||
default:
|
||||
/* fallthru */;
|
||||
break;
|
||||
}
|
||||
return (SPA_FEATURE_NONE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user