[PATCH 23/23] examples/l3fwd-power: fix shadow variable warnings

Stephen Hemminger stephen at networkplumber.org
Tue Apr 7 05:49:49 CEST 2026


Rename function parameters to avoid shadowing the file-scope
static arrays ipv4_l3fwd_lookup_struct and ipv6_l3fwd_lookup_struct.
The new parameter names ipv4_lookup_struct and ipv6_lookup_struct
match the member names used in struct lcore_conf.

Fixes warnings with -Wshadow for get_ipv4_dst_port (both exact-match
and LPM variants) and get_ipv6_dst_port.

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 examples/l3fwd-power/main.c      | 12 ++++++------
 examples/l3fwd-power/meson.build |  1 -
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 02ec17d799..ff0e61e639 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -552,7 +552,7 @@ print_ipv6_key(struct ipv6_5tuple key)
 
 static inline uint16_t
 get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid,
-		lookup_struct_t * ipv4_l3fwd_lookup_struct)
+		lookup_struct_t *ipv4_lookup_struct)
 {
 	struct ipv4_5tuple key;
 	struct rte_tcp_hdr *tcp;
@@ -585,13 +585,13 @@ get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid,
 	}
 
 	/* Find destination port */
-	ret = rte_hash_lookup(ipv4_l3fwd_lookup_struct, (const void *)&key);
+	ret = rte_hash_lookup(ipv4_lookup_struct, (const void *)&key);
 	return ((ret < 0) ? portid : ipv4_l3fwd_out_if[ret]);
 }
 
 static inline uint16_t
 get_ipv6_dst_port(struct rte_ipv6_hdr *ipv6_hdr, uint16_t portid,
-			lookup_struct_t *ipv6_l3fwd_lookup_struct)
+			lookup_struct_t *ipv6_lookup_struct)
 {
 	struct ipv6_5tuple key;
 	struct rte_tcp_hdr *tcp;
@@ -625,7 +625,7 @@ get_ipv6_dst_port(struct rte_ipv6_hdr *ipv6_hdr, uint16_t portid,
 	}
 
 	/* Find destination port */
-	ret = rte_hash_lookup(ipv6_l3fwd_lookup_struct, (const void *)&key);
+	ret = rte_hash_lookup(ipv6_lookup_struct, (const void *)&key);
 	return ((ret < 0) ? portid : ipv6_l3fwd_out_if[ret]);
 }
 #endif
@@ -633,11 +633,11 @@ get_ipv6_dst_port(struct rte_ipv6_hdr *ipv6_hdr, uint16_t portid,
 #if (APP_LOOKUP_METHOD == APP_LOOKUP_LPM)
 static inline uint16_t
 get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid,
-		lookup_struct_t *ipv4_l3fwd_lookup_struct)
+		lookup_struct_t *ipv4_lookup_struct)
 {
 	uint32_t next_hop;
 
-	return ((rte_lpm_lookup(ipv4_l3fwd_lookup_struct,
+	return ((rte_lpm_lookup(ipv4_lookup_struct,
 			rte_be_to_cpu_32(ipv4_hdr->dst_addr), &next_hop) == 0)?
 			next_hop : portid);
 }
diff --git a/examples/l3fwd-power/meson.build b/examples/l3fwd-power/meson.build
index e45cda86f9..5ff4466cac 100644
--- a/examples/l3fwd-power/meson.build
+++ b/examples/l3fwd-power/meson.build
@@ -13,4 +13,3 @@ sources = files(
         'perf_core.c',
 )
 cflags += no_wvla_cflag
-cflags += no_shadow_cflag
-- 
2.53.0



More information about the dev mailing list