DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH] eal: silence unreachable code warning
Date: Tue, 17 Nov 2026 09:40:59 -0800	[thread overview]
Message-ID: <20261117174059.736244-1-stephen@networkplumber.org> (raw)

Clang evalutes strlen of constant string at compile time, then
complains about unreachable code. Use extra parenthesis to
mark code as explcitly dead.

Bugzilla ID: 2135

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/eal/common/rte_version.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/eal/common/rte_version.c b/lib/eal/common/rte_version.c
index 627b89d4a8..62572428fc 100644
--- a/lib/eal/common/rte_version.c
+++ b/lib/eal/common/rte_version.c
@@ -36,7 +36,9 @@ rte_version(void)
 	static char version[32];
 	if (version[0] != 0)
 		return version;
-	if (strlen(RTE_VER_SUFFIX) == 0)
+
+	/* extra paren to silence unreachable warnings */
+	if ((strlen(RTE_VER_SUFFIX) == 0))
 		snprintf(version, sizeof(version), "%s %d.%02d.%d",
 				RTE_VER_PREFIX,
 				RTE_VER_YEAR,
-- 
2.53.0


             reply	other threads:[~2026-11-17 17:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 17:40 Stephen Hemminger [this message]
2026-11-17 19:17 ` [PATCH] eal: silence unreachable code warning Bruce Richardson
2026-11-17 21:04   ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261117174059.736244-1-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox