* [PATCH] sim: Fix -Werror=shadow=local by changing mem to addr in sim_{read,write}
@ 2024-01-22 12:05 Mark Wielaard
2024-01-22 13:14 ` Mike Frysinger
0 siblings, 1 reply; 3+ messages in thread
From: Mark Wielaard @ 2024-01-22 12:05 UTC (permalink / raw)
To: gdb-patches; +Cc: Mike Frysinger, 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 addr in all sim_read and sim_write functions.
Most already used addr instead of mem. In one file, sim/rx/gdb-if.c, this
also meant renaming the local addr variable to vma.
---
sim/common/sim-hrw.c | 8 ++++----
sim/erc32/interf.c | 8 ++++----
sim/m32c/gdb-if.c | 10 +++++-----
sim/ppc/sim_calls.c | 16 ++++++++--------
sim/rl78/gdb-if.c | 20 ++++++++++----------
sim/rx/gdb-if.c | 18 +++++++++---------
6 files changed, 40 insertions(+), 40 deletions(-)
diff --git a/sim/common/sim-hrw.c b/sim/common/sim-hrw.c
index 757b826cc63..582d391ae1a 100644
--- a/sim/common/sim-hrw.c
+++ b/sim/common/sim-hrw.c
@@ -27,17 +27,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
modeling real hardware */
uint64_t
-sim_read (SIM_DESC sd, uint64_t mem, void *buffer, uint64_t length)
+sim_read (SIM_DESC sd, uint64_t addr, void *buffer, uint64_t length)
{
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
return sim_core_read_buffer (sd, NULL, read_map,
- buffer, mem, length);
+ buffer, addr, length);
}
uint64_t
-sim_write (SIM_DESC sd, uint64_t mem, const void *buffer, uint64_t length)
+sim_write (SIM_DESC sd, uint64_t addr, const void *buffer, uint64_t length)
{
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
return sim_core_write_buffer (sd, NULL, write_map,
- buffer, mem, length);
+ buffer, addr, length);
}
diff --git a/sim/erc32/interf.c b/sim/erc32/interf.c
index 1f2660771f8..98b8a65b944 100644
--- a/sim/erc32/interf.c
+++ b/sim/erc32/interf.c
@@ -330,25 +330,25 @@ sim_fetch_register(SIM_DESC sd, int regno, void *buf, int length)
}
uint64_t
-sim_write (SIM_DESC sd, uint64_t mem, const void *buffer, uint64_t length)
+sim_write (SIM_DESC sd, uint64_t addr, const void *buffer, uint64_t length)
{
int i;
const unsigned char *data = buffer;
for (i = 0; i < length; i++) {
- sis_memory_write ((mem + i) ^ EBT, &data[i], 1);
+ sis_memory_write ((addr + i) ^ EBT, &data[i], 1);
}
return length;
}
uint64_t
-sim_read (SIM_DESC sd, uint64_t mem, void *buffer, uint64_t length)
+sim_read (SIM_DESC sd, uint64_t addr, void *buffer, uint64_t length)
{
int i;
unsigned char *data = buffer;
for (i = 0; i < length; i++) {
- sis_memory_read ((mem + i) ^ EBT, &data[i], 1);
+ sis_memory_read ((addr + i) ^ EBT, &data[i], 1);
}
return length;
}
diff --git a/sim/m32c/gdb-if.c b/sim/m32c/gdb-if.c
index a1a96b450f3..bf8424e65df 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 addr, void *buf, uint64_t length)
{
check_desc (sd);
- if (mem == 0)
+ if (addr == 0)
return 0;
- mem_get_blk ((int) mem, buf, length);
+ mem_get_blk ((int) addr, 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 addr, const void *buf, uint64_t length)
{
check_desc (sd);
- mem_put_blk ((int) mem, buf, length);
+ mem_put_blk ((int) addr, buf, length);
return length;
}
diff --git a/sim/ppc/sim_calls.c b/sim/ppc/sim_calls.c
index 13e39a6e07b..dc177e45c7a 100644
--- a/sim/ppc/sim_calls.c
+++ b/sim/ppc/sim_calls.c
@@ -125,26 +125,26 @@ sim_load (SIM_DESC sd, const char *prog, bfd *abfd, int from_tty)
uint64_t
-sim_read (SIM_DESC sd, uint64_t mem, void *buf, uint64_t length)
+sim_read (SIM_DESC sd, uint64_t addr, void *buf, uint64_t length)
{
int result = psim_read_memory(simulator, MAX_NR_PROCESSORS,
- buf, mem, length);
+ buf, addr, length);
TRACE(trace_gdb,
- ("sim_read(mem=0x%" PRIx64 ", buf=%p, length=%" PRIx64 ") = %d\n",
- mem, buf, length, result));
+ ("sim_read(addr=0x%" PRIx64 ", buf=%p, length=%" PRIx64 ") = %d\n",
+ addr, buf, length, result));
return result;
}
uint64_t
-sim_write (SIM_DESC sd, uint64_t mem, const void *buf, uint64_t length)
+sim_write (SIM_DESC sd, uint64_t addr, const void *buf, uint64_t length)
{
int result = psim_write_memory(simulator, MAX_NR_PROCESSORS,
- buf, mem, length,
+ buf, addr, length,
1/*violate_ro*/);
TRACE(trace_gdb,
- ("sim_write(mem=0x%" PRIx64 ", buf=%p, length=%" PRIx64 ") = %d\n",
- mem, buf, length, result));
+ ("sim_write(addr=0x%" PRIx64 ", buf=%p, length=%" PRIx64 ") = %d\n",
+ addr, buf, length, result));
return result;
}
diff --git a/sim/rl78/gdb-if.c b/sim/rl78/gdb-if.c
index b85302b40a0..6c0a70beb19 100644
--- a/sim/rl78/gdb-if.c
+++ b/sim/rl78/gdb-if.c
@@ -205,32 +205,32 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
/* Read memory. */
uint64_t
-sim_read (SIM_DESC sd, uint64_t mem, void *buf, uint64_t length)
+sim_read (SIM_DESC sd, uint64_t addr, void *buf, uint64_t length)
{
check_desc (sd);
- if (mem >= MEM_SIZE)
+ if (addr >= MEM_SIZE)
return 0;
- else if (mem + length > MEM_SIZE)
- length = MEM_SIZE - mem;
+ else if (addr + length > MEM_SIZE)
+ length = MEM_SIZE - addr;
- mem_get_blk (mem, buf, length);
+ mem_get_blk (addr, buf, length);
return length;
}
/* Write memory. */
uint64_t
-sim_write (SIM_DESC sd, uint64_t mem, const void *buf, uint64_t length)
+sim_write (SIM_DESC sd, uint64_t addr, const void *buf, uint64_t length)
{
check_desc (sd);
- if (mem >= MEM_SIZE)
+ if (addr >= MEM_SIZE)
return 0;
- else if (mem + length > MEM_SIZE)
- length = MEM_SIZE - mem;
+ else if (addr + length > MEM_SIZE)
+ length = MEM_SIZE - addr;
- mem_put_blk (mem, buf, length);
+ mem_put_blk (addr, buf, length);
return length;
}
diff --git a/sim/rx/gdb-if.c b/sim/rx/gdb-if.c
index 6b616b7612a..0fc626d9e9c 100644
--- a/sim/rx/gdb-if.c
+++ b/sim/rx/gdb-if.c
@@ -227,23 +227,23 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
}
uint64_t
-sim_read (SIM_DESC sd, uint64_t mem, void *buffer, uint64_t length)
+sim_read (SIM_DESC sd, uint64_t addr, void *buffer, uint64_t length)
{
int i;
unsigned char *data = buffer;
check_desc (sd);
- if (mem == 0)
+ if (addr == 0)
return 0;
execution_error_clear_last_error ();
for (i = 0; i < length; i++)
{
- bfd_vma addr = mem + i;
- int do_swap = addr_in_swap_list (addr);
- data[i] = mem_get_qi (addr ^ (do_swap ? 3 : 0));
+ bfd_vma vma = addr + i;
+ int do_swap = addr_in_swap_list (vma);
+ data[i] = mem_get_qi (vma ^ (do_swap ? 3 : 0));
if (execution_error_get_last_error () != SIM_ERR_NONE)
return i;
@@ -253,7 +253,7 @@ sim_read (SIM_DESC sd, uint64_t mem, void *buffer, uint64_t length)
}
uint64_t
-sim_write (SIM_DESC sd, uint64_t mem, const void *buffer, uint64_t length)
+sim_write (SIM_DESC sd, uint64_t addr, const void *buffer, uint64_t length)
{
int i;
const unsigned char *data = buffer;
@@ -264,9 +264,9 @@ sim_write (SIM_DESC sd, uint64_t mem, const void *buffer, uint64_t length)
for (i = 0; i < length; i++)
{
- bfd_vma addr = mem + i;
- int do_swap = addr_in_swap_list (addr);
- mem_put_qi (addr ^ (do_swap ? 3 : 0), data[i]);
+ bfd_vma vma = addr + i;
+ int do_swap = addr_in_swap_list (vma);
+ mem_put_qi (vma ^ (do_swap ? 3 : 0), data[i]);
if (execution_error_get_last_error () != SIM_ERR_NONE)
return i;
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sim: Fix -Werror=shadow=local by changing mem to addr in sim_{read,write}
2024-01-22 12:05 [PATCH] sim: Fix -Werror=shadow=local by changing mem to addr in sim_{read,write} Mark Wielaard
@ 2024-01-22 13:14 ` Mike Frysinger
2024-01-22 13:27 ` Mark Wielaard
0 siblings, 1 reply; 3+ messages in thread
From: Mike Frysinger @ 2024-01-22 13:14 UTC (permalink / raw)
To: Mark Wielaard; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 830 bytes --]
On 22 Jan 2024 13:05, Mark Wielaard wrote:
> 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 addr in all sim_read and sim_write functions.
> Most already used addr instead of mem. In one file, sim/rx/gdb-if.c, this
> also meant renaming the local addr variable to vma.
lgtm, although missing include/sim/sim.h update
-mike
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sim: Fix -Werror=shadow=local by changing mem to addr in sim_{read,write}
2024-01-22 13:14 ` Mike Frysinger
@ 2024-01-22 13:27 ` Mark Wielaard
0 siblings, 0 replies; 3+ messages in thread
From: Mark Wielaard @ 2024-01-22 13:27 UTC (permalink / raw)
To: Mike Frysinger; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1117 bytes --]
Hi Mike,
On Mon, 2024-01-22 at 08:14 -0500, Mike Frysinger wrote:
> On 22 Jan 2024 13:05, Mark Wielaard wrote:
> > 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 addr in all sim_read and sim_write functions.
> > Most already used addr instead of mem. In one file, sim/rx/gdb-if.c, this
> > also meant renaming the local addr variable to vma.
>
> lgtm, although missing include/sim/sim.h update
Urgh, I dunno how I missed that. Pushed with include/sim/sim.h also
updated, as attached (after checking against gcc13/gcc14 it still
builds and resolves the issue).
Thanks,
Mark
[-- Attachment #2: 0001-sim-Fix-Werror-shadow-local-by-changing-mem-to-addr-.patch --]
[-- Type: text/x-patch, Size: 9201 bytes --]
From cbbcd7fd1075b7fb158586507cce3be19051b26f Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Mon, 22 Jan 2024 12:58:11 +0100
Subject: [PATCH] sim: Fix -Werror=shadow=local by changing mem to addr in
sim_{read,write}
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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 addr in all sim_read and sim_write functions.
Most already used addr instead of mem. In one file, sim/rx/gdb-if.c, this
also meant renaming the local addr variable to vma.
---
include/sim/sim.h | 4 ++--
sim/common/sim-hrw.c | 8 ++++----
sim/erc32/interf.c | 8 ++++----
sim/m32c/gdb-if.c | 10 +++++-----
sim/ppc/sim_calls.c | 16 ++++++++--------
sim/rl78/gdb-if.c | 20 ++++++++++----------
sim/rx/gdb-if.c | 18 +++++++++---------
7 files changed, 42 insertions(+), 42 deletions(-)
diff --git a/include/sim/sim.h b/include/sim/sim.h
index 251a1d46310..5dfb28b6785 100644
--- a/include/sim/sim.h
+++ b/include/sim/sim.h
@@ -160,14 +160,14 @@ SIM_RC sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
at virtual address MEM and store in BUF. Result is number of bytes
read, or zero if error. */
-uint64_t sim_read (SIM_DESC sd, uint64_t mem, void *buf, uint64_t length);
+uint64_t sim_read (SIM_DESC sd, uint64_t addr, void *buf, uint64_t length);
/* Store LENGTH bytes from BUF into the simulated program's
memory. Store bytes starting at virtual address MEM. Result is
number of bytes write, or zero if error. */
-uint64_t sim_write (SIM_DESC sd, uint64_t mem, const void *buf, uint64_t length);
+uint64_t sim_write (SIM_DESC sd, uint64_t addr, const void *buf, uint64_t length);
/* Fetch register REGNO storing its raw (target endian) value in the
diff --git a/sim/common/sim-hrw.c b/sim/common/sim-hrw.c
index 757b826cc63..582d391ae1a 100644
--- a/sim/common/sim-hrw.c
+++ b/sim/common/sim-hrw.c
@@ -27,17 +27,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
modeling real hardware */
uint64_t
-sim_read (SIM_DESC sd, uint64_t mem, void *buffer, uint64_t length)
+sim_read (SIM_DESC sd, uint64_t addr, void *buffer, uint64_t length)
{
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
return sim_core_read_buffer (sd, NULL, read_map,
- buffer, mem, length);
+ buffer, addr, length);
}
uint64_t
-sim_write (SIM_DESC sd, uint64_t mem, const void *buffer, uint64_t length)
+sim_write (SIM_DESC sd, uint64_t addr, const void *buffer, uint64_t length)
{
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
return sim_core_write_buffer (sd, NULL, write_map,
- buffer, mem, length);
+ buffer, addr, length);
}
diff --git a/sim/erc32/interf.c b/sim/erc32/interf.c
index 1f2660771f8..98b8a65b944 100644
--- a/sim/erc32/interf.c
+++ b/sim/erc32/interf.c
@@ -330,25 +330,25 @@ sim_fetch_register(SIM_DESC sd, int regno, void *buf, int length)
}
uint64_t
-sim_write (SIM_DESC sd, uint64_t mem, const void *buffer, uint64_t length)
+sim_write (SIM_DESC sd, uint64_t addr, const void *buffer, uint64_t length)
{
int i;
const unsigned char *data = buffer;
for (i = 0; i < length; i++) {
- sis_memory_write ((mem + i) ^ EBT, &data[i], 1);
+ sis_memory_write ((addr + i) ^ EBT, &data[i], 1);
}
return length;
}
uint64_t
-sim_read (SIM_DESC sd, uint64_t mem, void *buffer, uint64_t length)
+sim_read (SIM_DESC sd, uint64_t addr, void *buffer, uint64_t length)
{
int i;
unsigned char *data = buffer;
for (i = 0; i < length; i++) {
- sis_memory_read ((mem + i) ^ EBT, &data[i], 1);
+ sis_memory_read ((addr + i) ^ EBT, &data[i], 1);
}
return length;
}
diff --git a/sim/m32c/gdb-if.c b/sim/m32c/gdb-if.c
index a1a96b450f3..bf8424e65df 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 addr, void *buf, uint64_t length)
{
check_desc (sd);
- if (mem == 0)
+ if (addr == 0)
return 0;
- mem_get_blk ((int) mem, buf, length);
+ mem_get_blk ((int) addr, 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 addr, const void *buf, uint64_t length)
{
check_desc (sd);
- mem_put_blk ((int) mem, buf, length);
+ mem_put_blk ((int) addr, buf, length);
return length;
}
diff --git a/sim/ppc/sim_calls.c b/sim/ppc/sim_calls.c
index 13e39a6e07b..dc177e45c7a 100644
--- a/sim/ppc/sim_calls.c
+++ b/sim/ppc/sim_calls.c
@@ -125,26 +125,26 @@ sim_load (SIM_DESC sd, const char *prog, bfd *abfd, int from_tty)
uint64_t
-sim_read (SIM_DESC sd, uint64_t mem, void *buf, uint64_t length)
+sim_read (SIM_DESC sd, uint64_t addr, void *buf, uint64_t length)
{
int result = psim_read_memory(simulator, MAX_NR_PROCESSORS,
- buf, mem, length);
+ buf, addr, length);
TRACE(trace_gdb,
- ("sim_read(mem=0x%" PRIx64 ", buf=%p, length=%" PRIx64 ") = %d\n",
- mem, buf, length, result));
+ ("sim_read(addr=0x%" PRIx64 ", buf=%p, length=%" PRIx64 ") = %d\n",
+ addr, buf, length, result));
return result;
}
uint64_t
-sim_write (SIM_DESC sd, uint64_t mem, const void *buf, uint64_t length)
+sim_write (SIM_DESC sd, uint64_t addr, const void *buf, uint64_t length)
{
int result = psim_write_memory(simulator, MAX_NR_PROCESSORS,
- buf, mem, length,
+ buf, addr, length,
1/*violate_ro*/);
TRACE(trace_gdb,
- ("sim_write(mem=0x%" PRIx64 ", buf=%p, length=%" PRIx64 ") = %d\n",
- mem, buf, length, result));
+ ("sim_write(addr=0x%" PRIx64 ", buf=%p, length=%" PRIx64 ") = %d\n",
+ addr, buf, length, result));
return result;
}
diff --git a/sim/rl78/gdb-if.c b/sim/rl78/gdb-if.c
index b85302b40a0..6c0a70beb19 100644
--- a/sim/rl78/gdb-if.c
+++ b/sim/rl78/gdb-if.c
@@ -205,32 +205,32 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
/* Read memory. */
uint64_t
-sim_read (SIM_DESC sd, uint64_t mem, void *buf, uint64_t length)
+sim_read (SIM_DESC sd, uint64_t addr, void *buf, uint64_t length)
{
check_desc (sd);
- if (mem >= MEM_SIZE)
+ if (addr >= MEM_SIZE)
return 0;
- else if (mem + length > MEM_SIZE)
- length = MEM_SIZE - mem;
+ else if (addr + length > MEM_SIZE)
+ length = MEM_SIZE - addr;
- mem_get_blk (mem, buf, length);
+ mem_get_blk (addr, buf, length);
return length;
}
/* Write memory. */
uint64_t
-sim_write (SIM_DESC sd, uint64_t mem, const void *buf, uint64_t length)
+sim_write (SIM_DESC sd, uint64_t addr, const void *buf, uint64_t length)
{
check_desc (sd);
- if (mem >= MEM_SIZE)
+ if (addr >= MEM_SIZE)
return 0;
- else if (mem + length > MEM_SIZE)
- length = MEM_SIZE - mem;
+ else if (addr + length > MEM_SIZE)
+ length = MEM_SIZE - addr;
- mem_put_blk (mem, buf, length);
+ mem_put_blk (addr, buf, length);
return length;
}
diff --git a/sim/rx/gdb-if.c b/sim/rx/gdb-if.c
index 6b616b7612a..0fc626d9e9c 100644
--- a/sim/rx/gdb-if.c
+++ b/sim/rx/gdb-if.c
@@ -227,23 +227,23 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
}
uint64_t
-sim_read (SIM_DESC sd, uint64_t mem, void *buffer, uint64_t length)
+sim_read (SIM_DESC sd, uint64_t addr, void *buffer, uint64_t length)
{
int i;
unsigned char *data = buffer;
check_desc (sd);
- if (mem == 0)
+ if (addr == 0)
return 0;
execution_error_clear_last_error ();
for (i = 0; i < length; i++)
{
- bfd_vma addr = mem + i;
- int do_swap = addr_in_swap_list (addr);
- data[i] = mem_get_qi (addr ^ (do_swap ? 3 : 0));
+ bfd_vma vma = addr + i;
+ int do_swap = addr_in_swap_list (vma);
+ data[i] = mem_get_qi (vma ^ (do_swap ? 3 : 0));
if (execution_error_get_last_error () != SIM_ERR_NONE)
return i;
@@ -253,7 +253,7 @@ sim_read (SIM_DESC sd, uint64_t mem, void *buffer, uint64_t length)
}
uint64_t
-sim_write (SIM_DESC sd, uint64_t mem, const void *buffer, uint64_t length)
+sim_write (SIM_DESC sd, uint64_t addr, const void *buffer, uint64_t length)
{
int i;
const unsigned char *data = buffer;
@@ -264,9 +264,9 @@ sim_write (SIM_DESC sd, uint64_t mem, const void *buffer, uint64_t length)
for (i = 0; i < length; i++)
{
- bfd_vma addr = mem + i;
- int do_swap = addr_in_swap_list (addr);
- mem_put_qi (addr ^ (do_swap ? 3 : 0), data[i]);
+ bfd_vma vma = addr + i;
+ int do_swap = addr_in_swap_list (vma);
+ mem_put_qi (vma ^ (do_swap ? 3 : 0), data[i]);
if (execution_error_get_last_error () != SIM_ERR_NONE)
return i;
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-01-22 13:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-22 12:05 [PATCH] sim: Fix -Werror=shadow=local by changing mem to addr in sim_{read,write} Mark Wielaard
2024-01-22 13:14 ` Mike Frysinger
2024-01-22 13: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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).