From 9dcb0ba4457b8845fb704635e824471bf1faf092 Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Mon, 9 Jul 2018 15:50:57 +0100 Subject: [PATCH] S12Z/opcodes: Correct a `reg' global shadowing error for pre-4.8 GCC 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 | 8 ++++++++ opcodes/s12z-dis.c | 28 ++++++++++++++-------------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 3b928875ebb..f8272b80b52 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,11 @@ +2018-07-09 Maciej W. Rozycki + + * 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 PR binutils/23242 diff --git a/opcodes/s12z-dis.c b/opcodes/s12z-dis.c index 45123112223..47f86163903 100644 --- a/opcodes/s12z-dis.c +++ b/opcodes/s12z-dis.c @@ -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); -- 2.30.2