From: Bruce Richardson Date: Thu, 4 May 2017 15:38:18 +0000 (+0100) Subject: lib: add switch fall-through comments X-Git-Tag: spdx-start~3261 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=3dfb9facb055bc5e5dc5d15e95678b41c9af1a17;p=dpdk.git lib: add switch fall-through comments With GCC 7 we need to explicitly document when we are falling through from one switch case to another. Fixes: af75078fece3 ("first public release") Fixes: 8bae1da2afe0 ("hash: fallback to software CRC32 implementation") Fixes: 9ec201f5d6e7 ("mbuf: provide bulk allocation") Signed-off-by: Bruce Richardson --- diff --git a/lib/librte_cmdline/cmdline_parse_num.c b/lib/librte_cmdline/cmdline_parse_num.c index b0f9a35d6f..e507ec4f1f 100644 --- a/lib/librte_cmdline/cmdline_parse_num.c +++ b/lib/librte_cmdline/cmdline_parse_num.c @@ -250,7 +250,7 @@ cmdline_parse_num(cmdline_parse_token_hdr_t *tk, const char *srcbuf, void *res, case HEX: st = HEX_OK; - /* no break */ + /* fall-through no break */ case HEX_OK: if (c >= '0' && c <= '9') { if (add_to_res(c - '0', &res1, 16) < 0) @@ -282,7 +282,7 @@ cmdline_parse_num(cmdline_parse_token_hdr_t *tk, const char *srcbuf, void *res, case BIN: st = BIN_OK; - /* no break */ + /* fall-through */ case BIN_OK: if (c >= '0' && c <= '1') { if (add_to_res(c - '0', &res1, 2) < 0) diff --git a/lib/librte_hash/rte_hash_crc.h b/lib/librte_hash/rte_hash_crc.h index 63e74aa474..0f485b8545 100644 --- a/lib/librte_hash/rte_hash_crc.h +++ b/lib/librte_hash/rte_hash_crc.h @@ -476,9 +476,15 @@ rte_hash_crc_set_alg(uint8_t alg) case CRC32_SSE42_x64: if (! rte_cpu_get_flag_enabled(RTE_CPUFLAG_EM64T)) alg = CRC32_SSE42; +#if __GNUC__ >= 7 + __attribute__ ((fallthrough)); +#endif case CRC32_SSE42: if (! rte_cpu_get_flag_enabled(RTE_CPUFLAG_SSE4_2)) alg = CRC32_SW; +#if __GNUC__ >= 7 + __attribute__ ((fallthrough)); +#endif #endif case CRC32_SW: crc32_alg = alg; diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 466ec0033e..9097f1859e 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -1156,21 +1156,25 @@ static inline int rte_pktmbuf_alloc_bulk(struct rte_mempool *pool, rte_mbuf_refcnt_set(mbufs[idx], 1); rte_pktmbuf_reset(mbufs[idx]); idx++; + /* fall-through */ case 3: RTE_ASSERT(rte_mbuf_refcnt_read(mbufs[idx]) == 0); rte_mbuf_refcnt_set(mbufs[idx], 1); rte_pktmbuf_reset(mbufs[idx]); idx++; + /* fall-through */ case 2: RTE_ASSERT(rte_mbuf_refcnt_read(mbufs[idx]) == 0); rte_mbuf_refcnt_set(mbufs[idx], 1); rte_pktmbuf_reset(mbufs[idx]); idx++; + /* fall-through */ case 1: RTE_ASSERT(rte_mbuf_refcnt_read(mbufs[idx]) == 0); rte_mbuf_refcnt_set(mbufs[idx], 1); rte_pktmbuf_reset(mbufs[idx]); idx++; + /* fall-through */ } } return 0;