From: Mark Wielaard <mark@klomp.org>
To: gdb-patches@sourceware.org
Cc: Mark Wielaard <mark@klomp.org>
Subject: [PATCH] sim: Fix -Werror=shadow=local issue in m32c/gdb-if.c
Date: Sun, 21 Jan 2024 23:57:09 +0100 [thread overview]
Message-ID: <20240121225709.575321-1-mark@klomp.org> (raw)
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
next reply other threads:[~2024-01-21 22:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-21 22:57 Mark Wielaard [this message]
2024-01-22 3:43 ` Mike Frysinger
2024-01-22 11:27 ` Mark Wielaard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240121225709.575321-1-mark@klomp.org \
--to=mark@klomp.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox