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/mdebugread.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/mdebugread.c')
-rw-r--r-- | gdb/mdebugread.c | 74 |
1 files changed, 38 insertions, 36 deletions
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 39276ab..453b8d5 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -593,7 +593,6 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, struct block *b; struct mdebug_pending *pend; struct type *t; - struct field *f; int count = 1; TIR tir; long svalue = sh->value; @@ -1155,7 +1154,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, const struct blockvector *bv = SYMTAB_BLOCKVECTOR (top_stack->cur_st); struct mdebug_extra_func_info *e; - struct block *b = top_stack->cur_block; + struct block *cblock = top_stack->cur_block; struct type *ftype = top_stack->cur_type; int i; @@ -1179,12 +1178,12 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, { struct block *b_bad = BLOCKVECTOR_BLOCK (bv, i); - if (BLOCK_SUPERBLOCK (b_bad) == b + if (BLOCK_SUPERBLOCK (b_bad) == cblock && BLOCK_START (b_bad) == top_stack->procadr && BLOCK_END (b_bad) == top_stack->procadr) { - BLOCK_START (b_bad) = BLOCK_START (b); - BLOCK_END (b_bad) = BLOCK_END (b); + BLOCK_START (b_bad) = BLOCK_START (cblock); + BLOCK_END (b_bad) = BLOCK_END (cblock); } } @@ -1205,7 +1204,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, TYPE_ALLOC (ftype, nparams * sizeof (struct field)); iparams = 0; - ALL_BLOCK_SYMBOLS (b, iter, sym) + ALL_BLOCK_SYMBOLS (cblock, iter, sym) { if (iparams == nparams) break; @@ -1246,13 +1245,16 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, break; case stMember: /* member of struct or union */ - f = &TYPE_FIELDS (top_stack->cur_type)[top_stack->cur_field++]; - FIELD_NAME (*f) = name; - SET_FIELD_BITPOS (*f, sh->value); - bitsize = 0; - FIELD_TYPE (*f) = parse_type (cur_fd, ax, sh->index, - &bitsize, bigend, name); - FIELD_BITSIZE (*f) = bitsize; + { + struct field *f + = &TYPE_FIELDS (top_stack->cur_type)[top_stack->cur_field++]; + FIELD_NAME (*f) = name; + SET_FIELD_BITPOS (*f, sh->value); + bitsize = 0; + FIELD_TYPE (*f) = parse_type (cur_fd, ax, sh->index, + &bitsize, bigend, name); + FIELD_BITSIZE (*f) = bitsize; + } break; case stIndirect: /* forward declaration on Irix5 */ @@ -2383,10 +2385,10 @@ parse_partial_symbols (minimal_symbol_reader &reader, fdr_to_pst = fdr_to_pst_holder.data (); fdr_to_pst++; { - struct partial_symtab *pst = new_psymtab ("", objfile); + struct partial_symtab *new_pst = new_psymtab ("", objfile); - fdr_to_pst[-1].pst = pst; - FDR_IDX (pst) = -1; + fdr_to_pst[-1].pst = new_pst; + FDR_IDX (new_pst) = -1; } /* Allocate the global pending list. */ @@ -2885,7 +2887,7 @@ parse_partial_symbols (minimal_symbol_reader &reader, case N_SO: { static int prev_so_symnum = -10; - const char *p; + const char *basename; /* A zero value is probably an indication for the SunPRO 3.0 compiler. dbx_end_psymtab explicitly tests @@ -2925,8 +2927,8 @@ parse_partial_symbols (minimal_symbol_reader &reader, the second the file name. If pst exists, is empty, and has a filename ending in '/', we assume the previous N_SO was a directory name. */ - p = lbasename (namestring); - if (p != namestring && *p == '\000') + basename = lbasename (namestring); + if (basename != namestring && *basename == '\000') continue; /* Simply ignore directory name SOs. */ @@ -3353,7 +3355,7 @@ parse_partial_symbols (minimal_symbol_reader &reader, { for (cur_sdx = 0; cur_sdx < fh->csym;) { - char *name; + char *sym_name; enum address_class theclass; CORE_ADDR minsym_value; short section = -1; @@ -3380,7 +3382,7 @@ parse_partial_symbols (minimal_symbol_reader &reader, continue; } - name = debug_info->ss + fh->issBase + sh.iss; + sym_name = debug_info->ss + fh->issBase + sh.iss; minsym_value = sh.value; @@ -3413,7 +3415,7 @@ parse_partial_symbols (minimal_symbol_reader &reader, int new_sdx; case stStaticProc: - reader.record_with_info (name, minsym_value, + reader.record_with_info (sym_name, minsym_value, mst_file_text, SECT_OFF_TEXT (objfile)); @@ -3425,7 +3427,7 @@ parse_partial_symbols (minimal_symbol_reader &reader, { /* Should not happen, but does when cross-compiling with the MIPS compiler. FIXME -- pull later. */ - index_complaint (name); + index_complaint (sym_name); new_sdx = cur_sdx + 1; /* Don't skip at all. */ } else @@ -3438,7 +3440,7 @@ parse_partial_symbols (minimal_symbol_reader &reader, { /* This should not happen either... FIXME. */ complaint (_("bad proc end in aux found from symbol %s"), - name); + sym_name); new_sdx = cur_sdx + 1; /* Don't skip backward. */ } @@ -3464,13 +3466,13 @@ parse_partial_symbols (minimal_symbol_reader &reader, symbol table, and the MAIN__ symbol via the minimal symbol table. */ if (sh.st == stProc) - add_psymbol_to_list (name, strlen (name), 1, + add_psymbol_to_list (sym_name, strlen (sym_name), 1, VAR_DOMAIN, LOC_BLOCK, section, &objfile->global_psymbols, sh.value, psymtab_language, objfile); else - add_psymbol_to_list (name, strlen (name), 1, + add_psymbol_to_list (sym_name, strlen (sym_name), 1, VAR_DOMAIN, LOC_BLOCK, section, &objfile->static_psymbols, @@ -3500,11 +3502,11 @@ parse_partial_symbols (minimal_symbol_reader &reader, case stStatic: /* Variable */ if (SC_IS_DATA (sh.sc)) - reader.record_with_info (name, minsym_value, + reader.record_with_info (sym_name, minsym_value, mst_file_data, SECT_OFF_DATA (objfile)); else - reader.record_with_info (name, minsym_value, + reader.record_with_info (sym_name, minsym_value, mst_file_bss, SECT_OFF_BSS (objfile)); theclass = LOC_STATIC; @@ -3537,7 +3539,7 @@ parse_partial_symbols (minimal_symbol_reader &reader, && sh.iss != 0 && sh.index != cur_sdx + 2) { - add_psymbol_to_list (name, strlen (name), 1, + add_psymbol_to_list (sym_name, strlen (sym_name), 1, STRUCT_DOMAIN, LOC_TYPEDEF, -1, &objfile->static_psymbols, 0, psymtab_language, objfile); @@ -3549,7 +3551,8 @@ parse_partial_symbols (minimal_symbol_reader &reader, if (new_sdx <= cur_sdx) { /* This happens with the Ultrix kernel. */ - complaint (_("bad aux index at block symbol %s"), name); + complaint (_("bad aux index at block symbol %s"), + sym_name); new_sdx = cur_sdx + 1; /* Don't skip backward. */ } cur_sdx = new_sdx; @@ -3567,16 +3570,16 @@ parse_partial_symbols (minimal_symbol_reader &reader, goto skip; default: - /* Both complaints are valid: one gives symbol name, + /* Both complaints are valid: one gives symbol sym_name, the other the offending symbol type. */ complaint (_("unknown local symbol %s"), - name); + sym_name); complaint (_("with type %d"), sh.st); cur_sdx++; continue; } /* Use this gdb symbol. */ - add_psymbol_to_list (name, strlen (name), 1, + add_psymbol_to_list (sym_name, strlen (sym_name), 1, VAR_DOMAIN, theclass, section, &objfile->static_psymbols, sh.value, psymtab_language, objfile); @@ -3593,7 +3596,6 @@ parse_partial_symbols (minimal_symbol_reader &reader, { enum address_class theclass; SYMR *psh; - char *name; CORE_ADDR svalue; short section; @@ -3655,8 +3657,8 @@ parse_partial_symbols (minimal_symbol_reader &reader, theclass = LOC_STATIC; break; } - name = debug_info->ssext + psh->iss; - add_psymbol_to_list (name, strlen (name), 1, + char *sym_name = debug_info->ssext + psh->iss; + add_psymbol_to_list (sym_name, strlen (sym_name), 1, VAR_DOMAIN, theclass, section, &objfile->global_psymbols, |