From: Mike Frysinger <vapier@gentoo.org>
To: gdb-patches@sourceware.org
Subject: [PATCH] sim: m32c: fix -Wshadow=local warnings
Date: Fri, 22 Dec 2023 23:28:43 -0500 [thread overview]
Message-ID: <20231223042843.9399-1-vapier@gentoo.org> (raw)
In-Reply-To: <20231222012355.7504-1-vapier@gentoo.org>
These decoders declare a lot of common variables for use by substeps,
and then shadows a few because of how the opc generator is implemented.
Easiest way around it is to rename the per-substep vars as needed as
anything more would require substantial changes to the opc logic.
---
sim/m32c/m32c.opc | 13 +++++--------
sim/m32c/r8c.opc | 8 ++++----
2 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/sim/m32c/m32c.opc b/sim/m32c/m32c.opc
index cc6ef9fbc576..02c894d216b0 100644
--- a/sim/m32c/m32c.opc
+++ b/sim/m32c/m32c.opc
@@ -728,11 +728,11 @@ next_opcode:
b = get_bit2 (sc, bit);
set_zc (!b, b);
- /** 00bb 101b BTST:S src */
+ /** 00bb 101bit BTST:S src */
sc = decode_src23 (3, 3, 1); /* bit,base:19 */
- b = get_bit2 (sc, bb*2 + b);
- set_zc (!b, b);
+ bit = get_bit2 (sc, bb*2 + bit);
+ set_zc (!bit, bit);
/** 1101 ddd0 dd10 0bit BTSTC dest */
@@ -1170,9 +1170,9 @@ next_opcode:
NOTYET();
- /** 1101 0101 1110 1imm LDIPL #IMM */
+ /** 1101 0101 1110 1flg LDIPL #IMM */
- set_flags (0x7000, imm*0x1000);
+ set_flags (0x7000, flg*0x1000);
/** 0000 0001 1000 ddd w dd11 1111 MAX.size #IMM,dest */
@@ -1589,8 +1589,6 @@ next_opcode:
/** 1010 111w PUSH.size #IMM */
- {
- int a;
prefix (0, 0, 0);
imm = IMM(w+1);
tprintf("push%s: %x\n", w ? "hi" : "qi", imm);
@@ -1600,7 +1598,6 @@ next_opcode:
else
mem_put_qi (a, imm);
put_reg (sp, a);
- }
/** 1100 sss w ss00 1110 PUSH.size src */
diff --git a/sim/m32c/r8c.opc b/sim/m32c/r8c.opc
index c5d8929f6ab9..9c35e13f0c5d 100644
--- a/sim/m32c/r8c.opc
+++ b/sim/m32c/r8c.opc
@@ -880,9 +880,9 @@ decode_r8c (void)
v = mem_get_qi (imm);
put_dest (dc, v);
- /** 0111 1101 1010 0imm LDIPL #IMM */
+ /** 0111 1101 1010 0flg LDIPL #IMM */
- set_flags (0x700, imm*0x100);
+ set_flags (0x700, flg*0x100);
/** 0111 010w 1100 dest MOV.size:G #IMM,dest */
@@ -1380,13 +1380,13 @@ decode_r8c (void)
a = sign_ext (get_reg (r1h), 8);
shift_op (dc, 0, a);
- /** 0111 110w 1110 100b SMOVB.size */
+ /** 0111 110w 1110 100z SMOVB.size */
{
int count = get_reg (r3);
int s1 = get_reg (a0) + (get_reg (r1h) << 16);
int s2 = get_reg (a1);
- int inc = (w ? 2 : 1) * (b ? -1 : 1);
+ int inc = (w ? 2 : 1) * (z ? -1 : 1);
while (count)
{
--
2.43.0
next prev parent reply other threads:[~2023-12-23 4:28 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-22 1:23 [PATCH 01/15] sim: aarch64: " Mike Frysinger
2023-12-22 1:23 ` [PATCH 02/15] sim: arm: " Mike Frysinger
2023-12-22 1:23 ` [PATCH 03/15] sim: bfin: " Mike Frysinger
2023-12-22 1:23 ` [PATCH 04/15] sim: common: " Mike Frysinger
2023-12-22 1:23 ` [PATCH 05/15] sim: cris: " Mike Frysinger
2023-12-22 1:23 ` [PATCH 06/15] sim: erc32: " Mike Frysinger
2023-12-22 1:23 ` [PATCH 07/15] sim: frv: " Mike Frysinger
2023-12-22 1:23 ` [PATCH 08/15] sim: h8300: " Mike Frysinger
2023-12-22 1:23 ` [PATCH 09/15] sim: iq2000: " Mike Frysinger
2023-12-22 1:23 ` [PATCH 10/15] sim: m68hc11: " Mike Frysinger
2023-12-22 1:23 ` [PATCH 11/15] sim: mips: " Mike Frysinger
2023-12-22 1:23 ` [PATCH 12/15] sim: ppc: " Mike Frysinger
2023-12-22 1:23 ` [PATCH 13/15] sim: riscv: " Mike Frysinger
2023-12-22 1:23 ` [PATCH 14/15] sim: sh: " Mike Frysinger
2023-12-22 1:23 ` [PATCH 15/15] sim: warnings: enable -Wshadow=local Mike Frysinger
2023-12-22 15:26 ` Tom Tromey
2023-12-23 4:28 ` Mike Frysinger [this message]
2023-12-23 4:28 ` [PATCH] sim: cris: disable -Wshadow=local in generated mloop files Mike Frysinger
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=20231223042843.9399-1-vapier@gentoo.org \
--to=vapier@gentoo.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).