* [PATCH 00/37] enable unreachable code detection
@ 2026-11-30 0:26 Stephen Hemminger
2026-11-30 0:26 ` [PATCH 01/37] net/mlx4: fix unreachable code warnings Stephen Hemminger
` (36 more replies)
0 siblings, 37 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:26 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
Unreachable code is often a symptom of a real bug: a misplaced
return, an inverted condition, or a loop that can only run once.
DPDK does not build with -Wunreachable-code anywhere, so none of it
gets caught.
This series fixes everything clang reports with
-Wunreachable-code-aggressive and turns the check on for the whole
tree. Only clang implements it; GCC rejects the flag and documents
-Wunreachable-code as doing nothing.
It found four real bugs: only one event vector adapter per queue
was usable, a leftover debug abort() in the dpaa2 flow engine, the
dpaa2 traffic manager port state check stubbed out as "if (0)", and
eight dead error paths in the ipsec-secgw config parser.
The rest is dead statements and examples that could never run their
own cleanup, which now handle SIGINT and SIGTERM. Removing a
trailing return is not just tidying: a case that later forgets to
return becomes a compiler error rather than silently returning zero.
Eleven drivers keep an exemption for base code imported from
vendors, applied through base_cflags where the driver separates its
base sources so its own code is still checked.
Bugzilla ID: 2135
Bugzilla ID: 2139
Bugzilla ID: 2140
Tested on x86 with clang and gcc, both -Dwerror=true examples=all,
and on Arm64. Two of the defects were invisible in an x86 clang
build alone.
Removing common/ exports that no other driver uses is a related but
larger job, and will be sent separately.
Dariusz Sosnowski (2):
net/mlx4: fix unreachable code warnings
net/mlx5: fix unreachable code warnings
Stephen Hemminger (35):
eventdev: fix vector adapter instance allocation
eal: silence unreachable code in version string
net/dpaa2: remove debug abort in flow destroy
app/testpmd: fix unreachable VF traffic error message
examples/eventdev_pipeline: remove dead continue
examples/ipsec-secgw: remove unreachable config error path
examples/skeleton: handle SIGINT and SIGTERM
examples/rxtx_callbacks: handle SIGINT and SIGTERM
examples/service_cores: handle SIGINT and SIGTERM
examples/timer: handle SIGINT and SIGTERM
examples/multi_process: handle SIGINT and SIGTERM in client
examples/server_node_efd: handle SIGINT and SIGTERM in node
examples/pipeline: handle SIGINT and SIGTERM
ethdev: fix unreachable warnings from switch declarations
config: add per-directory option for -Wunreachable-code
bus/dpaa: exempt this driver from unreachable code detection
net/qede: disable unreachable code checks
net/txgbe: disable unreachable code checks
net/ixgbe: disable unreachable code check
net/ngbe: disable unreachable code check
net/octeontx: replace unreachable code
common/sfc_efx: disable unreachable code check for base code
net/dpaa2: check port state before changing TM hierarchy
net/e1000: disable unreachable code check for base code
net/ice: disable unreachable code check for base code
raw/ifpga: disable unreachable code check for base code
net/bnxt: disable unreachable code check
net/ntnic: disable unreachable code check
lib: mark never returning thread functions
lib: remove unreachable statements
app: remove unreachable statements
examples: remove unreachable statements
drivers: remove unreachable statements
efd: mark configuration dependent vector selection
config: enable unreachable code detection
app/dumpcap/main.c | 1 -
app/pdump/main.c | 1 -
.../comp_perf_options_parse.c | 1 -
app/test-crypto-perf/cperf_ops.c | 1 -
app/test-crypto-perf/cperf_options_parsing.c | 1 -
app/test-flow-perf/main.c | 1 -
app/test-gpudev/main.c | 1 -
app/test-pmd/config.c | 4 +-
app/test-pmd/parameters.c | 2 -
app/test-regex/main.c | 2 -
app/test-security-perf/test_security_perf.c | 1 -
app/test/test_cryptodev.c | 9 ---
app/test/test_cryptodev_crosscheck.c | 6 --
app/test/test_eal_flags.c | 1 -
app/test/test_event_vector_adapter.c | 19 +++--
config/meson.build | 9 +++
drivers/bus/dpaa/meson.build | 3 +
drivers/common/cnxk/roc_nix_fc.c | 2 -
drivers/common/mlx5/linux/mlx5_nl.c | 1 -
drivers/common/sfc_efx/base/meson.build | 1 +
drivers/crypto/caam_jr/caam_jr.c | 1 -
drivers/crypto/openssl/rte_openssl_pmd.c | 1 -
drivers/dma/dpaa/dpaa_qdma.c | 2 -
drivers/event/dsw/dsw_xstats.c | 1 -
drivers/ml/cnxk/cnxk_ml_ops.c | 10 ---
drivers/net/bnx2x/bnx2x.c | 2 -
drivers/net/bnxt/meson.build | 3 +
drivers/net/cnxk/cnxk_ethdev_mtr.c | 3 -
drivers/net/dpaa2/dpaa2_flow.c | 1 -
drivers/net/dpaa2/dpaa2_tm.c | 6 +-
drivers/net/intel/e1000/meson.build | 3 +
drivers/net/intel/ice/meson.build | 3 +
drivers/net/intel/ipn3ke/ipn3ke_representor.c | 3 -
drivers/net/intel/ipn3ke/ipn3ke_tm.c | 1 -
drivers/net/intel/ixgbe/meson.build | 3 +
drivers/net/mlx4/mlx4_flow.c | 14 ++--
drivers/net/mlx5/linux/mlx5_mp_os.c | 1 -
drivers/net/mlx5/mlx5_flow_dv.c | 1 -
drivers/net/mlx5/mlx5_flow_flex.c | 1 -
drivers/net/mlx5/mlx5_flow_hw.c | 18 +++--
drivers/net/mlx5/mlx5_flow_verbs.c | 16 ++---
drivers/net/ngbe/base/meson.build | 3 +
drivers/net/ntnic/meson.build | 3 +
drivers/net/octeontx/base/octeontx_pkovf.c | 9 ++-
drivers/net/qede/base/meson.build | 3 +
drivers/net/qede/meson.build | 2 +-
drivers/net/sfc/sfc_mae.c | 2 -
drivers/net/txgbe/base/meson.build | 3 +
drivers/net/txgbe/meson.build | 1 +
drivers/raw/ifpga/base/meson.build | 1 +
drivers/vdpa/ifc/ifcvf_vdpa.c | 4 --
drivers/vdpa/mlx5/mlx5_vdpa_cthread.c | 1 -
drivers/vdpa/mlx5/mlx5_vdpa_event.c | 2 -
drivers/vdpa/nfp/nfp_vdpa.c | 5 --
examples/bond/main.c | 1 -
examples/eventdev_pipeline/main.c | 4 +-
examples/ipsec-secgw/parser.c | 40 +++--------
examples/l2fwd-jobstats/main.c | 2 -
examples/l3fwd/main.c | 4 --
.../client_server_mp/mp_client/client.c | 20 +++++-
examples/ntb/ntb_fwd.c | 1 -
examples/pipeline/main.c | 21 +++++-
examples/pipeline/thread.c | 2 +-
examples/pipeline/thread.h | 6 ++
examples/rxtx_callbacks/main.c | 19 ++++-
examples/server_node_efd/efd_node/node.c | 20 +++++-
examples/service_cores/main.c | 23 +++++-
examples/skeleton/basicfwd.c | 18 ++++-
examples/timer/main.c | 23 +++++-
examples/vhost/main.c | 4 +-
lib/cmdline/cmdline_parse_num.c | 2 -
lib/eal/common/rte_version.c | 7 +-
lib/efd/rte_efd.c | 10 +--
lib/ethdev/rte_flow.c | 71 +++++++++----------
lib/eventdev/rte_event_eth_rx_adapter.c | 4 +-
lib/eventdev/rte_event_vector_adapter.c | 5 +-
lib/fib/rte_fib.c | 1 -
lib/fib/rte_fib6.c | 1 -
lib/sched/rte_sched.c | 1 -
lib/vhost/socket.c | 4 +-
lib/vhost/vhost_crypto.c | 1 -
81 files changed, 278 insertions(+), 237 deletions(-)
--
2.53.0
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 01/37] net/mlx4: fix unreachable code warnings
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
@ 2026-11-30 0:26 ` Stephen Hemminger
2026-11-30 0:26 ` [PATCH 02/37] net/mlx5: " Stephen Hemminger
` (35 subsequent siblings)
36 siblings, 0 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:26 UTC (permalink / raw)
To: dev
Cc: Dariusz Sosnowski, stable, Stephen Hemminger, Matan Azrad,
Viacheslav Ovsiienko, Adrien Mazarguil, Nelio Laranjeiro,
Andrew Rybchenko, Ferruh Yigit
From: Dariusz Sosnowski <dsosnowski@nvidia.com>
Building with clang and -Wunreachable-code generates warnings
on variable declarations inside switch block in mlx4_flow_prepare().
Move them up to silence the warnings.
Bugzilla ID: 2139
Fixes: 267d07dacdeb ("net/mlx4: tidy up flow rule handling code")
Fixes: 078b8b452e6b ("net/mlx4: add RSS flow rule action support")
Fixes: ac8d22de2394 ("ethdev: flatten RSS configuration in flow API")
Fixes: ef134c8daa08 ("net/mlx4: fix ignored RSS hash types")
Cc: stable@dpdk.org
Reported-by: Stephen Hemminger <stephen@networkplumber.org>
Suggested-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
---
drivers/net/mlx4/mlx4_flow.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c
index b520664d95..f812884c34 100644
--- a/drivers/net/mlx4/mlx4_flow.c
+++ b/drivers/net/mlx4/mlx4_flow.c
@@ -747,6 +747,13 @@ mlx4_flow_prepare(struct mlx4_priv *priv,
}
/* Go over actions list. */
for (action = actions; action->type; ++action) {
+ const struct rte_flow_action_queue *queue;
+ const struct rte_flow_action_rss *rss;
+ const uint8_t *rss_key;
+ uint32_t rss_key_len;
+ uint64_t fields;
+ unsigned int i;
+
/* This one may appear anywhere multiple times. */
if (action->type == RTE_FLOW_ACTION_TYPE_VOID)
continue;
@@ -758,13 +765,6 @@ mlx4_flow_prepare(struct mlx4_priv *priv,
}
overlap = 1;
switch (action->type) {
- const struct rte_flow_action_queue *queue;
- const struct rte_flow_action_rss *rss;
- const uint8_t *rss_key;
- uint32_t rss_key_len;
- uint64_t fields;
- unsigned int i;
-
case RTE_FLOW_ACTION_TYPE_DROP:
flow->drop = 1;
break;
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 02/37] net/mlx5: fix unreachable code warnings
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
2026-11-30 0:26 ` [PATCH 01/37] net/mlx4: fix unreachable code warnings Stephen Hemminger
@ 2026-11-30 0:26 ` Stephen Hemminger
2026-11-30 0:26 ` [PATCH 03/37] eventdev: fix vector adapter instance allocation Stephen Hemminger
` (34 subsequent siblings)
36 siblings, 0 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:26 UTC (permalink / raw)
To: dev
Cc: Dariusz Sosnowski, xuemingl, 14pwcse1224, stable,
Stephen Hemminger, Viacheslav Ovsiienko, Bing Zhao, Ori Kam,
Suanming Mou, Matan Azrad
From: Dariusz Sosnowski <dsosnowski@nvidia.com>
Building with clang and -Wunreachable-code produces warnings:
- In flow_verbs_discover_priorities()
- With recent rdma-core versions, a condition is skipped
because of goto statement under ifdefs for new version.
- In flow_hw_validate_rule_pattern() and
flow_hw_validate_rule_actions()
- On variable declarations inside switch at the beginning of
switch blocks.
This patch silences these warnings.
First issue is resolved by reorganizing ifdef guards
to remove the need for goto.
Second issue is resolved by moving variable declarations
out of the switch block.
Bugzilla ID: 2140
Fixes: 1d47e9335e2f ("net/mlx5: improve Verbs flow priority discovery")
Fixes: 57c7b94301ee ("net/mlx5: add async flow operation validation")
Fixes: 179e70fd7ad2 ("net/mlx5: fix connection tracking state item validation")
Cc: xuemingl@nvidia.com
Cc: 14pwcse1224@uetpeshawar.edu.pk
Cc: stable@dpdk.org
Reported-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
---
drivers/net/mlx5/mlx5_flow_hw.c | 17 ++++++++---------
drivers/net/mlx5/mlx5_flow_verbs.c | 16 +++++++---------
2 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 6e6bf07799..62482c911d 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -17351,6 +17351,11 @@ flow_hw_validate_rule_pattern(struct rte_eth_dev *dev,
pt_item++;
for (; pt_item->type != RTE_FLOW_ITEM_TYPE_END; pt_item++, items++) {
+ const struct rte_flow_item_ethdev *ethdev;
+ const struct rte_flow_item_tx_queue *tx_queue;
+ const struct rte_flow_item_conntrack *spec;
+ struct mlx5_txq_ctrl *txq;
+
if (pt_item->type != items->type)
return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM,
items, "Item type does not match the template");
@@ -17375,11 +17380,6 @@ flow_hw_validate_rule_pattern(struct rte_eth_dev *dev,
items, "Item spec is required");
switch (items->type) {
- const struct rte_flow_item_ethdev *ethdev;
- const struct rte_flow_item_tx_queue *tx_queue;
- const struct rte_flow_item_conntrack *spec;
- struct mlx5_txq_ctrl *txq;
-
case RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT:
ethdev = items->spec;
if (flow_hw_validate_target_port_id(dev, ethdev->port_id)) {
@@ -17486,7 +17486,10 @@ flow_hw_validate_rule_actions(struct rte_eth_dev *dev,
* Configuration of masked actions is ignored.
*/
LIST_FOREACH(act_data, &hw_acts->act_list, next) {
+ const struct rte_flow_action_modify_field *mf;
+ const struct rte_flow_action_ethdev *ethdev;
const struct rte_flow_action *user_action;
+ enum rte_flow_action_type expected_type;
user_action = &actions[act_data->action_src];
@@ -17507,10 +17510,6 @@ flow_hw_validate_rule_actions(struct rte_eth_dev *dev,
"Action requires configuration");
switch ((int)user_action->type) {
- enum rte_flow_action_type expected_type;
- const struct rte_flow_action_ethdev *ethdev;
- const struct rte_flow_action_modify_field *mf;
-
case RTE_FLOW_ACTION_TYPE_INDIRECT:
expected_type = act_data->indirect.expected_type;
if (!flow_hw_valid_indirect_action_type(user_action, expected_type))
diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c
index eb576f73d4..f404d2c739 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -50,14 +50,15 @@ struct ibv_spec_header {
*/
static int
flow_verbs_discover_priorities(struct rte_eth_dev *dev,
- const uint16_t *vprio, int vprio_n)
+ const uint16_t *vprio __rte_unused,
+ int vprio_n __rte_unused)
{
struct mlx5_priv *priv = dev->data->dev_private;
struct {
struct ibv_flow_attr attr;
struct ibv_flow_spec_eth eth;
struct ibv_flow_spec_action_drop drop;
- } flow_attr = {
+ } __rte_unused flow_attr = {
.attr = {
.num_of_specs = 2,
.port = (uint8_t)priv->dev_port,
@@ -79,16 +80,15 @@ flow_verbs_discover_priorities(struct rte_eth_dev *dev,
.type = IBV_FLOW_SPEC_ACTION_DROP,
},
};
- struct ibv_flow *flow;
- struct mlx5_hrxq *drop = priv->drop_queue.hrxq;
- int i;
+ struct ibv_flow *flow __rte_unused;
+ struct mlx5_hrxq *drop __rte_unused = priv->drop_queue.hrxq;
+ int i __rte_unused;
int priority = 0;
#if defined(HAVE_MLX5DV_DR_DEVX_PORT) || defined(HAVE_MLX5DV_DR_DEVX_PORT_V35)
/* If DevX supported, driver must support 16 verbs flow priorities. */
priority = 16;
- goto out;
-#endif
+#else
if (!drop->qp) {
rte_errno = ENOTSUP;
return -rte_errno;
@@ -101,8 +101,6 @@ flow_verbs_discover_priorities(struct rte_eth_dev *dev,
claim_zero(mlx5_glue->destroy_flow(flow));
priority = vprio[i];
}
-#if defined(HAVE_MLX5DV_DR_DEVX_PORT) || defined(HAVE_MLX5DV_DR_DEVX_PORT_V35)
-out:
#endif
DRV_LOG(INFO, "port %u supported flow priorities:"
" 0-%d for ingress or egress root table,"
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 03/37] eventdev: fix vector adapter instance allocation
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
2026-11-30 0:26 ` [PATCH 01/37] net/mlx4: fix unreachable code warnings Stephen Hemminger
2026-11-30 0:26 ` [PATCH 02/37] net/mlx5: " Stephen Hemminger
@ 2026-11-30 0:26 ` Stephen Hemminger
2026-11-30 0:26 ` [PATCH 04/37] eal: silence unreachable code in version string Stephen Hemminger
` (33 subsequent siblings)
36 siblings, 0 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:26 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, stable, Pavan Nikhilesh, Jerin Jacob
Creating more than one vector adapter on an event queue always
failed with EEXIST, even though RTE_EVENT_VECTOR_ADAPTER_MAX_
INSTANCE_PER_QUEUE instances are allocated per queue.
The loop searching for a free instance returns NULL as soon as it
finds an instance in use, instead of continuing the search. Only
index zero is ever examined, so the loop increment is never
executed and clang reports it with
-Wunreachable-code-loop-increment.
Remove the early return so the loop scans all instances. The
existing check after the loop reports exhaustion, and now uses
ENOSPC which is the value documented for this case in the API.
Fixes: e12c3754da7a ("eventdev/vector: introduce event vector adapter")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
app/test/test_event_vector_adapter.c | 19 ++++++++++++++-----
lib/eventdev/rte_event_vector_adapter.c | 5 +----
2 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/app/test/test_event_vector_adapter.c b/app/test/test_event_vector_adapter.c
index c6d694421b..da58c478f0 100644
--- a/app/test/test_event_vector_adapter.c
+++ b/app/test/test_event_vector_adapter.c
@@ -5,6 +5,7 @@
#include <string.h>
#include <rte_common.h>
+#include <rte_errno.h>
#include <rte_malloc.h>
#include "test.h"
@@ -77,7 +78,7 @@ test_event_vector_adapter_create_multi(void)
[RTE_EVENT_VECTOR_ADAPTER_MAX_INSTANCE_PER_QUEUE];
struct rte_event_vector_adapter_conf conf;
struct rte_event_vector_adapter_info info;
- int ret, i, j;
+ int ret, i, j, nb;
memset(&conf, 0, sizeof(conf));
memset(&info, 0, sizeof(info));
@@ -100,22 +101,30 @@ test_event_vector_adapter_create_multi(void)
conf.ev.event_type = RTE_EVENT_TYPE_VECTOR | RTE_EVENT_TYPE_CPU;
conf.ev.sched_type = RTE_SCHED_TYPE_PARALLEL;
+ nb = RTE_MIN(info.max_vector_adapters_per_event_queue,
+ RTE_EVENT_VECTOR_ADAPTER_MAX_INSTANCE_PER_QUEUE);
+
for (i = 0; i < evdev_max_queues; i++) {
- for (j = 0; j < info.max_vector_adapters_per_event_queue; j++) {
- conf.ev.queue_id = j;
+ for (j = 0; j < nb; j++) {
+ conf.ev.queue_id = i;
adapter[i][j] = rte_event_vector_adapter_create(&conf);
TEST_ASSERT(adapter[i][j] != NULL, "Failed to create event vector adapter");
}
+ /* One more than the per queue limit must fail. */
+ if (nb == RTE_EVENT_VECTOR_ADAPTER_MAX_INSTANCE_PER_QUEUE)
+ TEST_ASSERT(rte_event_vector_adapter_create(&conf) == NULL &&
+ rte_errno == ENOSPC,
+ "Created more vector adapters than the queue supports");
}
for (i = 0; i < evdev_max_queues; i++)
- for (j = 0; j < info.max_vector_adapters_per_event_queue; j++)
+ for (j = 0; j < nb; j++)
TEST_ASSERT(adapter[i][j] == rte_event_vector_adapter_lookup(
adapter[i][j]->adapter_id),
"Failed to lookup event vector adapter");
for (i = 0; i < evdev_max_queues; i++)
- for (j = 0; j < info.max_vector_adapters_per_event_queue; j++)
+ for (j = 0; j < nb; j++)
rte_event_vector_adapter_destroy(adapter[i][j]);
rte_mempool_free(vector_mp);
diff --git a/lib/eventdev/rte_event_vector_adapter.c b/lib/eventdev/rte_event_vector_adapter.c
index 9a839517c8..a955227c48 100644
--- a/lib/eventdev/rte_event_vector_adapter.c
+++ b/lib/eventdev/rte_event_vector_adapter.c
@@ -193,14 +193,11 @@ rte_event_vector_adapter_create_ext(const struct rte_event_vector_adapter_conf *
adapter->used = true;
break;
}
- EVVEC_LOG_DBG("adapter %u is already in use", i);
- rte_errno = EEXIST;
- return NULL;
}
if (adapter == NULL) {
EVVEC_LOG_DBG("no available vector adapters");
- rte_errno = ENODEV;
+ rte_errno = ENOSPC;
return NULL;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 04/37] eal: silence unreachable code in version string
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (2 preceding siblings ...)
2026-11-30 0:26 ` [PATCH 03/37] eventdev: fix vector adapter instance allocation Stephen Hemminger
@ 2026-11-30 0:26 ` Stephen Hemminger
2026-11-30 9:13 ` Bruce Richardson
2026-11-30 0:26 ` [PATCH 05/37] net/dpaa2: remove debug abort in flow destroy Stephen Hemminger
` (32 subsequent siblings)
36 siblings, 1 reply; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:26 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
rte_version() used "strlen(RTE_VER_SUFFIX) == 0" to detect an empty
suffix. Clang evaluates strlen of a constant string at compile time
and then reports the other branch as unreachable code.
Use sizeof instead, which clang treats as a configuration value and
does not warn about. Note that sizeof of a string literal includes
the NUL terminator, so the empty string is sizeof 1 rather than 0.
Also fix the indentation of the else.
Bugzilla ID: 2135
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/eal/common/rte_version.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/eal/common/rte_version.c b/lib/eal/common/rte_version.c
index 627b89d4a8..864d0cfdc5 100644
--- a/lib/eal/common/rte_version.c
+++ b/lib/eal/common/rte_version.c
@@ -36,14 +36,15 @@ rte_version(void)
static char version[32];
if (version[0] != 0)
return version;
- if (strlen(RTE_VER_SUFFIX) == 0)
+
+ if (sizeof(RTE_VER_SUFFIX) == 1) /* empty string */
snprintf(version, sizeof(version), "%s %d.%02d.%d",
RTE_VER_PREFIX,
RTE_VER_YEAR,
RTE_VER_MONTH,
RTE_VER_MINOR);
- else
- snprintf(version, sizeof(version), "%s %d.%02d.%d%s%d",
+ else
+ snprintf(version, sizeof(version), "%s %d.%02d.%d%s%d",
RTE_VER_PREFIX,
RTE_VER_YEAR,
RTE_VER_MONTH,
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 05/37] net/dpaa2: remove debug abort in flow destroy
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (3 preceding siblings ...)
2026-11-30 0:26 ` [PATCH 04/37] eal: silence unreachable code in version string Stephen Hemminger
@ 2026-11-30 0:26 ` Stephen Hemminger
2026-11-30 0:26 ` [PATCH 06/37] app/testpmd: fix unreachable VF traffic error message Stephen Hemminger
` (31 subsequent siblings)
36 siblings, 0 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:26 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, stable, Hemant Agrawal, Sachin Saxena,
Jun Yang
Removing a QoS entry when destroying a flow calls abort() on
failure, killing the application. Clang reports the following
"goto error" as unreachable.
The abort() looks like leftover debug code: it is the only one in
the driver, and the identical RSS case below reports the same
failure through the error path instead.
Remove it so the failure is reported to the caller with
rte_flow_error_set() like every other error in this function.
Fixes: 56c1817d532e ("net/dpaa2: refactor flow engine")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/dpaa2/dpaa2_flow.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/dpaa2/dpaa2_flow.c b/drivers/net/dpaa2/dpaa2_flow.c
index 979ab4cae0..cf2d66ed26 100644
--- a/drivers/net/dpaa2/dpaa2_flow.c
+++ b/drivers/net/dpaa2/dpaa2_flow.c
@@ -5398,7 +5398,6 @@ dpaa2_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *_flow,
DPAA2_PMD_ERR("Remove FS QoS entry failed");
dpaa2_flow_qos_entry_log("Delete failed", flow,
-1);
- abort();
goto error;
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 06/37] app/testpmd: fix unreachable VF traffic error message
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (4 preceding siblings ...)
2026-11-30 0:26 ` [PATCH 05/37] net/dpaa2: remove debug abort in flow destroy Stephen Hemminger
@ 2026-11-30 0:26 ` Stephen Hemminger
2026-11-30 0:26 ` [PATCH 07/37] examples/eventdev_pipeline: remove dead continue Stephen Hemminger
` (30 subsequent siblings)
36 siblings, 0 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:26 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Aman Singh
In set_vf_traffic() the ixgbe specific code ends with a return, so
the generic "not supported" message after the #endif can only be
reached when ixgbe is not built. Clang reports it as unreachable
in the normal build.
Put the generic message in an #else block so that exactly one path
is compiled in either configuration, and drop the now redundant
return.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
app/test-pmd/config.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 8986d6998f..5f255d2630 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -7301,12 +7301,12 @@ set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on)
fprintf(stderr,
"rte_pmd_ixgbe_set_vf_%s for port_id=%d failed diag=%d\n",
is_rx ? "rx" : "tx", port_id, diag);
- return;
-#endif
+#else
fprintf(stderr, "VF %s setting not supported for port %d\n",
is_rx ? "Rx" : "Tx", port_id);
RTE_SET_USED(vf);
RTE_SET_USED(on);
+#endif
}
int
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 07/37] examples/eventdev_pipeline: remove dead continue
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (5 preceding siblings ...)
2026-11-30 0:26 ` [PATCH 06/37] app/testpmd: fix unreachable VF traffic error message Stephen Hemminger
@ 2026-11-30 0:26 ` Stephen Hemminger
2026-11-30 0:26 ` [PATCH 08/37] examples/ipsec-secgw: remove unreachable config error path Stephen Hemminger
` (29 subsequent siblings)
36 siblings, 0 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:26 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
Clang reports the continue after rte_panic() as unreachable.
rte_panic() does not return, so the statement can never execute.
Remove it and the now redundant braces.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
examples/eventdev_pipeline/main.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/examples/eventdev_pipeline/main.c b/examples/eventdev_pipeline/main.c
index 00f409a07b..2c9b64655d 100644
--- a/examples/eventdev_pipeline/main.c
+++ b/examples/eventdev_pipeline/main.c
@@ -437,11 +437,9 @@ main(int argc, char **argv)
err = rte_eal_remote_launch(fdata->cap.worker,
&worker_data[worker_idx], lcore_id);
- if (err) {
+ if (err)
rte_panic("Failed to launch worker on core %d\n",
lcore_id);
- continue;
- }
if (fdata->worker_core[lcore_id])
worker_idx++;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 08/37] examples/ipsec-secgw: remove unreachable config error path
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (6 preceding siblings ...)
2026-11-30 0:26 ` [PATCH 07/37] examples/eventdev_pipeline: remove dead continue Stephen Hemminger
@ 2026-11-30 0:26 ` Stephen Hemminger
2026-11-30 9:52 ` Radu Nicolau
2026-11-30 0:26 ` [PATCH 09/37] examples/skeleton: handle SIGINT and SIGTERM Stephen Hemminger
` (28 subsequent siblings)
36 siblings, 1 reply; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:26 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Radu Nicolau, Akhil Goyal
Clang reports eight unreachable statements in parse_cfg_file().
Each error check calls rte_panic() and then does "goto error_exit",
but rte_panic() does not return, so none of the gotos can be taken
and the error_exit cleanup block is never entered.
Remove the dead gotos and the orphaned label. Error handling is
unchanged: rte_panic() still aborts on a bad config file.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
examples/ipsec-secgw/parser.c | 40 +++++++----------------------------
1 file changed, 8 insertions(+), 32 deletions(-)
diff --git a/examples/ipsec-secgw/parser.c b/examples/ipsec-secgw/parser.c
index 29c4d3cb3d..fda6384e5a 100644
--- a/examples/ipsec-secgw/parser.c
+++ b/examples/ipsec-secgw/parser.c
@@ -434,15 +434,11 @@ parse_cfg_file(const char *cfg_filename)
uint32_t line_num = 0;
struct parse_status status = {0};
- if (f == NULL) {
+ if (f == NULL)
rte_panic("Error: invalid file descriptor %s\n", cfg_filename);
- goto error_exit;
- }
- if (cl == NULL) {
+ if (cl == NULL)
rte_panic("Error: cannot create cmdline instance\n");
- goto error_exit;
- }
cfg_sp_add_rule.data = &status;
cfg_sa_add_rule.data = &status;
@@ -460,12 +456,10 @@ parse_cfg_file(const char *cfg_filename)
line_num++;
- if (strlen(oneline) > 1022) {
+ if (strlen(oneline) > 1022)
rte_panic("%s:%u: error: "
"the line contains more characters the parser can handle\n",
cfg_filename, line_num);
- goto error_exit;
- }
/* process comment char '#' */
if (oneline[0] == '#')
@@ -478,47 +472,37 @@ parse_cfg_file(const char *cfg_filename)
/* process line concatenator '\' */
pos = strchr(oneline, 92);
if (pos != NULL) {
- if (pos != oneline+strlen(oneline) - 2) {
+ if (pos != oneline+strlen(oneline) - 2)
rte_panic("%s:%u: error: "
"no character should exist after '\\'\n",
cfg_filename, line_num);
- goto error_exit;
- }
*pos = '\0';
- if (strlen(oneline) + strlen(str) > 1022) {
+ if (strlen(oneline) + strlen(str) > 1022)
rte_panic("%s:%u: error: "
"the concatenated line contains more characters the parser can handle\n",
cfg_filename, line_num);
- goto error_exit;
- }
strcpy(str + strlen(str), oneline);
continue;
}
/* copy the line to str and process */
- if (strlen(oneline) + strlen(str) > 1022) {
+ if (strlen(oneline) + strlen(str) > 1022)
rte_panic("%s:%u: error: "
"the line contains more characters the parser can handle\n",
cfg_filename, line_num);
- goto error_exit;
- }
strcpy(str + strlen(str), oneline);
str[strlen(str)] = '\n';
- if (cmdline_parse(cl, str) < 0) {
+ if (cmdline_parse(cl, str) < 0)
rte_panic("%s:%u: error: parsing \"%s\" failed\n",
cfg_filename, line_num, str);
- goto error_exit;
- }
- if (status.status < 0) {
+ if (status.status < 0)
rte_panic("%s:%u: error: %s", cfg_filename,
line_num, status.parse_msg);
- goto error_exit;
- }
memset(str, 0, 1024);
} while (1);
@@ -531,12 +515,4 @@ parse_cfg_file(const char *cfg_filename)
sp6_sort_arr();
return 0;
-
-error_exit:
- if (cl)
- cmdline_stdin_exit(cl);
- if (f)
- fclose(f);
-
- return -1;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 09/37] examples/skeleton: handle SIGINT and SIGTERM
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (7 preceding siblings ...)
2026-11-30 0:26 ` [PATCH 08/37] examples/ipsec-secgw: remove unreachable config error path Stephen Hemminger
@ 2026-11-30 0:26 ` Stephen Hemminger
2026-11-30 0:26 ` [PATCH 10/37] examples/rxtx_callbacks: " Stephen Hemminger
` (27 subsequent siblings)
36 siblings, 0 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:26 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Bruce Richardson, John McNamara
The forwarding loop in lcore_main() never terminates, so the
rte_eal_cleanup() and return in main() are unreachable. Clang
reports this with -Wunreachable-code.
Add a signal handler setting force_quit, as done by l2fwd and
others, and test it in the loop. The function is no longer
__rte_noreturn, so the existing cleanup now runs on exit.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
examples/skeleton/basicfwd.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/examples/skeleton/basicfwd.c b/examples/skeleton/basicfwd.c
index ca433fc89e..a05c8ea381 100644
--- a/examples/skeleton/basicfwd.c
+++ b/examples/skeleton/basicfwd.c
@@ -2,6 +2,8 @@
* Copyright(c) 2010-2015 Intel Corporation
*/
+#include <signal.h>
+#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <inttypes.h>
@@ -18,6 +20,15 @@
#define MBUF_CACHE_SIZE 250
#define BURST_SIZE 32
+static volatile bool force_quit;
+
+static void
+signal_handler(int signum)
+{
+ if (signum == SIGINT || signum == SIGTERM)
+ force_quit = true;
+}
+
/* basicfwd.c: Basic DPDK skeleton forwarding example. */
/*
@@ -113,7 +124,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
*/
/* Basic forwarding application lcore. 8< */
-static __rte_noreturn void
+static void
lcore_main(void)
{
uint16_t port;
@@ -134,7 +145,7 @@ lcore_main(void)
rte_lcore_id());
/* Main work of application loop. 8< */
- for (;;) {
+ while (!force_quit) {
/*
* Receive packets on a port and forward them on the paired
* port. The mapping is 0 -> 1, 1 -> 0, 2 -> 3, 3 -> 2, etc.
@@ -182,6 +193,9 @@ main(int argc, char *argv[])
rte_exit(EXIT_FAILURE, "Error with EAL initialization\n");
/* >8 End of initializing the Environment Abstraction Layer (EAL). */
+ signal(SIGINT, signal_handler);
+ signal(SIGTERM, signal_handler);
+
argc -= ret;
argv += ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 10/37] examples/rxtx_callbacks: handle SIGINT and SIGTERM
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (8 preceding siblings ...)
2026-11-30 0:26 ` [PATCH 09/37] examples/skeleton: handle SIGINT and SIGTERM Stephen Hemminger
@ 2026-11-30 0:26 ` Stephen Hemminger
2026-11-30 0:26 ` [PATCH 11/37] examples/service_cores: " Stephen Hemminger
` (26 subsequent siblings)
36 siblings, 0 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:26 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Bruce Richardson, John McNamara
The forwarding loop in lcore_main() never terminates, so the
rte_eal_cleanup() and return in main() are unreachable. Clang
reports this with -Wunreachable-code.
Add a signal handler setting force_quit, as done by l2fwd and
others, and test it in the loop. The function is no longer
__rte_noreturn, so the existing cleanup now runs on exit.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
examples/rxtx_callbacks/main.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c
index 4682921285..fe26e7cde2 100644
--- a/examples/rxtx_callbacks/main.c
+++ b/examples/rxtx_callbacks/main.c
@@ -2,7 +2,9 @@
* Copyright(c) 2010-2015 Intel Corporation
*/
+#include <signal.h>
#include <stdalign.h>
+#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <inttypes.h>
@@ -23,6 +25,15 @@
static int hwts_dynfield_offset = -1;
+static volatile bool force_quit;
+
+static void
+signal_handler(int signum)
+{
+ if (signum == SIGINT || signum == SIGTERM)
+ force_quit = true;
+}
+
static inline rte_mbuf_timestamp_t *
hwts_field(struct rte_mbuf *mbuf)
{
@@ -244,7 +255,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
* Main thread that does the work, reading from INPUT_PORT
* and writing to OUTPUT_PORT
*/
-static __rte_noreturn void
+static void
lcore_main(void)
{
uint16_t port;
@@ -259,7 +270,7 @@ lcore_main(void)
printf("\nCore %u forwarding packets. [Ctrl+C to quit]\n",
rte_lcore_id());
- for (;;) {
+ while (!force_quit) {
RTE_ETH_FOREACH_DEV(port) {
struct rte_mbuf *bufs[BURST_SIZE];
const uint16_t nb_rx = rte_eth_rx_burst(port, 0,
@@ -301,6 +312,10 @@ main(int argc, char *argv[])
if (ret < 0)
rte_exit(EXIT_FAILURE, "Error with EAL initialization\n");
+
+ signal(SIGINT, signal_handler);
+ signal(SIGTERM, signal_handler);
+
argc -= ret;
argv += ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 11/37] examples/service_cores: handle SIGINT and SIGTERM
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (9 preceding siblings ...)
2026-11-30 0:26 ` [PATCH 10/37] examples/rxtx_callbacks: " Stephen Hemminger
@ 2026-11-30 0:26 ` Stephen Hemminger
2026-11-30 0:26 ` [PATCH 12/37] examples/timer: " Stephen Hemminger
` (25 subsequent siblings)
36 siblings, 0 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:26 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
The profile display loop in main() never terminates, so the
rte_eal_cleanup() and return after it are unreachable. Clang
reports this with -Wunreachable-code.
Add a signal handler setting force_quit, as done by l2fwd and
others, and test it in the loop so that cleanup runs on exit.
Change the main loop to use sleep() which is interruptible
rather than rte_delay_us_sleep() which retries on EINTR.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
examples/service_cores/main.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/examples/service_cores/main.c b/examples/service_cores/main.c
index 9f52082254..2c7a3f7488 100644
--- a/examples/service_cores/main.c
+++ b/examples/service_cores/main.c
@@ -2,6 +2,8 @@
* Copyright(c) 2017 Intel Corporation
*/
+#include <signal.h>
+#include <stdbool.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
@@ -163,6 +165,15 @@ apply_profile(int profile_id)
}
}
+static volatile bool force_quit;
+
+static void
+signal_handler(int signum)
+{
+ if (signum == SIGINT || signum == SIGTERM)
+ force_quit = true;
+}
+
int
main(int argc, char **argv)
{
@@ -172,6 +183,9 @@ main(int argc, char **argv)
if (ret < 0)
rte_panic("Cannot init EAL\n");
+ signal(SIGINT, signal_handler);
+ signal(SIGTERM, signal_handler);
+
uint32_t i;
for (i = 0; i < NUM_SERVICES; i++) {
services[i].callback_userdata = 0;
@@ -203,7 +217,7 @@ main(int argc, char **argv)
}
i = 0;
- while (1) {
+ while (!force_quit) {
const char clr[] = { 27, '[', '2', 'J', '\0' };
const char topLeft[] = { 27, '[', '1', ';', '1', 'H', '\0' };
printf("%s%s", clr, topLeft);
@@ -211,10 +225,13 @@ main(int argc, char **argv)
apply_profile(i);
printf("\n==> Profile: %s\n\n", profiles[i].name);
- rte_delay_us_sleep(1 * US_PER_S);
+ /* sleep() returns the time left if interrupted by a signal */
+ if (sleep(1) != 0)
+ break;
rte_service_dump(stdout, UINT32_MAX);
- rte_delay_us_sleep(5 * US_PER_S);
+ if (sleep(5) != 0)
+ break;
rte_service_dump(stdout, UINT32_MAX);
i++;
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 12/37] examples/timer: handle SIGINT and SIGTERM
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (10 preceding siblings ...)
2026-11-30 0:26 ` [PATCH 11/37] examples/service_cores: " Stephen Hemminger
@ 2026-11-30 0:26 ` Stephen Hemminger
2026-11-30 0:26 ` [PATCH 13/37] examples/multi_process: handle SIGINT and SIGTERM in client Stephen Hemminger
` (24 subsequent siblings)
36 siblings, 0 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:26 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Erik Gabriel Carrillo
The timer poll loop in lcore_mainloop() never terminates, so the
rte_eal_cleanup() and return in main() are unreachable. Clang
reports this with -Wunreachable-code.
Add a signal handler setting force_quit, as done by l2fwd and
others, and test it in the loop. The function is no longer
__rte_noreturn and now returns zero.
lcore_mainloop() also runs on the worker lcores, so main() must
wait for them to leave the loop before tearing down the EAL.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
examples/timer/main.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/examples/timer/main.c b/examples/timer/main.c
index a349846c7c..170c15ca19 100644
--- a/examples/timer/main.c
+++ b/examples/timer/main.c
@@ -2,6 +2,8 @@
* Copyright(c) 2010-2014 Intel Corporation
*/
+#include <signal.h>
+#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
@@ -56,7 +58,16 @@ timer1_cb(__rte_unused struct rte_timer *tim,
}
/* >8 End of timer1 callback. */
-static __rte_noreturn int
+static volatile bool force_quit;
+
+static void
+signal_handler(int signum)
+{
+ if (signum == SIGINT || signum == SIGTERM)
+ force_quit = true;
+}
+
+static int
lcore_mainloop(__rte_unused void *arg)
{
uint64_t prev_tsc = 0, cur_tsc, diff_tsc;
@@ -66,7 +77,7 @@ lcore_mainloop(__rte_unused void *arg)
printf("Starting mainloop on core %u\n", lcore_id);
/* Main loop. 8< */
- while (1) {
+ while (!force_quit) {
/*
* Call the timer handler on each core: as we don't need a
* very precise timer, so only call rte_timer_manage()
@@ -81,6 +92,8 @@ lcore_mainloop(__rte_unused void *arg)
}
}
/* >8 End of main loop. */
+
+ return 0;
}
int
@@ -95,6 +108,9 @@ main(int argc, char **argv)
if (ret < 0)
rte_panic("Cannot init EAL\n");
+ signal(SIGINT, signal_handler);
+ signal(SIGTERM, signal_handler);
+
/* init RTE timer library */
rte_timer_subsystem_init();
/* >8 End of init EAL. */
@@ -126,6 +142,9 @@ main(int argc, char **argv)
(void) lcore_mainloop(NULL);
/* >8 End of call lcore_mainloop() on every worker lcore. */
+ /* wait for the workers to stop polling the timers */
+ rte_eal_mp_wait_lcore();
+
/* clean up the EAL */
rte_eal_cleanup();
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 13/37] examples/multi_process: handle SIGINT and SIGTERM in client
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (11 preceding siblings ...)
2026-11-30 0:26 ` [PATCH 12/37] examples/timer: " Stephen Hemminger
@ 2026-11-30 0:26 ` Stephen Hemminger
2026-11-30 0:26 ` [PATCH 14/37] examples/server_node_efd: handle SIGINT and SIGTERM in node Stephen Hemminger
` (23 subsequent siblings)
36 siblings, 0 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:26 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Anatoly Burakov
The packet handling loop in main() never terminates, so the
rte_eal_cleanup() after it is unreachable. Clang reports this
with -Wunreachable-code.
Add a signal handler setting force_quit, as done by the server
process and others, and test it in the loop so that cleanup runs
on exit. Return zero explicitly rather than falling off the end
of main().
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
.../client_server_mp/mp_client/client.c | 20 +++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/examples/multi_process/client_server_mp/mp_client/client.c b/examples/multi_process/client_server_mp/mp_client/client.c
index 087c38ef73..2916881541 100644
--- a/examples/multi_process/client_server_mp/mp_client/client.c
+++ b/examples/multi_process/client_server_mp/mp_client/client.c
@@ -2,6 +2,8 @@
* Copyright(c) 2010-2016 Intel Corporation
*/
+#include <signal.h>
+#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <inttypes.h>
@@ -195,9 +197,18 @@ handle_packet(struct rte_mbuf *buf)
}
+static volatile bool force_quit;
+
+static void
+signal_handler(int signum)
+{
+ if (signum == SIGINT || signum == SIGTERM)
+ force_quit = true;
+}
+
/*
* Application main function - loops through
- * receiving and processing packets. Never returns
+ * receiving and processing packets until interrupted
*/
int
main(int argc, char *argv[])
@@ -213,6 +224,9 @@ main(int argc, char *argv[])
if ((retval = rte_eal_init(argc, argv)) < 0)
return -1;
+
+ signal(SIGINT, signal_handler);
+ signal(SIGTERM, signal_handler);
argc -= retval;
argv += retval;
@@ -243,7 +257,7 @@ main(int argc, char *argv[])
printf("\nClient process %d handling packets\n", client_id);
printf("[Press Ctrl-C to quit ...]\n");
- for (;;) {
+ while (!force_quit) {
uint16_t i, rx_pkts;
rx_pkts = rte_ring_dequeue_burst(rx_ring, pkts,
@@ -270,4 +284,6 @@ main(int argc, char *argv[])
/* clean up the EAL */
rte_eal_cleanup();
+
+ return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 14/37] examples/server_node_efd: handle SIGINT and SIGTERM in node
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (12 preceding siblings ...)
2026-11-30 0:26 ` [PATCH 13/37] examples/multi_process: handle SIGINT and SIGTERM in client Stephen Hemminger
@ 2026-11-30 0:26 ` Stephen Hemminger
2026-11-30 0:27 ` [PATCH 15/37] examples/pipeline: handle SIGINT and SIGTERM Stephen Hemminger
` (22 subsequent siblings)
36 siblings, 0 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:26 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Yipeng Wang
The packet handling loop in main() never terminates, so the
rte_eal_cleanup() after it is unreachable. Clang reports this
with -Wunreachable-code.
Add a signal handler setting force_quit, as done by l2fwd and
others, and test it in the loop so that cleanup runs on exit.
Return zero explicitly rather than falling off the end of main(),
and drop the "Never returns" comment which no longer applies.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
examples/server_node_efd/efd_node/node.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/examples/server_node_efd/efd_node/node.c b/examples/server_node_efd/efd_node/node.c
index fc2aa5ffef..94ff4e9e0e 100644
--- a/examples/server_node_efd/efd_node/node.c
+++ b/examples/server_node_efd/efd_node/node.c
@@ -2,6 +2,8 @@
* Copyright(c) 2016-2017 Intel Corporation
*/
+#include <signal.h>
+#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <inttypes.h>
@@ -298,9 +300,18 @@ handle_packets(struct rte_hash *h, struct rte_mbuf **bufs, uint16_t num_packets)
}
/* >8 End of packets dequeuing. */
+static volatile bool force_quit;
+
+static void
+signal_handler(int signum)
+{
+ if (signum == SIGINT || signum == SIGTERM)
+ force_quit = true;
+}
+
/*
* Application main function - loops through
- * receiving and processing packets. Never returns
+ * receiving and processing packets until interrupted
*/
int
main(int argc, char *argv[])
@@ -318,6 +329,9 @@ main(int argc, char *argv[])
retval = rte_eal_init(argc, argv);
if (retval < 0)
return -1;
+
+ signal(SIGINT, signal_handler);
+ signal(SIGTERM, signal_handler);
argc -= retval;
argv += retval;
@@ -356,7 +370,7 @@ main(int argc, char *argv[])
printf("\nNode process %d handling packets\n", node_id);
printf("[Press Ctrl-C to quit ...]\n");
- for (;;) {
+ while (!force_quit) {
uint16_t rx_pkts = PKT_READ_SIZE;
uint16_t port;
@@ -392,4 +406,6 @@ main(int argc, char *argv[])
/* clean up the EAL */
rte_eal_cleanup();
+
+ return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 15/37] examples/pipeline: handle SIGINT and SIGTERM
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (13 preceding siblings ...)
2026-11-30 0:26 ` [PATCH 14/37] examples/server_node_efd: handle SIGINT and SIGTERM in node Stephen Hemminger
@ 2026-11-30 0:27 ` Stephen Hemminger
2026-11-30 0:27 ` [PATCH 16/37] ethdev: fix unreachable warnings from switch declarations Stephen Hemminger
` (21 subsequent siblings)
36 siblings, 0 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Cristian Dumitrescu
The dispatch loop in main() never terminates, so the
rte_eal_cleanup() after it is unreachable. Clang reports this
with -Wunreachable-code.
This example has two independent dispatch loops: the control
plane loop in main() and the data plane loop in thread_main()
running on every worker lcore. Stopping only the control plane
would tear down the EAL while the workers are still running
pipelines, so force_quit is declared in thread.h and tested by
both loops.
The connectivity poll functions are non blocking, so the control
plane loop notices the flag immediately.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
examples/pipeline/main.c | 21 ++++++++++++++++++++-
examples/pipeline/thread.c | 2 +-
examples/pipeline/thread.h | 6 ++++++
3 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/examples/pipeline/main.c b/examples/pipeline/main.c
index da5dd2b3f6..57f9584a64 100644
--- a/examples/pipeline/main.c
+++ b/examples/pipeline/main.c
@@ -2,6 +2,8 @@
* Copyright(c) 2020 Intel Corporation
*/
+#include <signal.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -131,6 +133,15 @@ parse_args(int argc, char **argv)
return 0;
}
+volatile bool force_quit;
+
+static void
+signal_handler(int signum)
+{
+ if (signum == SIGINT || signum == SIGTERM)
+ force_quit = true;
+}
+
int
main(int argc, char **argv)
{
@@ -149,6 +160,9 @@ main(int argc, char **argv)
return status;
};
+ signal(SIGINT, signal_handler);
+ signal(SIGTERM, signal_handler);
+
/* Thread */
status = thread_init();
if (status) {
@@ -178,12 +192,17 @@ main(int argc, char **argv)
};
/* Dispatch loop */
- for ( ; ; ) {
+ while (!force_quit) {
conn_poll_for_conn(conn);
conn_poll_for_msg(conn);
}
+ /* wait for the data plane threads to stop running the pipelines */
+ rte_eal_mp_wait_lcore();
+
/* clean up the EAL */
rte_eal_cleanup();
+
+ return 0;
}
diff --git a/examples/pipeline/thread.c b/examples/pipeline/thread.c
index cf2af55f68..8cdbd4fade 100644
--- a/examples/pipeline/thread.c
+++ b/examples/pipeline/thread.c
@@ -359,7 +359,7 @@ thread_main(void *arg __rte_unused)
t = &threads[thread_id];
/* Dispatch loop. */
- for ( ; ; ) {
+ while (!force_quit) {
uint32_t i;
/* Pipelines. */
diff --git a/examples/pipeline/thread.h b/examples/pipeline/thread.h
index f2e643def5..ad83b27506 100644
--- a/examples/pipeline/thread.h
+++ b/examples/pipeline/thread.h
@@ -5,10 +5,16 @@
#ifndef _INCLUDE_THREAD_H_
#define _INCLUDE_THREAD_H_
+#include <stdbool.h>
#include <stdint.h>
#include <rte_swx_pipeline.h>
+/**
+ * Set by the signal handler to stop the control and data plane threads.
+ */
+extern volatile bool force_quit;
+
/**
* Control plane (CP) thread.
*/
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 16/37] ethdev: fix unreachable warnings from switch declarations
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (14 preceding siblings ...)
2026-11-30 0:27 ` [PATCH 15/37] examples/pipeline: handle SIGINT and SIGTERM Stephen Hemminger
@ 2026-11-30 0:27 ` Stephen Hemminger
2026-11-30 0:27 ` [PATCH 17/37] config: add per-directory option for -Wunreachable-code Stephen Hemminger
` (20 subsequent siblings)
36 siblings, 0 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Ori Kam, Thomas Monjalon, Andrew Rybchenko
Putting declarations inside switch block but before the first
case statement cause clang to flag them as unreachable code.
Simpler to just move.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/ethdev/rte_flow.c | 71 +++++++++++++++++++++----------------------
1 file changed, 34 insertions(+), 37 deletions(-)
diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index ae08e100fa..393e365f9f 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -704,29 +704,28 @@ rte_flow_conv_item_spec(void *buf, const size_t size,
type == RTE_FLOW_CONV_ITEM_LAST ? item->last :
type == RTE_FLOW_CONV_ITEM_MASK ? item->mask :
NULL;
+ union {
+ const struct rte_flow_item_raw *raw;
+ const struct rte_flow_item_geneve_opt *geneve_opt;
+ } spec;
+ union {
+ const struct rte_flow_item_raw *raw;
+ } last;
+ union {
+ const struct rte_flow_item_raw *raw;
+ } mask;
+ union {
+ const struct rte_flow_item_raw *raw;
+ const struct rte_flow_item_geneve_opt *geneve_opt;
+ } src;
+ union {
+ struct rte_flow_item_raw *raw;
+ struct rte_flow_item_geneve_opt *geneve_opt;
+ } dst;
+ void *deep_src;
+ size_t tmp;
switch (item->type) {
- union {
- const struct rte_flow_item_raw *raw;
- const struct rte_flow_item_geneve_opt *geneve_opt;
- } spec;
- union {
- const struct rte_flow_item_raw *raw;
- } last;
- union {
- const struct rte_flow_item_raw *raw;
- } mask;
- union {
- const struct rte_flow_item_raw *raw;
- const struct rte_flow_item_geneve_opt *geneve_opt;
- } src;
- union {
- struct rte_flow_item_raw *raw;
- struct rte_flow_item_geneve_opt *geneve_opt;
- } dst;
- void *deep_src;
- size_t tmp;
-
case RTE_FLOW_ITEM_TYPE_RAW:
spec.raw = item->spec;
last.raw = item->last ? item->last : item->spec;
@@ -809,21 +808,20 @@ rte_flow_conv_action_conf(void *buf, const size_t size,
const struct rte_flow_action *action)
{
size_t off;
+ union {
+ const struct rte_flow_action_rss *rss;
+ const struct rte_flow_action_vxlan_encap *vxlan_encap;
+ const struct rte_flow_action_nvgre_encap *nvgre_encap;
+ } src;
+ union {
+ struct rte_flow_action_rss *rss;
+ struct rte_flow_action_vxlan_encap *vxlan_encap;
+ struct rte_flow_action_nvgre_encap *nvgre_encap;
+ } dst;
+ size_t tmp;
+ int ret;
switch (action->type) {
- union {
- const struct rte_flow_action_rss *rss;
- const struct rte_flow_action_vxlan_encap *vxlan_encap;
- const struct rte_flow_action_nvgre_encap *nvgre_encap;
- } src;
- union {
- struct rte_flow_action_rss *rss;
- struct rte_flow_action_vxlan_encap *vxlan_encap;
- struct rte_flow_action_nvgre_encap *nvgre_encap;
- } dst;
- size_t tmp;
- int ret;
-
case RTE_FLOW_ACTION_TYPE_RSS:
src.rss = action->conf;
dst.rss = buf;
@@ -1241,12 +1239,11 @@ rte_flow_conv(enum rte_flow_conv_op op,
const void *src,
struct rte_flow_error *error)
{
+ const struct rte_flow_attr *attr;
+ const struct rte_flow_item *item;
int ret;
switch (op) {
- const struct rte_flow_attr *attr;
- const struct rte_flow_item *item;
-
case RTE_FLOW_CONV_OP_NONE:
ret = 0;
break;
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 17/37] config: add per-directory option for -Wunreachable-code
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (15 preceding siblings ...)
2026-11-30 0:27 ` [PATCH 16/37] ethdev: fix unreachable warnings from switch declarations Stephen Hemminger
@ 2026-11-30 0:27 ` Stephen Hemminger
2026-11-30 0:27 ` [PATCH 18/37] bus/dpaa: exempt this driver from unreachable code detection Stephen Hemminger
` (19 subsequent siblings)
36 siblings, 0 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Bruce Richardson
Unreachable code is usually a symptom of a real bug: a misplaced
return, an inverted condition, or a loop that can never iterate.
DPDK does not build with -Wunreachable-code anywhere, so none of
these get caught.
Add a no_unreachable_cflag variable, following the no_shadow_cflag
pattern, so that the few drivers with unreachable code in imported
base code can be excluded when the check is enabled.
Only clang implements this warning. GCC accepts -Wunreachable-code
but documents it as doing nothing, so finding these bugs requires a
clang build.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
config/meson.build | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/config/meson.build b/config/meson.build
index bfac1cd93d..9f501589b7 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -372,6 +372,11 @@ if cc.has_argument('-Wno-shadow')
no_shadow_cflag = '-Wno-shadow'
endif
+no_unreachable_cflag = []
+if cc.has_argument('-Wunreachable-code')
+ no_unreachable_cflag = '-Wno-unreachable-code'
+endif
+
# per-driver option to disable -Wcomma if supported by the compiler
no_comma_cflag = []
if cc.has_argument('-Wno-comma')
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 18/37] bus/dpaa: exempt this driver from unreachable code detection
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (16 preceding siblings ...)
2026-11-30 0:27 ` [PATCH 17/37] config: add per-directory option for -Wunreachable-code Stephen Hemminger
@ 2026-11-30 0:27 ` Stephen Hemminger
2026-11-30 0:27 ` [PATCH 19/37] net/qede: disable unreachable code checks Stephen Hemminger
` (18 subsequent siblings)
36 siblings, 0 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Hemant Agrawal, Sachin Saxena
This driver has some unreachable code warnings in the base/ code.
The DQRR CFG register value in qm_dqrr_init() includes the terms
"(0 ? 0x40 : 0) /* Ignore RP */" and
"(0 ? 0x10 : 0) /* Ignore SP */",
which clang reports as unreachable code.
Both terms are always zero, so they contribute nothing to the
register value. They look like the remains of a configuration
macro that was replaced by its disabled value, leaving the
conditional behind. The same two lines appear unchanged in the
Linux kernel qbman driver, so this predates the DPDK import.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/bus/dpaa/meson.build | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/bus/dpaa/meson.build b/drivers/bus/dpaa/meson.build
index d1f03bb093..ef5e5721e5 100644
--- a/drivers/bus/dpaa/meson.build
+++ b/drivers/bus/dpaa/meson.build
@@ -22,6 +22,9 @@ sources = files(
'dpaa_bus_base_symbols.c',
)
+# base code in base/ has unreachable code, and is not built separately
+cflags += no_unreachable_cflag
+
if cc.has_argument('-Wno-cast-qual')
cflags += '-Wno-cast-qual'
endif
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 19/37] net/qede: disable unreachable code checks
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (17 preceding siblings ...)
2026-11-30 0:27 ` [PATCH 18/37] bus/dpaa: exempt this driver from unreachable code detection Stephen Hemminger
@ 2026-11-30 0:27 ` Stephen Hemminger
2026-11-30 0:27 ` [PATCH 20/37] net/txgbe: " Stephen Hemminger
` (17 subsequent siblings)
36 siblings, 0 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Devendra Singh Rawat, Alok Prasad
There is unreachable code in the base/ files imported from the
vendor. Disable the check for the base code only, using
base_cflags, so the driver's own sources are still checked.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/qede/base/meson.build | 3 +++
drivers/net/qede/meson.build | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/qede/base/meson.build b/drivers/net/qede/base/meson.build
index a6dad3ec7b..8469bb2c17 100644
--- a/drivers/net/qede/base/meson.build
+++ b/drivers/net/qede/base/meson.build
@@ -55,3 +55,6 @@ foreach flag: error_cflags
base_cflags += flag
endif
endforeach
+
+# base code has unreachable code
+base_cflags += no_unreachable_cflag
diff --git a/drivers/net/qede/meson.build b/drivers/net/qede/meson.build
index 7957aae3fa..836bb78c89 100644
--- a/drivers/net/qede/meson.build
+++ b/drivers/net/qede/meson.build
@@ -19,9 +19,9 @@ sources = files(
'qede_sriov.c',
)
+# warnings in the base code imported from the vendor
if cc.has_argument('-Wno-format-nonliteral')
cflags += '-Wno-format-nonliteral'
endif
-# Suppress shadow warnings for this driver
cflags += no_shadow_cflag
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 20/37] net/txgbe: disable unreachable code checks
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (18 preceding siblings ...)
2026-11-30 0:27 ` [PATCH 19/37] net/qede: disable unreachable code checks Stephen Hemminger
@ 2026-11-30 0:27 ` Stephen Hemminger
2026-11-30 0:27 ` [PATCH 21/37] net/ixgbe: disable unreachable code check Stephen Hemminger
` (16 subsequent siblings)
36 siblings, 0 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Jiawen Wu, Zaiyu Wang
There is unreachable code in the base/ files imported from the
vendor. Disable the check for the base code only, using
base_cflags, so the driver's own sources are still checked.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/txgbe/base/meson.build | 3 +++
drivers/net/txgbe/meson.build | 1 +
2 files changed, 4 insertions(+)
diff --git a/drivers/net/txgbe/base/meson.build b/drivers/net/txgbe/base/meson.build
index a9a02577ce..b8cc9ce3c9 100644
--- a/drivers/net/txgbe/base/meson.build
+++ b/drivers/net/txgbe/base/meson.build
@@ -15,3 +15,6 @@ base_sources = files(
'txgbe_e56.c',
'txgbe_e56_bp.c',
)
+
+# base code has unreachable code
+base_cflags += no_unreachable_cflag
diff --git a/drivers/net/txgbe/meson.build b/drivers/net/txgbe/meson.build
index dea50bfe14..c10db31e0c 100644
--- a/drivers/net/txgbe/meson.build
+++ b/drivers/net/txgbe/meson.build
@@ -23,6 +23,7 @@ sources = files(
deps += ['hash', 'security']
+# warnings in the base code imported from the vendor
cflags += no_wvla_cflag
cflags += no_shadow_cflag
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 21/37] net/ixgbe: disable unreachable code check
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (19 preceding siblings ...)
2026-11-30 0:27 ` [PATCH 20/37] net/txgbe: " Stephen Hemminger
@ 2026-11-30 0:27 ` Stephen Hemminger
2026-11-30 9:14 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 22/37] net/ngbe: " Stephen Hemminger
` (15 subsequent siblings)
36 siblings, 1 reply; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Anatoly Burakov, Vladimir Medvedkin
There is unreachable code in the base/ files imported from the
vendor. Disable the check for the base code only, using
base_cflags, so the driver's own sources are still checked.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/intel/ixgbe/meson.build | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/intel/ixgbe/meson.build b/drivers/net/intel/ixgbe/meson.build
index 7e26700835..a3d6979b2b 100644
--- a/drivers/net/intel/ixgbe/meson.build
+++ b/drivers/net/intel/ixgbe/meson.build
@@ -20,6 +20,9 @@ base_sources = files(
'base/ixgbe_x550.c',
)
+# base code has unreachable code
+base_cflags += no_unreachable_cflag
+
sources += files(
'ixgbe_82599_bypass.c',
'ixgbe_bypass.c',
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 22/37] net/ngbe: disable unreachable code check
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (20 preceding siblings ...)
2026-11-30 0:27 ` [PATCH 21/37] net/ixgbe: disable unreachable code check Stephen Hemminger
@ 2026-11-30 0:27 ` Stephen Hemminger
2026-11-30 0:27 ` [PATCH 23/37] net/octeontx: replace unreachable code Stephen Hemminger
` (14 subsequent siblings)
36 siblings, 0 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Jiawen Wu, Zaiyu Wang
There is unreachable code in the base/ files imported from the
vendor. Disable the check for the base code only, using
base_cflags, so the driver's own sources are still checked.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/ngbe/base/meson.build | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ngbe/base/meson.build b/drivers/net/ngbe/base/meson.build
index 6932f648af..83844049b8 100644
--- a/drivers/net/ngbe/base/meson.build
+++ b/drivers/net/ngbe/base/meson.build
@@ -14,3 +14,6 @@ base_sources = files(
)
cflags += no_wvla_cflag
+
+# base code has unreachable code
+base_cflags += no_unreachable_cflag
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 23/37] net/octeontx: replace unreachable code
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (21 preceding siblings ...)
2026-11-30 0:27 ` [PATCH 22/37] net/ngbe: " Stephen Hemminger
@ 2026-11-30 0:27 ` Stephen Hemminger
2026-11-30 0:27 ` [PATCH 24/37] common/sfc_efx: disable unreachable code check for base code Stephen Hemminger
` (13 subsequent siblings)
36 siblings, 0 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Harman Kalra
The PKO flow control register value encoded the DQ stride with
"(PKO_DQ_FC_STRIDE == PKO_DQ_FC_STRIDE_16) ? 1 : 0", which clang
reports as unreachable because PKO_DQ_FC_STRIDE is defined as
PKO_DQ_FC_STRIDE_16.
The conditional documents nothing on its own: the reader has to
work out that it is constant and then look up the register layout.
Hard code the stride bit and add a static_assert() on the
PKO_DQ_FC_STRIDE definition, so changing the stride fails the
build instead of silently programming the wrong value.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/octeontx/base/octeontx_pkovf.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/octeontx/base/octeontx_pkovf.c b/drivers/net/octeontx/base/octeontx_pkovf.c
index 5326fe24b9..112b3a217b 100644
--- a/drivers/net/octeontx/base/octeontx_pkovf.c
+++ b/drivers/net/octeontx/base/octeontx_pkovf.c
@@ -2,6 +2,7 @@
* Copyright(c) 2017 Cavium, Inc
*/
+#include <assert.h>
#include <stdbool.h>
#include <string.h>
#include <stdio.h>
@@ -17,6 +18,12 @@
#include "octeontx_io.h"
#include "octeontx_pkovf.h"
+/*
+ * The DQ_FC_CONFIG STRIDE bit below is hard coded for a stride of 16.
+ */
+static_assert(PKO_DQ_FC_STRIDE == PKO_DQ_FC_STRIDE_16,
+ "PKO flow control stride must be 16");
+
struct octeontx_pko_iomem {
uint8_t *va;
rte_iova_t iova;
@@ -523,7 +530,7 @@ octeontx_pko_init_fc(const size_t pko_vf_count)
(sizeof(struct octeontx_pko_fc_ctl_s) * dq_ix)) & ~0x7F;
reg |= /* BASE */
(0x2 << 3) | /* HYST_BITS */
- (((PKO_DQ_FC_STRIDE == PKO_DQ_FC_STRIDE_16) ? 1 : 0) << 2) |
+ (1 << 2) | /* STRIDE: 16 */
(0x1 << 0); /* ENABLE */
octeontx_write64(reg, vf_bar0 + PKO_VF_DQ_FC_CONFIG);
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 24/37] common/sfc_efx: disable unreachable code check for base code
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (22 preceding siblings ...)
2026-11-30 0:27 ` [PATCH 23/37] net/octeontx: replace unreachable code Stephen Hemminger
@ 2026-11-30 0:27 ` Stephen Hemminger
2026-11-30 0:27 ` [PATCH 25/37] net/dpaa2: check port state before changing TM hierarchy Stephen Hemminger
` (12 subsequent siblings)
36 siblings, 0 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Andrew Rybchenko
In efx_mon_init() the monitor type switch only has cases when
EFSYS_OPT_MON_MCDI is enabled. DPDK builds with it set to zero, so
only the default case which jumps to the error path remains and
clang reports the assignment after the switch as unreachable.
The code is correct in the upstream libefx where the option is
enabled, so add the flag to the list of warnings already disabled
for this base code.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/common/sfc_efx/base/meson.build | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/common/sfc_efx/base/meson.build b/drivers/common/sfc_efx/base/meson.build
index 78383a38a2..885bf837cd 100644
--- a/drivers/common/sfc_efx/base/meson.build
+++ b/drivers/common/sfc_efx/base/meson.build
@@ -80,6 +80,7 @@ else
'-Wno-unused-variable',
'-Wno-empty-body',
'-Wno-unused-but-set-variable',
+ '-Wno-unreachable-code',
]
endif
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 25/37] net/dpaa2: check port state before changing TM hierarchy
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (23 preceding siblings ...)
2026-11-30 0:27 ` [PATCH 24/37] common/sfc_efx: disable unreachable code check for base code Stephen Hemminger
@ 2026-11-30 0:27 ` Stephen Hemminger
2026-11-30 0:27 ` [PATCH 26/37] net/e1000: disable unreachable code check for base code Stephen Hemminger
` (11 subsequent siblings)
36 siblings, 0 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Hemant Agrawal, Sachin Saxena
dpaa2_node_add() and dpaa2_node_delete() had the "port is already
started" check stubbed out as "if (0)", one of them with an
"XXX: update it" comment. The error message and the
RTE_TM_ERROR_TYPE_UNSPECIFIED argument were already in place, so
only the condition was missing.
Use dev->data->dev_started, which is what other drivers test in
their traffic manager callbacks. The hierarchy is pushed to the
hardware by dpaa2_hierarchy_commit(), so building or removing
nodes while the port is running was never going to take effect.
Also removes the last two "if (0)" blocks outside base code, which
clang reports as unreachable code with
-Wunreachable-code-aggressive.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/dpaa2/dpaa2_tm.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/dpaa2/dpaa2_tm.c b/drivers/net/dpaa2/dpaa2_tm.c
index 3057f4d031..70c5ee66f0 100644
--- a/drivers/net/dpaa2/dpaa2_tm.c
+++ b/drivers/net/dpaa2/dpaa2_tm.c
@@ -445,7 +445,7 @@ dpaa2_node_add(struct rte_eth_dev *dev, uint32_t node_id,
struct dpaa2_tm_node *node, *parent = NULL;
int ret;
- if (0/* If device is started*/)
+ if (dev->data->dev_started)
return -rte_tm_error_set(error, EPERM,
RTE_TM_ERROR_TYPE_UNSPECIFIED,
NULL, "Port is already started\n");
@@ -537,12 +537,10 @@ dpaa2_node_delete(struct rte_eth_dev *dev, uint32_t node_id,
struct dpaa2_dev_priv *priv = dev->data->dev_private;
struct dpaa2_tm_node *node;
- /* XXX: update it */
- if (0) {
+ if (dev->data->dev_started)
return -rte_tm_error_set(error, EPERM,
RTE_TM_ERROR_TYPE_UNSPECIFIED,
NULL, "Port is already started\n");
- }
node = dpaa2_node_from_id(priv, node_id);
if (!node)
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 26/37] net/e1000: disable unreachable code check for base code
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (24 preceding siblings ...)
2026-11-30 0:27 ` [PATCH 25/37] net/dpaa2: check port state before changing TM hierarchy Stephen Hemminger
@ 2026-11-30 0:27 ` Stephen Hemminger
2026-11-30 9:14 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 27/37] net/ice: " Stephen Hemminger
` (10 subsequent siblings)
36 siblings, 1 reply; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
There is unreachable code in the base/ files imported from the
vendor. Disable the check for the base code only, using
base_cflags, so the driver's own sources are still checked.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/intel/e1000/meson.build | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/intel/e1000/meson.build b/drivers/net/intel/e1000/meson.build
index 6f1e300718..4c35db5067 100644
--- a/drivers/net/intel/e1000/meson.build
+++ b/drivers/net/intel/e1000/meson.build
@@ -22,6 +22,9 @@ base_sources = files(
'base/e1000_vf.c',
)
+# base code has unreachable code
+base_cflags += no_unreachable_cflag
+
sources += files(
'e1000_logs.c',
'e1000_osdep.c',
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 27/37] net/ice: disable unreachable code check for base code
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (25 preceding siblings ...)
2026-11-30 0:27 ` [PATCH 26/37] net/e1000: disable unreachable code check for base code Stephen Hemminger
@ 2026-11-30 0:27 ` Stephen Hemminger
2026-11-30 9:16 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 28/37] raw/ifpga: " Stephen Hemminger
` (9 subsequent siblings)
36 siblings, 1 reply; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Bruce Richardson, Anatoly Burakov
There is unreachable code in the base/ files imported from the
vendor. Disable the check for the base code only, using
base_cflags, so the driver's own sources are still checked.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/intel/ice/meson.build | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/intel/ice/meson.build b/drivers/net/intel/ice/meson.build
index 00077be30a..f8eb1e0015 100644
--- a/drivers/net/intel/ice/meson.build
+++ b/drivers/net/intel/ice/meson.build
@@ -76,6 +76,9 @@ base_sources = files(
'base/ice_vf_mbx.c',
)
+# base code has unreachable code
+base_cflags += no_unreachable_cflag
+
if is_ms_compiler
base_error_cflags = [
'/wd4101', # unreferenced local variable
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 28/37] raw/ifpga: disable unreachable code check for base code
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (26 preceding siblings ...)
2026-11-30 0:27 ` [PATCH 27/37] net/ice: " Stephen Hemminger
@ 2026-11-30 0:27 ` Stephen Hemminger
2026-11-30 9:43 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 29/37] net/bnxt: disable unreachable code check Stephen Hemminger
` (8 subsequent siblings)
36 siblings, 1 reply; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Rosen Xu
There is unreachable code in the base/ files imported from the
vendor. Add the flag next to the -Wno-comma already disabled for
that code, so the driver's own sources are still checked.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/raw/ifpga/base/meson.build | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/raw/ifpga/base/meson.build b/drivers/raw/ifpga/base/meson.build
index 225bde052b..ad344674a1 100644
--- a/drivers/raw/ifpga/base/meson.build
+++ b/drivers/raw/ifpga/base/meson.build
@@ -25,3 +25,4 @@ base_sources = files(
'opae_eth_group.c',
)
base_cflags += no_comma_cflag
+base_cflags += no_unreachable_cflag
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 29/37] net/bnxt: disable unreachable code check
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (27 preceding siblings ...)
2026-11-30 0:27 ` [PATCH 28/37] raw/ifpga: " Stephen Hemminger
@ 2026-11-30 0:27 ` Stephen Hemminger
2026-11-30 0:27 ` [PATCH 30/37] net/ntnic: " Stephen Hemminger
` (7 subsequent siblings)
36 siblings, 0 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Kishore Padmanabha, Ajit Khaparde
There is unreachable code in the hcapi/ and tf_core/ files
imported from the vendor. Those are listed in sources rather than
base_sources, so they are not built separately and the exemption
has to apply to the whole driver.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/bnxt/meson.build | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/bnxt/meson.build b/drivers/net/bnxt/meson.build
index 67bfd3f79b..f183237899 100644
--- a/drivers/net/bnxt/meson.build
+++ b/drivers/net/bnxt/meson.build
@@ -66,3 +66,6 @@ elif arch_subdir == 'arm' and dpdk_conf.get('RTE_ARCH_64')
endif
annotate_locks = false
+
+# hcapi/ and tf_core/ code has unreachable code
+cflags += no_unreachable_cflag
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 30/37] net/ntnic: disable unreachable code check
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (28 preceding siblings ...)
2026-11-30 0:27 ` [PATCH 29/37] net/bnxt: disable unreachable code check Stephen Hemminger
@ 2026-11-30 0:27 ` Stephen Hemminger
2026-11-30 0:27 ` [PATCH 31/37] lib: mark never returning thread functions Stephen Hemminger
` (6 subsequent siblings)
36 siblings, 0 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Christian Koue Muf, Serhii Iliushyk
There is unreachable code in the nthw/ files imported from the
vendor. Those are listed in sources rather than base_sources, so
they are not built separately and the exemption has to apply to
the whole driver.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/ntnic/meson.build | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build
index 60688c8aaf..3bed975b73 100644
--- a/drivers/net/ntnic/meson.build
+++ b/drivers/net/ntnic/meson.build
@@ -131,3 +131,6 @@ sources = files(
# Suppress shadow warnings for this driver due to extensive variable shadowing
cflags += no_shadow_cflag
+
+# nthw/ code has unreachable code
+cflags += no_unreachable_cflag
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 31/37] lib: mark never returning thread functions
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (29 preceding siblings ...)
2026-11-30 0:27 ` [PATCH 30/37] net/ntnic: " Stephen Hemminger
@ 2026-11-30 0:27 ` Stephen Hemminger
2026-11-30 9:44 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 32/37] lib: remove unreachable statements Stephen Hemminger
` (5 subsequent siblings)
36 siblings, 1 reply; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:27 UTC (permalink / raw)
To: dev
Cc: Stephen Hemminger, Abhinandan Gujjar, Jerin Jacob,
Maxime Coquelin, Chenbo Xia
rxa_intr_thread() and vhost_user_client_reconnect() loop forever,
so the return after the loop can never be reached and clang
reports it with -Wunreachable-code-aggressive.
Removing the return is not enough: GCC does not notice that the
loop never exits and warns that a non void function has no return
statement. Mark both functions __rte_noreturn instead, which is
what they are, and drop the dead return.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/eventdev/rte_event_eth_rx_adapter.c | 4 +---
lib/vhost/socket.c | 4 +---
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index 26c0a26db1..ba264d0ba0 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -1163,7 +1163,7 @@ rxa_intr_ring_del_entries(struct event_eth_rx_adapter *rx_adapter,
* These events are picked up by rxa_intr_ring_dequeue() which is invoked from
* the adapter service function.
*/
-static uint32_t
+static __rte_noreturn uint32_t
rxa_intr_thread(void *arg)
{
struct event_eth_rx_adapter *rx_adapter = arg;
@@ -1181,8 +1181,6 @@ rxa_intr_thread(void *arg)
epoll_events[i].epdata.data);
}
}
-
- return 0;
}
/* Dequeue <port, q> from interrupt ring and enqueue received
diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c
index 2d3fe1fd53..dd32bb69e2 100644
--- a/lib/vhost/socket.c
+++ b/lib/vhost/socket.c
@@ -446,7 +446,7 @@ vhost_user_connect_nonblock(char *path, int fd, struct sockaddr *un, size_t sz)
return 0;
}
-static uint32_t
+static __rte_noreturn uint32_t
vhost_user_client_reconnect(void *arg __rte_unused)
{
int ret;
@@ -486,8 +486,6 @@ vhost_user_client_reconnect(void *arg __rte_unused)
pthread_mutex_unlock(&reconn_list.mutex);
sleep(1);
}
-
- return 0;
}
static int
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 32/37] lib: remove unreachable statements
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (30 preceding siblings ...)
2026-11-30 0:27 ` [PATCH 31/37] lib: mark never returning thread functions Stephen Hemminger
@ 2026-11-30 0:27 ` Stephen Hemminger
2026-11-30 0:27 ` [PATCH 33/37] app: " Stephen Hemminger
` (4 subsequent siblings)
36 siblings, 0 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:27 UTC (permalink / raw)
To: dev
Cc: Stephen Hemminger, Yipeng Wang, Vladimir Medvedkin,
Cristian Dumitrescu, Maxime Coquelin, Chenbo Xia
Clang with -Wunreachable-code-aggressive reports break statements
after a return and returns after a switch where every case
returns.
Remove them. Extra defensive code does not help: with the trailing
return gone, adding a case that forgets to return becomes a
compiler error instead of silently returning zero.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/cmdline/cmdline_parse_num.c | 2 --
lib/efd/rte_efd.c | 6 ------
lib/fib/rte_fib.c | 1 -
lib/fib/rte_fib6.c | 1 -
lib/sched/rte_sched.c | 1 -
lib/vhost/vhost_crypto.c | 1 -
6 files changed, 12 deletions(-)
diff --git a/lib/cmdline/cmdline_parse_num.c b/lib/cmdline/cmdline_parse_num.c
index 4cfc900391..ab2a55eb82 100644
--- a/lib/cmdline/cmdline_parse_num.c
+++ b/lib/cmdline/cmdline_parse_num.c
@@ -285,7 +285,6 @@ cmdline_parse_num(cmdline_parse_token_hdr_t *tk, const char *srcbuf, void *res,
} else {
return -1;
}
- break;
case DEC_NEG_OK:
if (nd.type == RTE_INT8 &&
@@ -307,7 +306,6 @@ cmdline_parse_num(cmdline_parse_token_hdr_t *tk, const char *srcbuf, void *res,
} else {
return -1;
}
- break;
default:
debug_printf("error\n");
return -1;
diff --git a/lib/efd/rte_efd.c b/lib/efd/rte_efd.c
index 4dfc0ec9a4..9d5969e151 100644
--- a/lib/efd/rte_efd.c
+++ b/lib/efd/rte_efd.c
@@ -1286,8 +1286,6 @@ efd_lookup_internal(const struct efd_online_group_entry * const group,
const uint32_t hash_val_a, const uint32_t hash_val_b,
enum efd_lookup_internal_function lookup_fn)
{
- efd_value_t value = 0;
-
switch (lookup_fn) {
#if defined(RTE_ARCH_X86)
@@ -1296,7 +1294,6 @@ efd_lookup_internal(const struct efd_online_group_entry * const group,
group->lookup_table,
hash_val_a,
hash_val_b);
- break;
#endif
#if defined(RTE_ARCH_ARM64)
case EFD_LOOKUP_NEON:
@@ -1304,7 +1301,6 @@ efd_lookup_internal(const struct efd_online_group_entry * const group,
group->lookup_table,
hash_val_a,
hash_val_b);
- break;
#endif
case EFD_LOOKUP_SCALAR:
/* Fall-through */
@@ -1314,8 +1310,6 @@ efd_lookup_internal(const struct efd_online_group_entry * const group,
hash_val_a,
hash_val_b);
}
-
- return value;
}
RTE_EXPORT_SYMBOL(rte_efd_lookup)
diff --git a/lib/fib/rte_fib.c b/lib/fib/rte_fib.c
index 184210f380..17909f0759 100644
--- a/lib/fib/rte_fib.c
+++ b/lib/fib/rte_fib.c
@@ -115,7 +115,6 @@ init_dataplane(struct rte_fib *fib, __rte_unused int socket_id,
default:
return -EINVAL;
}
- return 0;
}
RTE_EXPORT_SYMBOL(rte_fib_add)
diff --git a/lib/fib/rte_fib6.c b/lib/fib/rte_fib6.c
index 770becdb61..e2cbf0db25 100644
--- a/lib/fib/rte_fib6.c
+++ b/lib/fib/rte_fib6.c
@@ -113,7 +113,6 @@ init_dataplane(struct rte_fib6 *fib, __rte_unused int socket_id,
default:
return -EINVAL;
}
- return 0;
}
RTE_EXPORT_SYMBOL(rte_fib6_add)
diff --git a/lib/sched/rte_sched.c b/lib/sched/rte_sched.c
index daa31e8b99..1f0d99d40b 100644
--- a/lib/sched/rte_sched.c
+++ b/lib/sched/rte_sched.c
@@ -2920,7 +2920,6 @@ grinder_handle(struct rte_sched_port *port,
default:
rte_panic("Algorithmic error (invalid state)\n");
- return 0;
}
}
diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
index 38a7bd75d6..da59d84126 100644
--- a/lib/vhost/vhost_crypto.c
+++ b/lib/vhost/vhost_crypto.c
@@ -107,7 +107,6 @@ cipher_algo_transform(uint32_t virtio_cipher_algo,
break;
default:
return -VIRTIO_CRYPTO_BADMSG;
- break;
}
return 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 33/37] app: remove unreachable statements
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (31 preceding siblings ...)
2026-11-30 0:27 ` [PATCH 32/37] lib: remove unreachable statements Stephen Hemminger
@ 2026-11-30 0:27 ` Stephen Hemminger
2026-11-30 0:27 ` [PATCH 34/37] examples: " Stephen Hemminger
` (3 subsequent siblings)
36 siblings, 0 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:27 UTC (permalink / raw)
To: dev
Cc: Stephen Hemminger, Reshma Pattan, Kai Ji, Wisam Jaddo,
Elena Agostini, Aman Singh, Ori Kam, Anoob Joseph, Akhil Goyal,
Fan Zhang
Clang with -Wunreachable-code-aggressive reports break statements
after a return or rte_exit(), and returns after a switch where
every case returns.
Remove them. Extra defensive code does not help: with the trailing
return gone, adding a case that forgets to return becomes a
compiler error instead of silently returning zero.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
app/dumpcap/main.c | 1 -
app/pdump/main.c | 1 -
app/test-compress-perf/comp_perf_options_parse.c | 1 -
app/test-crypto-perf/cperf_ops.c | 1 -
app/test-crypto-perf/cperf_options_parsing.c | 1 -
app/test-flow-perf/main.c | 1 -
app/test-gpudev/main.c | 1 -
app/test-pmd/parameters.c | 2 --
app/test-regex/main.c | 2 --
app/test-security-perf/test_security_perf.c | 1 -
app/test/test_cryptodev.c | 9 ---------
app/test/test_cryptodev_crosscheck.c | 6 ------
app/test/test_eal_flags.c | 1 -
13 files changed, 28 deletions(-)
diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c
index 47483535fc..32bb65a97a 100644
--- a/app/dumpcap/main.c
+++ b/app/dumpcap/main.c
@@ -401,7 +401,6 @@ static void parse_opts(int argc, char **argv)
case 'b':
rte_exit(EXIT_FAILURE,
"multiple files not implemented\n");
- break;
case 'c':
stop.packets = get_uint(optarg, "packet_count", 0);
break;
diff --git a/app/pdump/main.c b/app/pdump/main.c
index 1f6135b20e..6f33b777d9 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -617,7 +617,6 @@ configure_vdev(uint16_t port_id)
rte_exit(EXIT_FAILURE,
"promiscuous mode enable failed: %s\n",
rte_strerror(-ret));
- return ret;
}
return 0;
diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-compress-perf/comp_perf_options_parse.c
index 16d31c7e90..3cb8dbdd7f 100644
--- a/app/test-compress-perf/comp_perf_options_parse.c
+++ b/app/test-compress-perf/comp_perf_options_parse.c
@@ -709,7 +709,6 @@ comp_perf_options_parse(struct comp_test_data *test_data, int argc, char **argv)
case 'h':
usage(argv[0]);
exit(EXIT_SUCCESS);
- break;
/* long options */
case 0:
retval = comp_perf_opts_parse_long(opt_idx, test_data);
diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c
index 1c8d1e263a..68432755f5 100644
--- a/app/test-crypto-perf/cperf_ops.c
+++ b/app/test-crypto-perf/cperf_ops.c
@@ -122,7 +122,6 @@ cperf_set_ops_asym_ecdsa(struct rte_crypto_op **ops,
default:
rte_panic("Unsupported ECDSA operation type %d\n",
options->op_type);
- break;
}
asym_op->ecdsa.message.data = ecdsa_curve_data->message.data;
diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c
index b1b0abbcbc..61ce3af7e4 100644
--- a/app/test-crypto-perf/cperf_options_parsing.c
+++ b/app/test-crypto-perf/cperf_options_parsing.c
@@ -1258,7 +1258,6 @@ cperf_options_parse(struct cperf_options *options, int argc, char **argv)
case 'h':
usage(argv[0]);
exit(EXIT_SUCCESS);
- break;
/* long options */
case 0:
retval = cperf_opts_parse_long(opt_idx, options);
diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c
index 6636d1517f..c529f55c73 100644
--- a/app/test-flow-perf/main.c
+++ b/app/test-flow-perf/main.c
@@ -986,7 +986,6 @@ args_parse(int argc, char **argv)
usage(argv[0]);
rte_exit(EXIT_FAILURE, "Invalid option: %s\n",
argv[optind - 1]);
- break;
}
}
if (rules_count % rules_batch != 0) {
diff --git a/app/test-gpudev/main.c b/app/test-gpudev/main.c
index f065e6cd81..4bf0c1a09d 100644
--- a/app/test-gpudev/main.c
+++ b/app/test-gpudev/main.c
@@ -57,7 +57,6 @@ args_parse(int argc, char **argv)
default:
usage(argv[0]);
rte_exit(EXIT_FAILURE, "Invalid option: %s\n", argv[optind]);
- break;
}
}
}
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 9967e49881..0668c7d240 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -975,7 +975,6 @@ launch_args_parse(int argc, char** argv)
case 'h':
usage(argv[0]);
exit(EXIT_SUCCESS);
- break;
case TESTPMD_OPT_CMDLINE_FILE_NUM:
case TESTPMD_OPT_CMDLINE_FILE_NOECHO_NUM:
if (cmdline_file_count >= RTE_DIM(cmdline_files)) {
@@ -1797,7 +1796,6 @@ launch_args_parse(int argc, char** argv)
fprintf(stderr, "Invalid option: %s\n", argv[optind - 1]);
rte_exit(EXIT_FAILURE,
"Command line is incomplete or incorrect\n");
- break;
}
}
diff --git a/app/test-regex/main.c b/app/test-regex/main.c
index 81719f2e04..a27a9b73b7 100644
--- a/app/test-regex/main.c
+++ b/app/test-regex/main.c
@@ -173,7 +173,6 @@ args_parse(int argc, char **argv, char *rules_file, char *data_file,
default:
usage(argv[0]);
rte_exit(EXIT_FAILURE, "Invalid option: %s\n", argv[optind]);
- break;
}
}
@@ -530,7 +529,6 @@ run_regex(void *args)
default:
rte_exit(EXIT_FAILURE,
"Invalid match mode value\n");
- break;
}
pos += act_job_len;
actual_jobs++;
diff --git a/app/test-security-perf/test_security_perf.c b/app/test-security-perf/test_security_perf.c
index dd377a6027..4dc3c117eb 100644
--- a/app/test-security-perf/test_security_perf.c
+++ b/app/test-security-perf/test_security_perf.c
@@ -464,7 +464,6 @@ args_parse(int argc, char **argv)
usage(argv[0]);
rte_exit(EXIT_FAILURE, "Invalid option: %s\n",
argv[opt_idx - 1]);
- break;
}
}
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index eb955766bc..8086377f19 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -3759,8 +3759,6 @@ test_snow3g_authentication_verify(const struct snow3g_hash_test_data *tdata)
return 0;
else
return -1;
-
- return 0;
}
static int
@@ -3939,8 +3937,6 @@ test_kasumi_authentication_verify(const struct kasumi_hash_test_data *tdata)
return 0;
else
return -1;
-
- return 0;
}
static int
@@ -3983,7 +3979,6 @@ static int
test_snow3g_hash_verify_test_case_1(void)
{
return test_snow3g_authentication_verify(&snow3g_hash_test_case_1);
-
}
static int
@@ -6879,8 +6874,6 @@ test_zuc_authentication(const struct wireless_test_data *tdata,
return 0;
else
return -1;
-
- return 0;
}
static int
@@ -20097,8 +20090,6 @@ test_NIA_helper(const void *td)
return 0;
else
return -1;
-
- return 0;
}
static int
diff --git a/app/test/test_cryptodev_crosscheck.c b/app/test/test_cryptodev_crosscheck.c
index bb21c3bc50..e3cb15737a 100644
--- a/app/test/test_cryptodev_crosscheck.c
+++ b/app/test/test_cryptodev_crosscheck.c
@@ -152,7 +152,6 @@ profile_create(const struct rte_cryptodev_symmetric_capability *capa,
break;
default:
rte_panic("Wrong capability profile type: %i\n", capability_type);
- break;
}
break;
case RTE_CRYPTO_SYM_XFORM_CIPHER:
@@ -171,7 +170,6 @@ profile_create(const struct rte_cryptodev_symmetric_capability *capa,
break;
default:
rte_panic("Wrong capability profile type: %i\n", capability_type);
- break;
}
break;
case RTE_CRYPTO_SYM_XFORM_AEAD:
@@ -193,12 +191,10 @@ profile_create(const struct rte_cryptodev_symmetric_capability *capa,
break;
default:
rte_panic("Wrong capability profile type: %i\n", capability_type);
- break;
}
break;
default:
rte_panic("Wrong xform profile type: %i\n", capa->xform_type);
- break;
}
profile.input_buf_len = RTE_ALIGN_CEIL(input_len, profile.block_size);
@@ -254,7 +250,6 @@ sym_capability_to_idx(const struct rte_cryptodev_symmetric_capability *cap)
break;
default:
rte_panic("Wrong capability profile type: %i\n", cap_idx.type);
- break;
}
return cap_idx;
@@ -457,7 +452,6 @@ crosscheck_init(void)
break;
default:
rte_panic("Wrong capability profile type: %i\n", cap->xform_type);
- break;
}
}
diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c
index dcfdc42eca..b059f5d929 100644
--- a/app/test/test_eal_flags.c
+++ b/app/test/test_eal_flags.c
@@ -214,7 +214,6 @@ process_hugefiles(const char *prefix, enum hugepage_action action)
result = 1;
goto end;
}
- break;
case HUGEPAGE_DELETE:
{
char file_path[PATH_MAX];
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 34/37] examples: remove unreachable statements
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (32 preceding siblings ...)
2026-11-30 0:27 ` [PATCH 33/37] app: " Stephen Hemminger
@ 2026-11-30 0:27 ` Stephen Hemminger
2026-11-30 9:45 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 35/37] drivers: " Stephen Hemminger
` (2 subsequent siblings)
36 siblings, 1 reply; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:27 UTC (permalink / raw)
To: dev
Cc: Stephen Hemminger, Chas Williams, Min Hu (Connor), Jingjing Wu,
Bhagyada Modali, Raghavendra Ningoji, Maxime Coquelin, Chenbo Xia
Clang with -Wunreachable-code-aggressive reports break and return
statements after rte_exit(), which does not return.
Remove them.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
examples/bond/main.c | 1 -
examples/l2fwd-jobstats/main.c | 2 --
examples/l3fwd/main.c | 4 ----
examples/ntb/ntb_fwd.c | 1 -
examples/vhost/main.c | 4 +---
5 files changed, 1 insertion(+), 11 deletions(-)
diff --git a/examples/bond/main.c b/examples/bond/main.c
index 99359cd6fb..1d11a6687d 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -292,7 +292,6 @@ bond_port_init(void)
rte_exit(EXIT_FAILURE,
"port %u: promiscuous mode enable failed: %s\n",
BOND_PORT, rte_strerror(-retval));
- return;
}
struct rte_ether_addr addr;
diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c
index f654831897..e6c0cfddc9 100644
--- a/examples/l2fwd-jobstats/main.c
+++ b/examples/l2fwd-jobstats/main.c
@@ -949,8 +949,6 @@ main(int argc, char **argv)
rte_exit(EXIT_FAILURE,
"rte_eth_promiscuous_enable:err=%s, port=%u\n",
rte_strerror(-ret), portid);
- return ret;
-
}
printf("Port %u, MAC address: " RTE_ETHER_ADDR_PRT_FMT "\n\n",
diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index 5d061a1cf7..f7e6ac7eec 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -619,8 +619,6 @@ parse_queue_size(const char *queue_size_arg, uint16_t *queue_size, int rx)
rte_exit(EXIT_FAILURE, "Invalid rx-queue-size\n");
else
rte_exit(EXIT_FAILURE, "Invalid tx-queue-size\n");
-
- return;
}
if (value > UINT16_MAX) {
@@ -630,8 +628,6 @@ parse_queue_size(const char *queue_size_arg, uint16_t *queue_size, int rx)
else
rte_exit(EXIT_FAILURE, "tx-queue-size %lu > %d\n",
value, UINT16_MAX);
-
- return;
}
*queue_size = value;
diff --git a/examples/ntb/ntb_fwd.c b/examples/ntb/ntb_fwd.c
index a53e8aae24..075ad355f0 100644
--- a/examples/ntb/ntb_fwd.c
+++ b/examples/ntb/ntb_fwd.c
@@ -1081,7 +1081,6 @@ ntb_parse_args(int argc, char **argv)
ntb_usage(prgname);
rte_exit(EXIT_FAILURE,
"Command line is incomplete or incorrect.\n");
- break;
}
}
}
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index e7434fd189..b1ad7ac676 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -1431,7 +1431,7 @@ static const struct rte_vhost_device_ops virtio_net_device_ops =
* This is a thread will wake up after a period to print stats if the user has
* enabled them.
*/
-static uint32_t
+static __rte_noreturn uint32_t
print_stats(__rte_unused void *arg)
{
struct vhost_dev *vdev;
@@ -1475,8 +1475,6 @@ print_stats(__rte_unused void *arg)
fflush(stdout);
}
-
- return 0;
}
static void
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 35/37] drivers: remove unreachable statements
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (33 preceding siblings ...)
2026-11-30 0:27 ` [PATCH 34/37] examples: " Stephen Hemminger
@ 2026-11-30 0:27 ` Stephen Hemminger
2026-11-30 10:59 ` Dariusz Sosnowski
2026-11-30 0:27 ` [PATCH 36/37] efd: mark configuration dependent vector selection Stephen Hemminger
2026-11-30 0:27 ` [PATCH 37/37] config: enable unreachable code detection Stephen Hemminger
36 siblings, 1 reply; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:27 UTC (permalink / raw)
To: dev
Cc: Stephen Hemminger, Nithin Dabilpuram, Kiran Kumar K,
Sunil Kumar Kori, Satha Rao, Harman Kalra, Dariusz Sosnowski,
Viacheslav Ovsiienko, Bing Zhao, Ori Kam, Suanming Mou,
Matan Azrad, Gagandeep Singh, Hemant Agrawal, Kai Ji,
Sachin Saxena, Mattias Rönnblom, Srikanth Yalavarthi,
Julien Aube, Rosen Xu, Andrew Rybchenko
Clang with -Wunreachable-code-aggressive reports break statements
after a return or rte_panic(), and returns after a switch where
every case returns.
Remove them. Extra defensive code does not help: with the trailing
return gone, adding a case that forgets to return becomes a
compiler error instead of silently returning zero.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/common/cnxk/roc_nix_fc.c | 2 --
drivers/common/mlx5/linux/mlx5_nl.c | 1 -
drivers/crypto/caam_jr/caam_jr.c | 1 -
drivers/crypto/openssl/rte_openssl_pmd.c | 1 -
drivers/dma/dpaa/dpaa_qdma.c | 2 --
drivers/event/dsw/dsw_xstats.c | 1 -
drivers/ml/cnxk/cnxk_ml_ops.c | 10 ----------
drivers/net/bnx2x/bnx2x.c | 2 --
drivers/net/cnxk/cnxk_ethdev_mtr.c | 3 ---
drivers/net/intel/ipn3ke/ipn3ke_representor.c | 3 ---
drivers/net/intel/ipn3ke/ipn3ke_tm.c | 1 -
drivers/net/mlx5/linux/mlx5_mp_os.c | 1 -
drivers/net/mlx5/mlx5_flow_dv.c | 1 -
drivers/net/mlx5/mlx5_flow_flex.c | 1 -
drivers/net/mlx5/mlx5_flow_hw.c | 1 -
drivers/net/sfc/sfc_mae.c | 2 --
drivers/vdpa/ifc/ifcvf_vdpa.c | 4 ----
drivers/vdpa/mlx5/mlx5_vdpa_cthread.c | 1 -
drivers/vdpa/mlx5/mlx5_vdpa_event.c | 2 --
drivers/vdpa/nfp/nfp_vdpa.c | 5 -----
20 files changed, 45 deletions(-)
diff --git a/drivers/common/cnxk/roc_nix_fc.c b/drivers/common/cnxk/roc_nix_fc.c
index 8164a2ba0e..c0ba4c39ed 100644
--- a/drivers/common/cnxk/roc_nix_fc.c
+++ b/drivers/common/cnxk/roc_nix_fc.c
@@ -550,8 +550,6 @@ nix_rx_chan_multi_bpid_cfg(struct roc_nix *roc_nix, uint8_t chan, uint16_t bpid,
} else {
return roc_nix_chan_bpid_set(roc_nix, chan, bpid, 1, false);
}
-
- return 0;
}
#define NIX_BPID_INVALID 0xFFFF
diff --git a/drivers/common/mlx5/linux/mlx5_nl.c b/drivers/common/mlx5/linux/mlx5_nl.c
index cc33a9231f..a169bd8387 100644
--- a/drivers/common/mlx5/linux/mlx5_nl.c
+++ b/drivers/common/mlx5/linux/mlx5_nl.c
@@ -2061,7 +2061,6 @@ mlx5_nl_read_events(int nlsk_fd, mlx5_nl_event_cb *cb, void *cb_arg)
size -= aligned_len;
}
}
- return 0;
}
static int
diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c
index 01a9bed1ff..a77f1fed31 100644
--- a/drivers/crypto/caam_jr/caam_jr.c
+++ b/drivers/crypto/caam_jr/caam_jr.c
@@ -593,7 +593,6 @@ hw_poll_job_ring(struct sec_job_ring_t *job_ring,
false_alarm, real_poll,
sec_error_code, job_ring->cidx);
rte_panic("CAAM JR descriptor NULL");
- return notified_descs_no;
}
current_desc = (struct job_descriptor *)
caam_jr_dma_ptov(current_desc_addr);
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index 8791186fec..3ae8ecf6ac 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -670,7 +670,6 @@ openssl_set_session_auth_parameters(struct openssl_session *sess,
xform->auth.digest_length,
xform->auth.key.data,
&sess->cipher.ctx);
- break;
case RTE_CRYPTO_AUTH_MD5:
case RTE_CRYPTO_AUTH_SHA1:
diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c
index d8bece700a..47e925afab 100644
--- a/drivers/dma/dpaa/dpaa_qdma.c
+++ b/drivers/dma/dpaa/dpaa_qdma.c
@@ -708,8 +708,6 @@ fsl_qdma_enqueue_overflow(struct fsl_qdma_queue *fsl_queue)
check_num = 0;
}
goto overflow_check;
-
- return 0;
}
static int
diff --git a/drivers/event/dsw/dsw_xstats.c b/drivers/event/dsw/dsw_xstats.c
index f61dfd80a8..71c3aa6670 100644
--- a/drivers/event/dsw/dsw_xstats.c
+++ b/drivers/event/dsw/dsw_xstats.c
@@ -326,7 +326,6 @@ dsw_xstats_get(const struct rte_eventdev *dev,
RTE_ASSERT(false);
return -1;
}
- return 0;
}
struct find_ctx {
diff --git a/drivers/ml/cnxk/cnxk_ml_ops.c b/drivers/ml/cnxk/cnxk_ml_ops.c
index dc05764306..e249fc0ed9 100644
--- a/drivers/ml/cnxk/cnxk_ml_ops.c
+++ b/drivers/ml/cnxk/cnxk_ml_ops.c
@@ -281,8 +281,6 @@ cnxk_ml_dev_xstat_get(struct cnxk_ml_dev *cnxk_mldev, uint16_t obj_idx __rte_unu
default:
return -1;
}
-
- return 0;
}
static uint64_t
@@ -485,8 +483,6 @@ cnxk_ml_dev_info_get(struct rte_ml_dev *dev, struct rte_ml_dev_info *dev_info)
return cn10k_ml_dev_info_get(cnxk_mldev, dev_info);
else
return mvtvm_ml_dev_info_get(cnxk_mldev, dev_info);
-
- return 0;
}
static int
@@ -815,8 +811,6 @@ cnxk_ml_dev_dump(struct rte_ml_dev *dev, FILE *fp)
return cn10k_ml_dev_dump(cnxk_mldev, fp);
else
return mvtvm_ml_dev_dump(cnxk_mldev, fp);
-
- return 0;
}
static int
@@ -1344,8 +1338,6 @@ cnxk_ml_model_start(struct rte_ml_dev *dev, uint16_t model_id)
return cn10k_ml_model_start(cnxk_mldev, model);
else
return tvmrt_ml_model_start(cnxk_mldev, model);
-
- return 0;
}
int
@@ -1369,8 +1361,6 @@ cnxk_ml_model_stop(struct rte_ml_dev *dev, uint16_t model_id)
return cn10k_ml_model_stop(cnxk_mldev, model);
else
return tvmrt_ml_model_stop(cnxk_mldev, model);
-
- return 0;
}
static int
diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index 2924fed66b..8024d921fe 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -1397,7 +1397,6 @@ static void bnx2x_drain_tx_queues(struct bnx2x_softc *sc)
"Timeout waiting for fp[%d] "
"transmits to complete!", i);
rte_panic("tx drain failure");
- return;
}
count--;
@@ -10938,7 +10937,6 @@ bnx2x_send_final_clnup(struct bnx2x_softc *sc, uint8_t clnup_func,
PMD_DRV_LOG(DEBUG, sc, "At timeout completion address contained %x",
(REG_RD(sc, comp_addr)));
rte_panic("FLR cleanup failed");
- return -1;
}
/* Zero completion for nxt FLR */
diff --git a/drivers/net/cnxk/cnxk_ethdev_mtr.c b/drivers/net/cnxk/cnxk_ethdev_mtr.c
index 992e2d446e..e20196da1d 100644
--- a/drivers/net/cnxk/cnxk_ethdev_mtr.c
+++ b/drivers/net/cnxk/cnxk_ethdev_mtr.c
@@ -302,7 +302,6 @@ update_mtr_err(uint32_t act_color, struct rte_mtr_error *error, bool action)
str = "Green action is null";
goto notvalid;
}
- break;
case RTE_COLOR_YELLOW:
if (action) {
str = "Yellow action is not valid";
@@ -311,7 +310,6 @@ update_mtr_err(uint32_t act_color, struct rte_mtr_error *error, bool action)
str = "Yellow action is null";
goto notvalid;
}
- break;
case RTE_COLOR_RED:
if (action) {
str = "Red action is not valid";
@@ -320,7 +318,6 @@ update_mtr_err(uint32_t act_color, struct rte_mtr_error *error, bool action)
str = "Red action is null";
goto notvalid;
}
- break;
}
notsup:
return -rte_mtr_error_set(error, ENOTSUP,
diff --git a/drivers/net/intel/ipn3ke/ipn3ke_representor.c b/drivers/net/intel/ipn3ke/ipn3ke_representor.c
index 05aad6cd15..ee9a3844e3 100644
--- a/drivers/net/intel/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/intel/ipn3ke/ipn3ke_representor.c
@@ -672,7 +672,6 @@ uint32_t addr_hi, struct ipn3ke_hw *hw, uint16_t port_id)
statistics = statistics << IPN3KE_REGISTER_WIDTH;
statistics += statistics_lo;
return statistics;
-
}
static int
@@ -2587,8 +2586,6 @@ ipn3ke_rpst_scan_handle_request(__rte_unused void *param)
if (num == 0 || num == 0xffffff)
return 0;
}
-
- return 0;
}
static int
diff --git a/drivers/net/intel/ipn3ke/ipn3ke_tm.c b/drivers/net/intel/ipn3ke/ipn3ke_tm.c
index 47b7734d4f..166ada60b9 100644
--- a/drivers/net/intel/ipn3ke/ipn3ke_tm.c
+++ b/drivers/net/intel/ipn3ke/ipn3ke_tm.c
@@ -600,7 +600,6 @@ ipn3ke_tm_level_capabilities_get(struct rte_eth_dev *dev,
RTE_TM_ERROR_TYPE_LEVEL_ID,
NULL,
rte_strerror(EINVAL));
- break;
}
return 0;
diff --git a/drivers/net/mlx5/linux/mlx5_mp_os.c b/drivers/net/mlx5/linux/mlx5_mp_os.c
index ca7b1cfa97..9db9b61feb 100644
--- a/drivers/net/mlx5/linux/mlx5_mp_os.c
+++ b/drivers/net/mlx5/linux/mlx5_mp_os.c
@@ -59,7 +59,6 @@ mlx5_mp_os_handle_port_agnostic(const struct rte_mp_msg *mp_msg,
default:
return 1;
}
- return -1;
}
int
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 9cb7c59b83..9fdb0279ff 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -5015,7 +5015,6 @@ mlx5_flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf,
RTE_FLOW_ERROR_TYPE_ACTION,
(void *)items->type,
"unsupported item type");
- break;
}
temp_size += len;
}
diff --git a/drivers/net/mlx5/mlx5_flow_flex.c b/drivers/net/mlx5/mlx5_flow_flex.c
index baa5ddd977..f7f9ebb833 100644
--- a/drivers/net/mlx5/mlx5_flow_flex.c
+++ b/drivers/net/mlx5/mlx5_flow_flex.c
@@ -634,7 +634,6 @@ mlx5_flex_translate_next(struct mlx5_hca_flex_attr *attr,
return rte_flow_error_set
(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, NULL,
"unsupported next protocol field mode (OFFSET)");
- break;
case FIELD_MODE_BITMASK:
return rte_flow_error_set
(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, NULL,
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 62482c911d..e2ed9c89fa 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -723,7 +723,6 @@ mlx5_flow_hw_action_flags_get(const struct rte_flow_action actions[],
default:
goto error;
}
- break;
case RTE_FLOW_ACTION_TYPE_DROP:
action_flags |= MLX5_FLOW_ACTION_DROP;
break;
diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c
index b0e8b02b41..363bf45f42 100644
--- a/drivers/net/sfc/sfc_mae.c
+++ b/drivers/net/sfc/sfc_mae.c
@@ -4448,8 +4448,6 @@ sfc_mae_rule_parse_action_count(struct sfc_adapter *sa,
return sfc_mae_counter_add(sa, &counter_tmp, counterp);
- return 0;
-
fail_populate_count:
fail_more_than_one:
fail_no_service_core:
diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
index 508174ad39..835a1668d7 100644
--- a/drivers/vdpa/ifc/ifcvf_vdpa.c
+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
@@ -553,8 +553,6 @@ notify_relay(void *arg)
ifcvf_notify_queue(hw, qid);
}
}
-
- return 0;
}
static int
@@ -998,8 +996,6 @@ vring_relay(void *arg)
ifcvf_notify_queue(&internal->hw, qid);
}
}
-
- return 0;
}
static int
diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_cthread.c b/drivers/vdpa/mlx5/mlx5_vdpa_cthread.c
index 84f611c1ab..978b1dce2a 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_cthread.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_cthread.c
@@ -225,7 +225,6 @@ mlx5_vdpa_c_thread_handle(void *arg)
rte_atomic_fetch_sub_explicit(task.remaining_cnt,
1, rte_memory_order_relaxed);
}
- return 0;
}
static void
diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_event.c b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
index d18cf7d7e5..7deb429f2c 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_event.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
@@ -332,7 +332,6 @@ mlx5_vdpa_event_handle(void *arg)
}
mlx5_vdpa_timer_sleep(priv, max);
}
- return 0;
case MLX5_VDPA_EVENT_MODE_ONLY_INTERRUPT:
do {
virtq = mlx5_vdpa_event_wait(priv);
@@ -344,7 +343,6 @@ mlx5_vdpa_event_handle(void *arg)
pthread_mutex_unlock(&virtq->virtq_lock);
}
} while (1);
- return 0;
default:
return 0;
}
diff --git a/drivers/vdpa/nfp/nfp_vdpa.c b/drivers/vdpa/nfp/nfp_vdpa.c
index 76d7d616a6..8730398b7d 100644
--- a/drivers/vdpa/nfp/nfp_vdpa.c
+++ b/drivers/vdpa/nfp/nfp_vdpa.c
@@ -483,7 +483,6 @@ nfp_vdpa_stop(struct nfp_vdpa_dev *device,
rte_vhost_set_vring_base(vid, i,
vdpa_hw->vring[i].last_avail_idx,
vdpa_hw->vring[i].last_used_idx);
-
}
static int
@@ -635,8 +634,6 @@ nfp_vdpa_notify_epoll_wait(uint32_t queue_num,
nfp_vdpa_notify_queue(&device->hw, qid);
}
}
-
- return 0;
}
static uint32_t
@@ -841,8 +838,6 @@ nfp_vdpa_vring_epoll_wait(uint32_t queue_num,
}
}
}
-
- return 0;
}
static uint32_t
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 36/37] efd: mark configuration dependent vector selection
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (34 preceding siblings ...)
2026-11-30 0:27 ` [PATCH 35/37] drivers: " Stephen Hemminger
@ 2026-11-30 0:27 ` Stephen Hemminger
2026-11-30 0:27 ` [PATCH 37/37] config: enable unreachable code detection Stephen Hemminger
36 siblings, 0 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Yipeng Wang
The AVX2 and NEON lookup functions are only selected when
RTE_EFD_VALUE_NUM_BITS is large enough to make the vectorised
version worthwhile. That value is a user settable knob documented
in rte_efd.h as being between 1 and 32, and defaults to 8.
At the default the NEON comparison is false, so clang on Arm
reports the assignment as unreachable. The AVX2 comparison is true
at the default but would report the same on a build with
RTE_EFD_VALUE_NUM_BITS of 3 or less.
Parenthesizing the constant tells clang the comparison is
configuration dependent. A preprocessor guard would stop compiling
the selection in the default build, and the generated code is
unchanged either way.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/efd/rte_efd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/efd/rte_efd.c b/lib/efd/rte_efd.c
index 9d5969e151..6c89d3dade 100644
--- a/lib/efd/rte_efd.c
+++ b/lib/efd/rte_efd.c
@@ -659,7 +659,7 @@ rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len,
* For less than 4 bits, scalar function performs better
* than vectorised version
*/
- if (RTE_EFD_VALUE_NUM_BITS > 3
+ if (RTE_EFD_VALUE_NUM_BITS > (3)
&& rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2)
&& rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_256)
table->lookup_fn = EFD_LOOKUP_AVX2;
@@ -670,7 +670,7 @@ rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len,
* For less than or equal to 16 bits, scalar function performs better
* than vectorised version
*/
- if (RTE_EFD_VALUE_NUM_BITS > 16 &&
+ if (RTE_EFD_VALUE_NUM_BITS > (16) &&
rte_cpu_get_flag_enabled(RTE_CPUFLAG_NEON) &&
rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128)
table->lookup_fn = EFD_LOOKUP_NEON;
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH 37/37] config: enable unreachable code detection
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
` (35 preceding siblings ...)
2026-11-30 0:27 ` [PATCH 36/37] efd: mark configuration dependent vector selection Stephen Hemminger
@ 2026-11-30 0:27 ` Stephen Hemminger
36 siblings, 0 replies; 47+ messages in thread
From: Stephen Hemminger @ 2026-11-30 0:27 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Bruce Richardson
All the unreachable code reported by clang has been fixed, or
excluded in the drivers where it is in imported base code, so turn
the check on for the whole tree.
Use -Wunreachable-code-aggressive, which adds
-Wunreachable-code-break and -Wunreachable-code-return to the plain
check. Those two find the dead break after a return and the return
after a switch where every case returns.
Note that only clang implements these warnings. GCC rejects
-Wunreachable-code-aggressive and documents -Wunreachable-code as
doing nothing.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
config/meson.build | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/config/meson.build b/config/meson.build
index 9f501589b7..14c50b501f 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -338,6 +338,7 @@ global_cflags = [
'-Wsign-compare',
'-Wstrict-prototypes',
'-Wundef',
+ '-Wunreachable-code-aggressive',
'-Wwrite-strings',
# globally disabled warnings
@@ -372,8 +373,11 @@ if cc.has_argument('-Wno-shadow')
no_shadow_cflag = '-Wno-shadow'
endif
+# test the positive flag, GCC accepts any unknown -Wno-* option
no_unreachable_cflag = []
-if cc.has_argument('-Wunreachable-code')
+if cc.has_argument('-Wunreachable-code-aggressive')
+ no_unreachable_cflag = '-Wno-unreachable-code-aggressive'
+elif cc.has_argument('-Wunreachable-code')
no_unreachable_cflag = '-Wno-unreachable-code'
endif
--
2.53.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* Re: [PATCH 04/37] eal: silence unreachable code in version string
2026-11-30 0:26 ` [PATCH 04/37] eal: silence unreachable code in version string Stephen Hemminger
@ 2026-11-30 9:13 ` Bruce Richardson
0 siblings, 0 replies; 47+ messages in thread
From: Bruce Richardson @ 2026-11-30 9:13 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev
On Sun, Nov 29, 2026 at 04:26:49PM -0800, Stephen Hemminger wrote:
> rte_version() used "strlen(RTE_VER_SUFFIX) == 0" to detect an empty
> suffix. Clang evaluates strlen of a constant string at compile time
> and then reports the other branch as unreachable code.
>
> Use sizeof instead, which clang treats as a configuration value and
> does not warn about. Note that sizeof of a string literal includes
> the NUL terminator, so the empty string is sizeof 1 rather than 0.
>
> Also fix the indentation of the else.
>
> Bugzilla ID: 2135
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> lib/eal/common/rte_version.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH 21/37] net/ixgbe: disable unreachable code check
2026-11-30 0:27 ` [PATCH 21/37] net/ixgbe: disable unreachable code check Stephen Hemminger
@ 2026-11-30 9:14 ` Bruce Richardson
0 siblings, 0 replies; 47+ messages in thread
From: Bruce Richardson @ 2026-11-30 9:14 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev, Anatoly Burakov, Vladimir Medvedkin
On Sun, Nov 29, 2026 at 04:27:06PM -0800, Stephen Hemminger wrote:
> There is unreachable code in the base/ files imported from the
> vendor. Disable the check for the base code only, using
> base_cflags, so the driver's own sources are still checked.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> drivers/net/intel/ixgbe/meson.build | 3 +++
> 1 file changed, 3 insertions(+)
>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH 26/37] net/e1000: disable unreachable code check for base code
2026-11-30 0:27 ` [PATCH 26/37] net/e1000: disable unreachable code check for base code Stephen Hemminger
@ 2026-11-30 9:14 ` Bruce Richardson
0 siblings, 0 replies; 47+ messages in thread
From: Bruce Richardson @ 2026-11-30 9:14 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev
On Sun, Nov 29, 2026 at 04:27:11PM -0800, Stephen Hemminger wrote:
> There is unreachable code in the base/ files imported from the
> vendor. Disable the check for the base code only, using
> base_cflags, so the driver's own sources are still checked.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> drivers/net/intel/e1000/meson.build | 3 +++
> 1 file changed, 3 insertions(+)
>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH 27/37] net/ice: disable unreachable code check for base code
2026-11-30 0:27 ` [PATCH 27/37] net/ice: " Stephen Hemminger
@ 2026-11-30 9:16 ` Bruce Richardson
0 siblings, 0 replies; 47+ messages in thread
From: Bruce Richardson @ 2026-11-30 9:16 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev, Anatoly Burakov
On Sun, Nov 29, 2026 at 04:27:12PM -0800, Stephen Hemminger wrote:
> There is unreachable code in the base/ files imported from the
> vendor. Disable the check for the base code only, using
> base_cflags, so the driver's own sources are still checked.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> drivers/net/intel/ice/meson.build | 3 +++
> 1 file changed, 3 insertions(+)
>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH 28/37] raw/ifpga: disable unreachable code check for base code
2026-11-30 0:27 ` [PATCH 28/37] raw/ifpga: " Stephen Hemminger
@ 2026-11-30 9:43 ` Bruce Richardson
0 siblings, 0 replies; 47+ messages in thread
From: Bruce Richardson @ 2026-11-30 9:43 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev, Rosen Xu
On Sun, Nov 29, 2026 at 04:27:13PM -0800, Stephen Hemminger wrote:
> There is unreachable code in the base/ files imported from the
> vendor. Add the flag next to the -Wno-comma already disabled for
> that code, so the driver's own sources are still checked.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> drivers/raw/ifpga/base/meson.build | 1 +
> 1 file changed, 1 insertion(+)
>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH 31/37] lib: mark never returning thread functions
2026-11-30 0:27 ` [PATCH 31/37] lib: mark never returning thread functions Stephen Hemminger
@ 2026-11-30 9:44 ` Bruce Richardson
0 siblings, 0 replies; 47+ messages in thread
From: Bruce Richardson @ 2026-11-30 9:44 UTC (permalink / raw)
To: Stephen Hemminger
Cc: dev, Abhinandan Gujjar, Jerin Jacob, Maxime Coquelin, Chenbo Xia
On Sun, Nov 29, 2026 at 04:27:16PM -0800, Stephen Hemminger wrote:
> rxa_intr_thread() and vhost_user_client_reconnect() loop forever,
> so the return after the loop can never be reached and clang
> reports it with -Wunreachable-code-aggressive.
>
> Removing the return is not enough: GCC does not notice that the
> loop never exits and warns that a non void function has no return
> statement. Mark both functions __rte_noreturn instead, which is
> what they are, and drop the dead return.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> lib/eventdev/rte_event_eth_rx_adapter.c | 4 +---
> lib/vhost/socket.c | 4 +---
> 2 files changed, 2 insertions(+), 6 deletions(-)
>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH 34/37] examples: remove unreachable statements
2026-11-30 0:27 ` [PATCH 34/37] examples: " Stephen Hemminger
@ 2026-11-30 9:45 ` Bruce Richardson
0 siblings, 0 replies; 47+ messages in thread
From: Bruce Richardson @ 2026-11-30 9:45 UTC (permalink / raw)
To: Stephen Hemminger
Cc: dev, Chas Williams, Min Hu (Connor), Jingjing Wu, Bhagyada Modali,
Raghavendra Ningoji, Maxime Coquelin, Chenbo Xia
On Sun, Nov 29, 2026 at 04:27:19PM -0800, Stephen Hemminger wrote:
> Clang with -Wunreachable-code-aggressive reports break and return
> statements after rte_exit(), which does not return.
>
> Remove them.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> examples/bond/main.c | 1 -
> examples/l2fwd-jobstats/main.c | 2 --
> examples/l3fwd/main.c | 4 ----
> examples/ntb/ntb_fwd.c | 1 -
> examples/vhost/main.c | 4 +---
> 5 files changed, 1 insertion(+), 11 deletions(-)
>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH 08/37] examples/ipsec-secgw: remove unreachable config error path
2026-11-30 0:26 ` [PATCH 08/37] examples/ipsec-secgw: remove unreachable config error path Stephen Hemminger
@ 2026-11-30 9:52 ` Radu Nicolau
0 siblings, 0 replies; 47+ messages in thread
From: Radu Nicolau @ 2026-11-30 9:52 UTC (permalink / raw)
To: Stephen Hemminger, dev; +Cc: Akhil Goyal
On 30-Nov-26 12:26 AM, Stephen Hemminger wrote:
> Clang reports eight unreachable statements in parse_cfg_file().
> Each error check calls rte_panic() and then does "goto error_exit",
> but rte_panic() does not return, so none of the gotos can be taken
> and the error_exit cleanup block is never entered.
>
> Remove the dead gotos and the orphaned label. Error handling is
> unchanged: rte_panic() still aborts on a bad config file.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
Hi, I already have one for the same issue:
https://patches.dpdk.org/project/dpdk/patch/20261118130951.3254687-1-radu.nicolau@intel.com/
^ permalink raw reply [flat|nested] 47+ messages in thread
* RE: [PATCH 35/37] drivers: remove unreachable statements
2026-11-30 0:27 ` [PATCH 35/37] drivers: " Stephen Hemminger
@ 2026-11-30 10:59 ` Dariusz Sosnowski
0 siblings, 0 replies; 47+ messages in thread
From: Dariusz Sosnowski @ 2026-11-30 10:59 UTC (permalink / raw)
To: Stephen Hemminger, dev@dpdk.org
Cc: Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao,
Harman Kalra, Slava Ovsiienko, Bing Zhao, Ori Kam, Suanming Mou,
Matan Azrad, Gagandeep Singh, Hemant Agrawal, Kai Ji,
Sachin Saxena, Mattias Rönnblom, Srikanth Yalavarthi,
Julien Aube, Rosen Xu, Andrew Rybchenko
> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Monday, November 30, 2026 1:27 AM
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>; Nithin Dabilpuram
> <ndabilpuram@marvell.com>; Kiran Kumar K <kirankumark@marvell.com>;
> Sunil Kumar Kori <skori@marvell.com>; Satha Rao
> <skoteshwar@marvell.com>; Harman Kalra <hkalra@marvell.com>; Dariusz
> Sosnowski <dsosnowski@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Bing Zhao <bingz@nvidia.com>; Ori Kam
> <orika@nvidia.com>; Suanming Mou <suanmingm@nvidia.com>; Matan
> Azrad <matan@nvidia.com>; Gagandeep Singh <g.singh@nxp.com>; Hemant
> Agrawal <hemant.agrawal@nxp.com>; Kai Ji <kai.ji@intel.com>; Sachin
> Saxena <sachin.saxena@nxp.com>; Mattias Rönnblom
> <mattias.ronnblom@ericsson.com>; Srikanth Yalavarthi
> <syalavarthi@marvell.com>; Julien Aube <julien_dpdk@jaube.fr>; Rosen Xu
> <rosen.xu@altera.com>; Andrew Rybchenko
> <andrew.rybchenko@oktetlabs.ru>
> Subject: [PATCH 35/37] drivers: remove unreachable statements
>
> Clang with -Wunreachable-code-aggressive reports break statements after a
> return or rte_panic(), and returns after a switch where every case returns.
>
> Remove them. Extra defensive code does not help: with the trailing return
> gone, adding a case that forgets to return becomes a compiler error instead
> of silently returning zero.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
^ permalink raw reply [flat|nested] 47+ messages in thread
end of thread, other threads:[~2026-11-30 10:59 UTC | newest]
Thread overview: 47+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
2026-11-30 0:26 ` [PATCH 01/37] net/mlx4: fix unreachable code warnings Stephen Hemminger
2026-11-30 0:26 ` [PATCH 02/37] net/mlx5: " Stephen Hemminger
2026-11-30 0:26 ` [PATCH 03/37] eventdev: fix vector adapter instance allocation Stephen Hemminger
2026-11-30 0:26 ` [PATCH 04/37] eal: silence unreachable code in version string Stephen Hemminger
2026-11-30 9:13 ` Bruce Richardson
2026-11-30 0:26 ` [PATCH 05/37] net/dpaa2: remove debug abort in flow destroy Stephen Hemminger
2026-11-30 0:26 ` [PATCH 06/37] app/testpmd: fix unreachable VF traffic error message Stephen Hemminger
2026-11-30 0:26 ` [PATCH 07/37] examples/eventdev_pipeline: remove dead continue Stephen Hemminger
2026-11-30 0:26 ` [PATCH 08/37] examples/ipsec-secgw: remove unreachable config error path Stephen Hemminger
2026-11-30 9:52 ` Radu Nicolau
2026-11-30 0:26 ` [PATCH 09/37] examples/skeleton: handle SIGINT and SIGTERM Stephen Hemminger
2026-11-30 0:26 ` [PATCH 10/37] examples/rxtx_callbacks: " Stephen Hemminger
2026-11-30 0:26 ` [PATCH 11/37] examples/service_cores: " Stephen Hemminger
2026-11-30 0:26 ` [PATCH 12/37] examples/timer: " Stephen Hemminger
2026-11-30 0:26 ` [PATCH 13/37] examples/multi_process: handle SIGINT and SIGTERM in client Stephen Hemminger
2026-11-30 0:26 ` [PATCH 14/37] examples/server_node_efd: handle SIGINT and SIGTERM in node Stephen Hemminger
2026-11-30 0:27 ` [PATCH 15/37] examples/pipeline: handle SIGINT and SIGTERM Stephen Hemminger
2026-11-30 0:27 ` [PATCH 16/37] ethdev: fix unreachable warnings from switch declarations Stephen Hemminger
2026-11-30 0:27 ` [PATCH 17/37] config: add per-directory option for -Wunreachable-code Stephen Hemminger
2026-11-30 0:27 ` [PATCH 18/37] bus/dpaa: exempt this driver from unreachable code detection Stephen Hemminger
2026-11-30 0:27 ` [PATCH 19/37] net/qede: disable unreachable code checks Stephen Hemminger
2026-11-30 0:27 ` [PATCH 20/37] net/txgbe: " Stephen Hemminger
2026-11-30 0:27 ` [PATCH 21/37] net/ixgbe: disable unreachable code check Stephen Hemminger
2026-11-30 9:14 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 22/37] net/ngbe: " Stephen Hemminger
2026-11-30 0:27 ` [PATCH 23/37] net/octeontx: replace unreachable code Stephen Hemminger
2026-11-30 0:27 ` [PATCH 24/37] common/sfc_efx: disable unreachable code check for base code Stephen Hemminger
2026-11-30 0:27 ` [PATCH 25/37] net/dpaa2: check port state before changing TM hierarchy Stephen Hemminger
2026-11-30 0:27 ` [PATCH 26/37] net/e1000: disable unreachable code check for base code Stephen Hemminger
2026-11-30 9:14 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 27/37] net/ice: " Stephen Hemminger
2026-11-30 9:16 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 28/37] raw/ifpga: " Stephen Hemminger
2026-11-30 9:43 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 29/37] net/bnxt: disable unreachable code check Stephen Hemminger
2026-11-30 0:27 ` [PATCH 30/37] net/ntnic: " Stephen Hemminger
2026-11-30 0:27 ` [PATCH 31/37] lib: mark never returning thread functions Stephen Hemminger
2026-11-30 9:44 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 32/37] lib: remove unreachable statements Stephen Hemminger
2026-11-30 0:27 ` [PATCH 33/37] app: " Stephen Hemminger
2026-11-30 0:27 ` [PATCH 34/37] examples: " Stephen Hemminger
2026-11-30 9:45 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 35/37] drivers: " Stephen Hemminger
2026-11-30 10:59 ` Dariusz Sosnowski
2026-11-30 0:27 ` [PATCH 36/37] efd: mark configuration dependent vector selection Stephen Hemminger
2026-11-30 0:27 ` [PATCH 37/37] config: enable unreachable code detection Stephen Hemminger
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.