[DPDK/core Bug 2135] eal: unreachable code warning

Bruce Richardson bruce.richardson at intel.com
Tue Nov 17 18:21:57 CET 2026


On Tue, Nov 17, 2026 at 05:07:54PM +0000, bugzilla at dpdk.org wrote:
> https://bugs.dpdk.org/show_bug.cgi?id=2135
> 
>             Bug ID: 2135
>            Summary: eal: unreachable code warning
>            Product: DPDK
>            Version: 26.11
>           Hardware: All
>                 OS: All
>             Status: UNCONFIRMED
>           Severity: minor
>           Priority: Low
>          Component: core
>           Assignee: dev at dpdk.org
>           Reporter: stephen at networkplumber.org
>   Target Milestone: ---
> 
> Building with clang and -Wunreachable-code finds this:
> 
> [18/3982] Compiling C object lib/librte_eal.a.p/eal_common_rte_version.c.o
> ../lib/eal/common/rte_version.c:40:3: warning: code will never be executed
> [-Wunreachable-code]
>    40 |                 snprintf(version, sizeof(version), "%s %d.%02d.%d",
>       |                 ^~~~~~~~
> ../lib/eal/common/rte_version.c:39:32: note: silence by adding parentheses to
> mark code as explicitly dead
>    39 |         if (strlen(RTE_VER_SUFFIX) == 0)
>       |                                       ^
>       |                                       /* DISABLES CODE */ ( )
> 1 warning generated.
> 
> It can be fixed by adding parens, using sizeof, or useing RTE_VERSION which is
> already built by meson.
> 
Not a bug. The code is correct, but technically one or both branches are
unreachable depending on whether we are at an RC version or not. This
construct with dead code I still view as superior to using #ifdefs on the
SUFFIX. We can't use RTE_VERSION as that's a numeric version number only,
which doesn't include the "rc" part (see definition in rte_version.h).

/Bruce


More information about the dev mailing list