Subject: Re: [PATCH net-next 2/2] netdev_queues: fix -Wshadow / Sparse shadow warnings throughout the file

From: Jakub Kicinski <[email-masked]>
Date: Fri, 29 Mar 2024 13:53:44 -0700

On Fri, 29 Mar 2024 13:18:57 -0700 Jakub Kicinski wrote:
> > Sparse:
> > 
> > drivers/net/ethernet/intel/idpf/idpf_txrx.c:1992:16: warning: symbol '_res' shadows an earlier one
> > drivers/net/ethernet/intel/idpf/idpf_txrx.c:1992:16: originally declared here  
> 
> I don't see these building with LLVM=1 W=12 C=1
> and I really don't like complicating the code because the compiler
> is stupid. Can't you solve this with some renames? Add another
> underscore or something?

I'm stupid I tried on the test branch which already had your fix..

This is enough:

diff --git a/include/net/netdev_queues.h b/include/net/netdev_queues.h
index 1ec408585373..2270fbb99cf7 100644
--- a/include/net/netdev_queues.h
+++ b/include/net/netdev_queues.h
@@ -89,7 +89,7 @@ struct netdev_stat_ops {
 
 #define netif_txq_try_stop(txq, get_desc, start_thrs)			\
 	({								\
-		int _res;						\
+		int __res;						\
 									\
 		netif_tx_stop_queue(txq);				\
 		/* Producer index and stop bit must be visible		\
@@ -101,12 +101,12 @@ struct netdev_stat_ops {
 		/* We need to check again in a case another		\
 		 * CPU has just made room available.			\
 		 */							\
-		_res = 0;						\
+		__res = 0;						\
 		if (unlikely(get_desc >= start_thrs)) {			\
 			netif_tx_start_queue(txq);			\
-			_res = -1;					\
+			__res = -1;					\
 		}							\
-		_res;							\
+		__res;							\
 	})								\
 
 /**

---

From: Jakub Kicinski <[email-masked]>
Date: Fri, 29 Mar 2024 13:53:44 -0700

This is enough:

 
 /**

DKIM-Filter: OpenDKIM Filter v2.11.0 b.mx.secunet.com 18C0E20270
Date: Fri, 29 Mar 2024 13:53:44 -0700
From: Jakub Kicinski <[email-masked]>
To: Alexander Lobakin <[email-masked]>
Cc: "David S. Miller" <[email-masked]>, Eric Dumazet
 <[email-masked]>, Paolo Abeni <[email-masked]>, Dmitry Safonov
 <[email-masked]>, Heiner Kallweit <[email-masked]>,
 [email-masked], [email-masked],
 [email-masked]
Subject: Re: [PATCH net-next 2/2] netdev_queues: fix -Wshadow / Sparse
 shadow warnings throughout the file
 9ydFdyaXRlclByb2R1Y2VyLDIwLDE2
X-MS-Exchange-Forest-IndexAgent: 1 1359
X-MS-Exchange-Forest-EmailMessageHash: 5D566706
X-MS-Exchange-Forest-Language: en
X-MS-Exchange-Organization-Processed-By-Journaling: Journal Agent

This is enough:

 
 /**

DKIM-Filter: OpenDKIM Filter v2.11.0 b.mx.secunet.com 49DBA20270
Date: Fri, 29 Mar 2024 13:53:44 -0700
From: Jakub Kicinski <[email-masked]>
To: Alexander Lobakin <[email-masked]>
Cc: "David S. Miller" <[email-masked]>, Eric Dumazet
 <[email-masked]>, Paolo Abeni <[email-masked]>, Dmitry Safonov
 <[email-masked]>, Heiner Kallweit <[email-masked]>,
 [email-masked], [email-masked],
 [email-masked]
Subject: Re: [PATCH net-next 2/2] netdev_queues: fix -Wshadow / Sparse
 shadow warnings throughout the file
 9ydFdyaXRlclByb2R1Y2VyLDIwLDE4
X-MS-Exchange-Forest-IndexAgent: 1 1359
X-MS-Exchange-Forest-EmailMessageHash: 5D566706
X-MS-Exchange-Forest-Language: en
X-MS-Exchange-Organization-Processed-By-Journaling: Journal Agent

This is enough:

 
 /**