Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] sim: Fix -Werror=shadow=local issue in m32c/gdb-if.c
@ 2024-01-21 22:57 Mark Wielaard
  2024-01-22  3:43 ` Mike Frysinger
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Wielaard @ 2024-01-21 22:57 UTC (permalink / raw)
  To: gdb-patches; +Cc: Mark Wielaard

m32c/cpu.h defines mem as enum value, which causes GCC 14 to emit

sim/m32c/gdb-if.c: In function ‘sim_read’:
sim/m32c/gdb-if.c:162:33: error: declaration of ‘mem’ shadows a previous local [-Werror=shadow=local]
  162 | sim_read (SIM_DESC sd, uint64_t mem, void *buf, uint64_t length)
      |                        ~~~~~~~~~^~~
In file included from ../../binutils-gdb/sim/m32c/gdb-if.c:38:
sim/m32c/cpu.h:83:3: note: shadowed declaration is here
   83 |   mem,
      |   ^~~

Fix this by renaming mem to memory in m32c/gdb-if.c
---
 sim/m32c/gdb-if.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sim/m32c/gdb-if.c b/sim/m32c/gdb-if.c
index a1a96b450f3..ae268c5c045 100644
--- a/sim/m32c/gdb-if.c
+++ b/sim/m32c/gdb-if.c
@@ -159,24 +159,24 @@ sim_create_inferior (SIM_DESC sd, struct bfd * abfd,
 }
 
 uint64_t
-sim_read (SIM_DESC sd, uint64_t mem, void *buf, uint64_t length)
+sim_read (SIM_DESC sd, uint64_t memory, void *buf, uint64_t length)
 {
   check_desc (sd);
 
-  if (mem == 0)
+  if (memory == 0)
     return 0;
 
-  mem_get_blk ((int) mem, buf, length);
+  mem_get_blk ((int) memory, buf, length);
 
   return length;
 }
 
 uint64_t
-sim_write (SIM_DESC sd, uint64_t mem, const void *buf, uint64_t length)
+sim_write (SIM_DESC sd, uint64_t memory, const void *buf, uint64_t length)
 {
   check_desc (sd);
 
-  mem_put_blk ((int) mem, buf, length);
+  mem_put_blk ((int) memory, buf, length);
 
   return length;
 }
-- 
2.39.3


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

end of thread, other threads:[~2024-01-22 11:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-21 22:57 [PATCH] sim: Fix -Werror=shadow=local issue in m32c/gdb-if.c Mark Wielaard
2024-01-22  3:43 ` Mike Frysinger
2024-01-22 11:27   ` Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox