aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@mips.com>2018-02-13 12:56:29 +0000
committerMaciej W. Rozycki <macro@mips.com>2018-02-13 12:56:29 +0000
commit87993319a56af838d3ab7e251fa4902476ca63c8 (patch)
tree5823b2b0d05f2a012923b8c693a850d3914eef7c /opcodes/wasm32-dis.c
parentMIPS/GAS/testsuite: Correct duplicate `Loongson-3A tests' test name (diff)
downloadbinutils-gdb-87993319a56af838d3ab7e251fa4902476ca63c8.tar.gz
binutils-gdb-87993319a56af838d3ab7e251fa4902476ca63c8.tar.bz2
binutils-gdb-87993319a56af838d3ab7e251fa4902476ca63c8.zip
WebAssembly: Correct an `index' global shadowing error for pre-4.8 GCC
Remove `-Wshadow' compilation errors: cc1: warnings being treated as errors .../bfd/wasm-module.c: In function 'wasm_scan_name_function_section': .../bfd/wasm-module.c:312: error: declaration of 'index' shadows a global declaration /usr/include/string.h:303: error: shadowed declaration is here .../bfd/wasm-module.c: In function 'wasm_register_section': .../bfd/wasm-module.c:494: error: declaration of 'index' shadows a global declaration /usr/include/string.h:303: error: shadowed declaration is here .../bfd/wasm-module.c: In function 'wasm_compute_custom_section_file_position': .../bfd/wasm-module.c:523: error: declaration of 'index' shadows a global declaration /usr/include/string.h:303: error: shadowed declaration is here and: cc1: warnings being treated as errors .../opcodes/wasm32-dis.c: In function 'print_insn_wasm32': .../opcodes/wasm32-dis.c:272: error: declaration of 'index' shadows a global declaration /usr/include/string.h:303: error: shadowed declaration is here make[4]: *** [wasm32-dis.lo] Error 1 which for versions of GCC before 4.8 prevent support for the WebAssembly target from being built. See also GCC PR c/53066. bfd/ * wasm-module.c (wasm_scan_name_function_section): Rename `index' local variable to `idx'. opcodes/ * wasm32-dis.c (print_insn_wasm32): Rename `index' local variable to `function_index'.
Diffstat (limited to 'opcodes/wasm32-dis.c')
-rw-r--r--opcodes/wasm32-dis.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/opcodes/wasm32-dis.c b/opcodes/wasm32-dis.c
index dbb18973a6d..d6f16975424 100644
--- a/opcodes/wasm32-dis.c
+++ b/opcodes/wasm32-dis.c
@@ -269,7 +269,7 @@ print_insn_wasm32 (bfd_vma pc, struct disassemble_info *info)
long flags = 0;
long offset = 0;
long depth = 0;
- long index = 0;
+ long function_index = 0;
long target_count = 0;
long block_type = 0;
int len = 1;
@@ -416,14 +416,14 @@ print_insn_wasm32 (bfd_vma pc, struct disassemble_info *info)
break;
case wasm_call:
- index = wasm_read_leb128
+ function_index = wasm_read_leb128
(pc + len, info, &error, &bytes_read, FALSE);
if (error)
return -1;
len += bytes_read;
prin (stream, " ");
private_data->section_prefix = ".space.function_index";
- (*info->print_address_func) ((bfd_vma) index, info);
+ (*info->print_address_func) ((bfd_vma) function_index, info);
private_data->section_prefix = NULL;
break;