diff options
author | Tom Tromey <tom@tromey.com> | 2018-04-21 16:16:27 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-10-04 22:51:45 -0600 |
commit | b926417afaea99ed17663e06d6654d0048536017 (patch) | |
tree | b26a979c2f74c28f5c8979f55acfdacefdb18cfb /gdb/dwarf2read.c | |
parent | 1f88d0c87c37d3a15fa6376335e8b0d1c79d85aa (diff) | |
download | gdb-b926417afaea99ed17663e06d6654d0048536017.zip gdb-b926417afaea99ed17663e06d6654d0048536017.tar.gz gdb-b926417afaea99ed17663e06d6654d0048536017.tar.bz2 |
Simple -Wshadow=local fixes
This fixes all the straightforward -Wshadow=local warnings in gdb. A
few standard approaches are used here:
* Renaming an inner (or outer, but more commonly inner) variable;
* Lowering a declaration to avoid a clash;
* Moving a declaration into a more inner scope to avoid a clash,
including the special case of moving a declaration into a loop header.
I did not consider any of the changes in this patch to be particularly
noteworthy, though of course they should all still be examined.
gdb/ChangeLog
2018-10-04 Tom Tromey <tom@tromey.com>
* ctf.c (SET_ARRAY_FIELD): Rename "u32".
* p-valprint.c (pascal_val_print): Split inner "i" variable.
* xtensa-tdep.c (xtensa_push_dummy_call): Declare "i" in loop
header.
* xstormy16-tdep.c (xstormy16_push_dummy_call): Declare "val" in
more inner scope.
* xcoffread.c (read_xcoff_symtab): Rename inner "symbol".
* varobj.c (varobj_update): Rename inner "newobj",
"type_changed".
* valprint.c (generic_emit_char): Rename inner "buf".
* valops.c (find_overload_match): Rename inner "temp".
(value_struct_elt_for_reference): Declare "v" in more inner
scope.
* v850-tdep.c (v850_push_dummy_call): Rename "len".
* unittests/array-view-selftests.c (run_tests): Rename inner
"vec".
* tui/tui-stack.c (tui_show_frame_info): Declare "i" in loop
header.
* tracepoint.c (merge_uploaded_trace_state_variables): Declare
"tsv" in more inner scope.
(print_one_static_tracepoint_marker): Rename inner
"tuple_emitter".
* tic6x-tdep.c (tic6x_analyze_prologue): Declare "inst" lower.
(tic6x_push_dummy_call): Don't redeclare "addr".
* target-float.c: Declare "dto" lower.
* symtab.c (lookup_local_symbol): Rename inner "sym".
(find_pc_sect_line): Rename inner "pc".
* stack.c (print_frame): Don't redeclare "gdbarch".
(return_command): Rename inner "gdbarch".
* s390-tdep.c (s390_prologue_frame_unwind_cache): Renam inner
"sp".
* rust-lang.c (rust_internal_print_type): Declare "i" in loop
header.
* rs6000-tdep.c (ppc_process_record): Rename inner "addr".
* riscv-tdep.c (riscv_push_dummy_call): Declare "info" in inner
scope.
* remote.c (remote_target::update_thread_list): Don't redeclare
"tp".
(remote_target::process_initial_stop_replies): Rename inner
"thread".
(remote_target::remote_parse_stop_reply): Don't redeclare "p".
(remote_target::wait_as): Don't redeclare "stop_reply".
(remote_target::get_thread_local_address): Rename inner
"result".
(remote_target::get_tib_address): Likewise.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r-- | gdb/dwarf2read.c | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 929a8be..e0fd565 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -5497,7 +5497,6 @@ read_debug_names_from_section (struct objfile *objfile, const gdb_byte *abbrev_table_start = addr; for (;;) { - unsigned int bytes_read; const ULONGEST index_num = read_unsigned_leb128 (abfd, addr, &bytes_read); addr += bytes_read; if (index_num == 0) @@ -8079,18 +8078,14 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader, dwarf2_build_include_psymtabs (cu, comp_unit_die, pst); if (dwarf_read_debug) - { - struct gdbarch *gdbarch = get_objfile_arch (objfile); - - fprintf_unfiltered (gdb_stdlog, - "Psymtab for %s unit @%s: %s - %s" - ", %d global, %d static syms\n", - per_cu->is_debug_types ? "type" : "comp", - sect_offset_str (per_cu->sect_off), - paddress (gdbarch, pst->text_low (objfile)), - paddress (gdbarch, pst->text_high (objfile)), - pst->n_global_syms, pst->n_static_syms); - } + fprintf_unfiltered (gdb_stdlog, + "Psymtab for %s unit @%s: %s - %s" + ", %d global, %d static syms\n", + per_cu->is_debug_types ? "type" : "comp", + sect_offset_str (per_cu->sect_off), + paddress (gdbarch, pst->text_low (objfile)), + paddress (gdbarch, pst->text_high (objfile)), + pst->n_global_syms, pst->n_static_syms); } /* Subroutine of dwarf2_build_psymtabs_hard to simplify it. @@ -9112,18 +9107,21 @@ add_partial_subprogram (struct partial_die_info *pdi, struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile; struct gdbarch *gdbarch = get_objfile_arch (objfile); CORE_ADDR baseaddr; - CORE_ADDR highpc; - CORE_ADDR lowpc; + CORE_ADDR this_highpc; + CORE_ADDR this_lowpc; baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); - lowpc = (gdbarch_adjust_dwarf2_addr (gdbarch, - pdi->lowpc + baseaddr) - - baseaddr); - highpc = (gdbarch_adjust_dwarf2_addr (gdbarch, - pdi->highpc + baseaddr) - - baseaddr); - addrmap_set_empty (objfile->psymtabs_addrmap, lowpc, highpc - 1, + this_lowpc + = (gdbarch_adjust_dwarf2_addr (gdbarch, + pdi->lowpc + baseaddr) + - baseaddr); + this_highpc + = (gdbarch_adjust_dwarf2_addr (gdbarch, + pdi->highpc + baseaddr) + - baseaddr); + addrmap_set_empty (objfile->psymtabs_addrmap, + this_lowpc, this_highpc - 1, cu->per_cu->v.psymtab); } } @@ -20339,21 +20337,21 @@ dwarf_decode_line_header (sect_offset sect_off, struct dwarf2_cu *cu) /* Read directory table. */ read_formatted_entries (dwarf2_per_objfile, abfd, &line_ptr, lh.get (), &cu->header, - [] (struct line_header *lh, const char *name, + [] (struct line_header *header, const char *name, dir_index d_index, unsigned int mod_time, unsigned int length) { - lh->add_include_dir (name); + header->add_include_dir (name); }); /* Read file name table. */ read_formatted_entries (dwarf2_per_objfile, abfd, &line_ptr, lh.get (), &cu->header, - [] (struct line_header *lh, const char *name, + [] (struct line_header *header, const char *name, dir_index d_index, unsigned int mod_time, unsigned int length) { - lh->add_file_name (name, d_index, mod_time, length); + header->add_file_name (name, d_index, mod_time, length); }); } else |