More fixes after enabling -Wshadow
cover More fixes after enabling -Wshadow
The drivers mvpp2 and mlx5 for Windows
were not checked when enabling -Wshadow.
Here are the missing small fixes.
Thomas Monjalon (2):
common/mlx5: fix variable shadowing
net/mvpp2: fix variable shadowing
drivers/common/mlx5/windows/mlx5_glue.h | 2 +- drivers/net/mvpp2/mrvl_ethdev.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
Signature · 1 line
2.52.0
PATCH 1/2 common/mlx5: fix variable shadowing
The word "unused" is too common for being used in a header. There is a warning because a parameter is named "unused" in mbuf:
lib/mbuf/rte_mbuf.h: In function 'rte_mbuf_tx_offload':
error: declaration of 'unused' shadows a previous local [-Werror=shadow]
1910 | uint64_t ol3, uint64_t ol2, uint64_t unused)
| ~~~~~~~~~^~~~~~
Such value should be prefixed with "MLX5".
--- drivers/common/mlx5/windows/mlx5_glue.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/common/mlx5/windows/mlx5_glue.h +1 -1
@@ -16,7 +16,7 @@#endif #ifndef HAVE_MLX5DV_DR -enum mlx5dv_dr_domain_type { unused, }; +enum mlx5dv_dr_domain_type {MLX5_UNUSED_DOMAIN_TYPE };struct mlx5dv_dr_domain ;struct mlx5dv_dr_action ;#endif
Signature · 1 line
2.52.0
Re: [PATCH 1/2] common/mlx5: fix variable shadowing
Quoted 7 lines · Thomas Monjalon
The word "unused" is too common for being used in a header. There is a warning because a parameter is named "unused" in mbuf:
lib/mbuf/rte_mbuf.h: In function 'rte_mbuf_tx_offload':
error: declaration of 'unused' shadows a previous local [-Werror=shadow]
1910 |uint64_tol3,uint64_tol2,uint64_tunused)
Quoted 8 lines
| ~~~~~~~~~^~~~~~Such value should be prefixed with "MLX5".
Fixes bd935fe3e624 ("net/mlx5: wrap sampling actions per OS")Signed-off-by Thomas Monjalon <[email protected]>
Signature · 1 line
David Marchand
PATCH 2/2 net/mvpp2: fix variable shadowing
In reply to Thomas MonjalonWith shadowing warning enabled, we can see "i" was declared twice:
drivers/net/mvpp2/mrvl_ethdev.c: In function 'mrvl_rx_pkt_burst':
error: declaration of 'i' shadows a previous local [-Werror=shadow]
2676 | int i;
| ^
/mrvl_ethdev.c:2592:13: note: shadowed declaration is here
2592 | int i, ret, rx_done = 0;
| ^
--- drivers/net/mvpp2/mrvl_ethdev.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/mvpp2/mrvl_ethdev.c +0 -1
@@ -2673,7 +2673,6 @@ mrvl_rx_pkt_burst(void *rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) (!rx_done && num < q->priv->bpool_init_size))) {mrvl_fill_bpool (q, q->priv->fill_bpool_buffs); } else if (unlikely(num > q->priv->bpool_max_size)) { -int i;int pkt_to_remove = num - q->priv->bpool_init_size;struct rte_mbuf *mbuf;struct pp2_buff_inf buff;
Signature · 1 line
2.52.0
Re: [PATCH 2/2] net/mvpp2: fix variable shadowing
Quoted 11 lines · Thomas Monjalon
With shadowing warning enabled, we can see "i" was declared twice:
drivers/net/mvpp2/mrvl_ethdev.c: In function 'mrvl_rx_pkt_burst':
error: declaration of 'i' shadows a previous local [-Werror=shadow]
2676 | int i;
| ^
/mrvl_ethdev.c:2592:13: note: shadowed declaration is here
2592 | int i, ret,rx_done= 0;
| ^
Quoted 4 lines
Fixes afb4d0d0bf91 ("net/mrvl: add Rx/Tx support")Signed-off-by Thomas Monjalon <[email protected]>
Signature · 1 line
David Marchand
Quoted 4 lines · Thomas Monjalon
The drivers mvpp2 and mlx5 for Windows
were not checked when enabling -Wshadow.
Here are the missing small fixes.
Quoted 8 lines
Thomas Monjalon (2):
common/mlx5: fix variable shadowing
net/mvpp2: fix variable shadowingdrivers/common/mlx5/windows/mlx5_glue.h | 2 +- drivers/net/mvpp2/mrvl_ethdev.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
Thanks Thomas.
Quoted 5 lines · Thomas Monjalon
The drivers mvpp2 and mlx5 for Windows
were not checked when enabling -Wshadow.
Here are the missing small fixes.
Quoted 7 lines
Thomas Monjalon (2):
common/mlx5: fix variable shadowing
net/mvpp2: fix variable shadowingdrivers/common/mlx5/windows/mlx5_glue.h | 2 +- drivers/net/mvpp2/mrvl_ethdev.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
Series applied, merci Thomas.
Signature · 1 line
David Marchand