[PATCH v2 01/23] examples/ethtool: resolve shadow variable warnings

Stephen Hemminger stephen at networkplumber.org
Tue Apr 7 17:15:57 CEST 2026


Fix shadow variable warning by renaming the function parameter
from 'app_cfg' to 'ptr_cfg' to avoid shadowing the global variable.

../examples/ethtool/ethtool-app/main.c:89:44: warning: declaration of
'app_cfg' shadows a global declaration [-Wshadow]

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
---
 examples/ethtool/ethtool-app/main.c | 4 ++--
 examples/ethtool/meson.build        | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/examples/ethtool/ethtool-app/main.c b/examples/ethtool/ethtool-app/main.c
index b6bbae70d2..6545eb322d 100644
--- a/examples/ethtool/ethtool-app/main.c
+++ b/examples/ethtool/ethtool-app/main.c
@@ -86,7 +86,7 @@ void mark_port_newmac(int idx_port)
 	ptr_port->port_dirty = 1;
 }
 
-static void setup_ports(struct app_config *app_cfg, int cnt_ports)
+static void setup_ports(struct app_config *ptr_cfg, int cnt_ports)
 {
 	int idx_port;
 	int size_pktpool;
@@ -101,7 +101,7 @@ static void setup_ports(struct app_config *app_cfg, int cnt_ports)
 	cfg_port.txmode.mq_mode = RTE_ETH_MQ_TX_NONE;
 
 	for (idx_port = 0; idx_port < cnt_ports; idx_port++) {
-		struct app_port *ptr_port = &app_cfg->ports[idx_port];
+		struct app_port *ptr_port = &ptr_cfg->ports[idx_port];
 
 		ret = rte_eth_dev_info_get(idx_port, &dev_info);
 		if (ret != 0)
diff --git a/examples/ethtool/meson.build b/examples/ethtool/meson.build
index 3ad948d109..d7f63d48af 100644
--- a/examples/ethtool/meson.build
+++ b/examples/ethtool/meson.build
@@ -17,7 +17,6 @@ sources = files(
         'ethtool-app/main.c',
 )
 includes = include_directories('lib', 'ethtool-app')
-cflags += no_shadow_cflag
 
 deps += 'bus_pci'
 if dpdk_conf.has('RTE_NET_IXGBE')
-- 
2.53.0



More information about the dev mailing list