From cbbcd7fd1075b7fb158586507cce3be19051b26f Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 22 Jan 2024 12:58:11 +0100 Subject: 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. --- sim/erc32/interf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sim/erc32') diff --git a/sim/erc32/interf.c b/sim/erc32/interf.c index 1f26607..98b8a65 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; } -- cgit v1.1