]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
sim: m32c: fix -Wshadow=local warnings
authorMike Frysinger <vapier@gentoo.org>
Fri, 22 Dec 2023 23:05:50 +0000 (18:05 -0500)
committerMike Frysinger <vapier@gentoo.org>
Sat, 23 Dec 2023 04:29:19 +0000 (23:29 -0500)
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
sim/m32c/r8c.opc

index cc6ef9fbc576a3b4cb9a121c165cc14f126c5e89..02c894d216b0b3b1ab20b4969742d125151ea4f2 100644 (file)
@@ -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 */
 
index c5d8929f6ab91cba079f93aa1387333a5a01a450..9c35e13f0c5d02d343faa03306ae5f4d86fca355 100644 (file)
@@ -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)
     {