S12Z/opcodes: Correct a `reg' global shadowing error for pre-4.8 GCC
authorMaciej W. Rozycki <macro@mips.com>
Mon, 9 Jul 2018 14:50:57 +0000 (15:50 +0100)
committerMaciej W. Rozycki <macro@mips.com>
Mon, 9 Jul 2018 14:50:57 +0000 (15:50 +0100)
Remove `-Wshadow' compilation errors:

cc1: warnings being treated as errors
.../opcodes/s12z-dis.c: In function 'lea_reg_xys_opr':
.../opcodes/s12z-dis.c:814: error: declaration of 'reg' shadows a global declaration
.../opcodes/s12z-dis.c:783: error: shadowed declaration is here
.../opcodes/s12z-dis.c: In function 'lea_reg_xys':
.../opcodes/s12z-dis.c:843: error: declaration of 'reg' shadows a global declaration
.../opcodes/s12z-dis.c:783: error: shadowed declaration is here
.../opcodes/s12z-dis.c: In function 'print_insn_loop_primitive':
.../opcodes/s12z-dis.c:2206: error: declaration of 'reg' shadows a global declaration
.../opcodes/s12z-dis.c:783: error: shadowed declaration is here

which for versions of GCC before 4.8 prevent support for S12Z targets
from being built.  See also GCC PR c/53066.

opcodes/
* s12z-dis.c (lea_reg_xys_opr): Rename `reg' local variable to
`reg_xys'.
(lea_reg_xys): Likewise.
(print_insn_loop_primitive): Rename `reg' local variable to
`reg_dxy'.

opcodes/ChangeLog
opcodes/s12z-dis.c

index 3b928875ebb77cd183ae7bcaedba1589f018d747..f8272b80b52f189e8d8ee652919c7d181a87a5bd 100644 (file)
@@ -1,3 +1,11 @@
+2018-07-09  Maciej W. Rozycki  <macro@mips.com>
+
+       * s12z-dis.c (lea_reg_xys_opr): Rename `reg' local variable to
+       `reg_xys'.
+       (lea_reg_xys): Likewise.
+       (print_insn_loop_primitive): Rename `reg' local variable to
+       `reg_dxy'.
+
 2018-07-06  Tamar Christina  <tamar.christina@arm.com>
 
        PR binutils/23242
index 45123112223841101ef4415d389ead44423023ef..47f861639033df3c81c9db3f514746906445fd78 100644 (file)
@@ -811,22 +811,22 @@ lea_reg_xys_opr (bfd_vma memaddr, struct disassemble_info* info)
   if (status < 0)
     return;
 
-  char *reg = NULL;
+  char *reg_xys = NULL;
   switch (byte & 0x03)
     {
     case 0x00:
-      reg = "x";
+      reg_xys = "x";
       break;
     case 0x01:
-      reg = "y";
+      reg_xys = "y";
       break;
     case 0x02:
-      reg = "s";
+      reg_xys = "s";
       break;
     }
 
   operand_separator (info);
-  (*info->fprintf_func) (info->stream, "%s", reg);
+  (*info->fprintf_func) (info->stream, "%s", reg_xys);
   opr_decode (memaddr, info);
 }
 
@@ -840,17 +840,17 @@ lea_reg_xys (bfd_vma memaddr, struct disassemble_info* info)
   if (status < 0)
     return;
 
-  char *reg = NULL;
+  char *reg_xys = NULL;
   switch (byte & 0x03)
     {
     case 0x00:
-      reg = "x";
+      reg_xys = "x";
       break;
     case 0x01:
-      reg = "y";
+      reg_xys = "y";
       break;
     case 0x02:
-      reg = "s";
+      reg_xys = "s";
       break;
     }
 
@@ -861,7 +861,7 @@ lea_reg_xys (bfd_vma memaddr, struct disassemble_info* info)
   int8_t v = byte;
 
   operand_separator (info);
-  (*info->fprintf_func) (info->stream, "%s, (%d,%s)", reg, v, reg);
+  (*info->fprintf_func) (info->stream, "%s, (%d,%s)", reg_xys, v, reg_xys);
 }
 
 
@@ -2203,7 +2203,7 @@ print_insn_loop_primitive (bfd_vma memaddr, struct disassemble_info* info)
   stpcpy (mnemonic + x, lb_condition [(lb & 0x70) >> 4]);
   x += 2;
 
-  const char *reg  = NULL;
+  const char *reg_dxy  = NULL;
   enum LP_MODE mode = -1;
   size_t i;
   for (i = 0; i < sizeof (lp_mode) / sizeof (lp_mode[0]); ++i)
@@ -2219,10 +2219,10 @@ print_insn_loop_primitive (bfd_vma memaddr, struct disassemble_info* info)
   switch (mode)
     {
     case LP_REG:
-      reg = registers [lb & 0x07].name;
+      reg_dxy = registers [lb & 0x07].name;
       break;
     case LP_XY:
-      reg = (lb & 0x1) ? "y" : "x";
+      reg_dxy = (lb & 0x1) ? "y" : "x";
       break;
     case LP_OPR:
       mnemonic[x++] = '.';
@@ -2240,7 +2240,7 @@ print_insn_loop_primitive (bfd_vma memaddr, struct disassemble_info* info)
   else
     {
       operand_separator (info);
-      (*info->fprintf_func) (info->stream, "%s", reg);
+      (*info->fprintf_func) (info->stream, "%s", reg_dxy);
     }
 
   rel_15_7 (memaddr + offs, info, offs + 1);
This page took 0.029904 seconds and 4 git commands to generate.