linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH mips-next 0/2] MIPS: fix -Wshadow in include files
@ 2021-01-14 18:29 Alexander Lobakin
  2021-01-14 18:30 ` [PATCH mips-next 1/2] MIPS: bitops: fix -Wshadow in asm/bitops.h Alexander Lobakin
  2021-01-15 14:58 ` [PATCH mips-next 0/2] MIPS: fix -Wshadow in include files Thomas Bogendoerfer
  0 siblings, 2 replies; 4+ messages in thread
From: Alexander Lobakin @ 2021-01-14 18:29 UTC (permalink / raw)
  To: Thomas Bogendoerfer
  Cc: Alexander Lobakin, Geert Uytterhoeven, Andrew Morton, Bibo Mao,
	Anshuman Khandual, Paul Burton, Mike Rapoport, Guoyun Sun,
	linux-mips, linux-kernel

Fix two -Wshadow warnings coming from the include files and thus
repetitive and very annoying when building lots of sources.

Alexander Lobakin (2):
  MIPS: bitops: fix -Wshadow in asm/bitops.h
  MIPS: pgtable: fix -Wshadow in asm/pgtable.h

 arch/mips/include/asm/bitops.h  | 10 +++++-----
 arch/mips/include/asm/pgtable.h | 12 ++++++------
 2 files changed, 11 insertions(+), 11 deletions(-)

-- 
2.30.0



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH mips-next 1/2] MIPS: bitops: fix -Wshadow in asm/bitops.h
  2021-01-14 18:29 [PATCH mips-next 0/2] MIPS: fix -Wshadow in include files Alexander Lobakin
@ 2021-01-14 18:30 ` Alexander Lobakin
  2021-01-14 18:30   ` [PATCH mips-next 2/2] MIPS: pgtable: fix -Wshadow in asm/pgtable.h Alexander Lobakin
  2021-01-15 14:58 ` [PATCH mips-next 0/2] MIPS: fix -Wshadow in include files Thomas Bogendoerfer
  1 sibling, 1 reply; 4+ messages in thread
From: Alexander Lobakin @ 2021-01-14 18:30 UTC (permalink / raw)
  To: Thomas Bogendoerfer
  Cc: Alexander Lobakin, Geert Uytterhoeven, Andrew Morton, Bibo Mao,
	Anshuman Khandual, Paul Burton, Mike Rapoport, Guoyun Sun,
	linux-mips, linux-kernel

Solves the following repetitive warning when building with -Wshadow:

In file included from ./include/linux/bitops.h:32,
                 from ./include/linux/kernel.h:11,
                 from ./include/linux/skbuff.h:13,
                 from ./include/linux/if_ether.h:19,
                 from ./include/linux/etherdevice.h:20:
./arch/mips/include/asm/bitops.h: In function ‘test_and_set_bit_lock’:
./arch/mips/include/asm/bitops.h:46:16: warning: declaration of ‘orig’ shadows a previous local [-Wshadow]
   46 |  unsigned long orig, temp;    \
      |                ^~~~
./arch/mips/include/asm/bitops.h:190:10: note: in expansion of macro ‘__test_bit_op’
  190 |   orig = __test_bit_op(*m, "%0",
      |          ^~~~~~~~~~~~~
./arch/mips/include/asm/bitops.h:185:21: note: shadowed declaration is here
  185 |  unsigned long res, orig;
      |                     ^~~~
./arch/mips/include/asm/bitops.h: In function ‘test_and_clear_bit’:
./arch/mips/include/asm/bitops.h:46:16: warning: declaration of ‘orig’ shadows a previous local [-Wshadow]
   46 |  unsigned long orig, temp;    \
      |                ^~~~
./arch/mips/include/asm/bitops.h:236:9: note: in expansion of macro ‘__test_bit_op’
  236 |   res = __test_bit_op(*m, "%1",
      |         ^~~~~~~~~~~~~
./arch/mips/include/asm/bitops.h:229:21: note: shadowed declaration is here
  229 |  unsigned long res, orig;
      |                     ^~~~
./arch/mips/include/asm/bitops.h:46:16: warning: declaration of ‘orig’ shadows a previous local [-Wshadow]
   46 |  unsigned long orig, temp;    \
      |                ^~~~
./arch/mips/include/asm/bitops.h:241:10: note: in expansion of macro ‘__test_bit_op’
  241 |   orig = __test_bit_op(*m, "%0",
      |          ^~~~~~~~~~~~~
./arch/mips/include/asm/bitops.h:229:21: note: shadowed declaration is here
  229 |  unsigned long res, orig;
      |                     ^~~~
./arch/mips/include/asm/bitops.h: In function ‘test_and_change_bit’:
./arch/mips/include/asm/bitops.h:46:16: warning: declaration of ‘orig’ shadows a previous local [-Wshadow]
   46 |  unsigned long orig, temp;    \
      |                ^~~~
./arch/mips/include/asm/bitops.h:273:10: note: in expansion of macro ‘__test_bit_op’
  273 |   orig = __test_bit_op(*m, "%0",
      |          ^~~~~~~~~~~~~
./arch/mips/include/asm/bitops.h:266:21: note: shadowed declaration is here
  266 |  unsigned long res, orig;
      |                     ^~~~

Signed-off-by: Alexander Lobakin <alobakin@pm.me>
---
 arch/mips/include/asm/bitops.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/mips/include/asm/bitops.h b/arch/mips/include/asm/bitops.h
index 1b08f9f38593..dc2a6234dd3c 100644
--- a/arch/mips/include/asm/bitops.h
+++ b/arch/mips/include/asm/bitops.h
@@ -26,7 +26,7 @@
 #include <asm/war.h>
 
 #define __bit_op(mem, insn, inputs...) do {			\
-	unsigned long temp;					\
+	unsigned long __temp;					\
 								\
 	asm volatile(						\
 	"	.set		push			\n"	\
@@ -37,13 +37,13 @@
 	"	" __SC		"%0, %1			\n"	\
 	"	" __SC_BEQZ	"%0, 1b			\n"	\
 	"	.set		pop			\n"	\
-	: "=&r"(temp), "+" GCC_OFF_SMALL_ASM()(mem)		\
+	: "=&r"(__temp), "+" GCC_OFF_SMALL_ASM()(mem)		\
 	: inputs						\
 	: __LLSC_CLOBBER);					\
 } while (0)
 
 #define __test_bit_op(mem, ll_dst, insn, inputs...) ({		\
-	unsigned long orig, temp;				\
+	unsigned long __orig, __temp;				\
 								\
 	asm volatile(						\
 	"	.set		push			\n"	\
@@ -54,12 +54,12 @@
 	"	" __SC		"%1, %2			\n"	\
 	"	" __SC_BEQZ	"%1, 1b			\n"	\
 	"	.set		pop			\n"	\
-	: "=&r"(orig), "=&r"(temp),				\
+	: "=&r"(__orig), "=&r"(__temp),				\
 	  "+" GCC_OFF_SMALL_ASM()(mem)				\
 	: inputs						\
 	: __LLSC_CLOBBER);					\
 								\
-	orig;							\
+	__orig;							\
 })
 
 /*
-- 
2.30.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH mips-next 2/2] MIPS: pgtable: fix -Wshadow in asm/pgtable.h
  2021-01-14 18:30 ` [PATCH mips-next 1/2] MIPS: bitops: fix -Wshadow in asm/bitops.h Alexander Lobakin
@ 2021-01-14 18:30   ` Alexander Lobakin
  0 siblings, 0 replies; 4+ messages in thread
From: Alexander Lobakin @ 2021-01-14 18:30 UTC (permalink / raw)
  To: Thomas Bogendoerfer
  Cc: Alexander Lobakin, Geert Uytterhoeven, Andrew Morton, Bibo Mao,
	Anshuman Khandual, Paul Burton, Mike Rapoport, Guoyun Sun,
	linux-mips, linux-kernel

Solves the following repetitive warning when building with -Wshadow:

In file included from ./include/linux/pgtable.h:6,
                 from ./include/linux/mm.h:33,
                 from ./include/linux/dax.h:6,
                 from ./include/linux/mempolicy.h:11,
                 from kernel/fork.c:34:
./arch/mips/include/asm/mmu_context.h: In function ‘switch_mm’:
./arch/mips/include/asm/pgtable.h:97:16: warning: declaration of ‘flags’ shadows a previous local [-Wshadow]
   97 |  unsigned long flags;      \
      |                ^~~~~
./arch/mips/include/asm/mmu_context.h:162:2: note: in expansion of macro ‘htw_stop’
  162 |  htw_stop();
      |  ^~~~~~~~
In file included from kernel/fork.c:102:
./arch/mips/include/asm/mmu_context.h:159:16: note: shadowed declaration is here
  159 |  unsigned long flags;
      |                ^~~~~

Signed-off-by: Alexander Lobakin <alobakin@pm.me>
---
 arch/mips/include/asm/pgtable.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h
index 4f9c37616d42..4d3ab682d093 100644
--- a/arch/mips/include/asm/pgtable.h
+++ b/arch/mips/include/asm/pgtable.h
@@ -94,31 +94,31 @@ extern void paging_init(void);
 
 #define htw_stop()							\
 do {									\
-	unsigned long flags;						\
+	unsigned long __flags;						\
 									\
 	if (cpu_has_htw) {						\
-		local_irq_save(flags);					\
+		local_irq_save(__flags);				\
 		if(!raw_current_cpu_data.htw_seq++) {			\
 			write_c0_pwctl(read_c0_pwctl() &		\
 				       ~(1 << MIPS_PWCTL_PWEN_SHIFT));	\
 			back_to_back_c0_hazard();			\
 		}							\
-		local_irq_restore(flags);				\
+		local_irq_restore(__flags);				\
 	}								\
 } while(0)
 
 #define htw_start()							\
 do {									\
-	unsigned long flags;						\
+	unsigned long __flags;						\
 									\
 	if (cpu_has_htw) {						\
-		local_irq_save(flags);					\
+		local_irq_save(__flags);				\
 		if (!--raw_current_cpu_data.htw_seq) {			\
 			write_c0_pwctl(read_c0_pwctl() |		\
 				       (1 << MIPS_PWCTL_PWEN_SHIFT));	\
 			back_to_back_c0_hazard();			\
 		}							\
-		local_irq_restore(flags);				\
+		local_irq_restore(__flags);				\
 	}								\
 } while(0)
 
-- 
2.30.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH mips-next 0/2] MIPS: fix -Wshadow in include files
  2021-01-14 18:29 [PATCH mips-next 0/2] MIPS: fix -Wshadow in include files Alexander Lobakin
  2021-01-14 18:30 ` [PATCH mips-next 1/2] MIPS: bitops: fix -Wshadow in asm/bitops.h Alexander Lobakin
@ 2021-01-15 14:58 ` Thomas Bogendoerfer
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Bogendoerfer @ 2021-01-15 14:58 UTC (permalink / raw)
  To: Alexander Lobakin
  Cc: Geert Uytterhoeven, Andrew Morton, Bibo Mao, Anshuman Khandual,
	Paul Burton, Mike Rapoport, Guoyun Sun, linux-mips, linux-kernel

On Thu, Jan 14, 2021 at 06:29:26PM +0000, Alexander Lobakin wrote:
> Fix two -Wshadow warnings coming from the include files and thus
> repetitive and very annoying when building lots of sources.
> 
> Alexander Lobakin (2):
>   MIPS: bitops: fix -Wshadow in asm/bitops.h
>   MIPS: pgtable: fix -Wshadow in asm/pgtable.h
> 
>  arch/mips/include/asm/bitops.h  | 10 +++++-----
>  arch/mips/include/asm/pgtable.h | 12 ++++++------
>  2 files changed, 11 insertions(+), 11 deletions(-)

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-01-15 14:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-14 18:29 [PATCH mips-next 0/2] MIPS: fix -Wshadow in include files Alexander Lobakin
2021-01-14 18:30 ` [PATCH mips-next 1/2] MIPS: bitops: fix -Wshadow in asm/bitops.h Alexander Lobakin
2021-01-14 18:30   ` [PATCH mips-next 2/2] MIPS: pgtable: fix -Wshadow in asm/pgtable.h Alexander Lobakin
2021-01-15 14:58 ` [PATCH mips-next 0/2] MIPS: fix -Wshadow in include files Thomas Bogendoerfer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).