aboutsummaryrefslogtreecommitdiff
path: root/sim/rl78
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2024-01-22 12:58:11 +0100
committerMark Wielaard <mark@klomp.org>2024-01-22 14:22:30 +0100
commitcbbcd7fd1075b7fb158586507cce3be19051b26f (patch)
treed94b8e2edf8275fd6903209910f80571ff2d5ef2 /sim/rl78
parentc2625a463ffd8c0d10b85b65e80ab8b67b28e441 (diff)
downloadbinutils-cbbcd7fd1075b7fb158586507cce3be19051b26f.zip
binutils-cbbcd7fd1075b7fb158586507cce3be19051b26f.tar.gz
binutils-cbbcd7fd1075b7fb158586507cce3be19051b26f.tar.bz2
sim: Fix -Werror=shadow=local by changing mem to addr in sim_{read,write}
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.
Diffstat (limited to 'sim/rl78')
-rw-r--r--sim/rl78/gdb-if.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/sim/rl78/gdb-if.c b/sim/rl78/gdb-if.c
index b85302b..6c0a70b 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;
}