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.
This commit is contained in:
Tom Tromey
2018-04-21 16:16:27 -06:00
parent 1f88d0c87c
commit b926417afa
67 changed files with 637 additions and 511 deletions

View File

@ -1629,7 +1629,7 @@ varobj_update (struct varobj **varp, bool is_explicit)
for which -var-list-children was never invoked. */
if (varobj_is_dynamic_p (v))
{
std::vector<varobj *> changed, type_changed, unchanged, newobj;
std::vector<varobj *> changed, type_changed_vec, unchanged, newobj_vec;
bool children_changed = false;
if (v->frozen)
@ -1661,48 +1661,49 @@ varobj_update (struct varobj **varp, bool is_explicit)
/* If update_dynamic_varobj_children returns false, then we have
a non-conforming pretty-printer, so we skip it. */
if (update_dynamic_varobj_children (v, &changed, &type_changed, &newobj,
&unchanged, &children_changed, true,
v->from, v->to))
if (update_dynamic_varobj_children (v, &changed, &type_changed_vec,
&newobj_vec,
&unchanged, &children_changed,
true, v->from, v->to))
{
if (children_changed || !newobj.empty ())
if (children_changed || !newobj_vec.empty ())
{
r.children_changed = true;
r.newobj = std::move (newobj);
r.newobj = std::move (newobj_vec);
}
/* Push in reverse order so that the first child is
popped from the work stack first, and so will be
added to result first. This does not affect
correctness, just "nicer". */
for (int i = type_changed.size () - 1; i >= 0; --i)
for (int i = type_changed_vec.size () - 1; i >= 0; --i)
{
varobj_update_result r (type_changed[i]);
varobj_update_result item (type_changed_vec[i]);
/* Type may change only if value was changed. */
r.changed = true;
r.type_changed = true;
r.value_installed = true;
item.changed = true;
item.type_changed = true;
item.value_installed = true;
stack.push_back (std::move (r));
stack.push_back (std::move (item));
}
for (int i = changed.size () - 1; i >= 0; --i)
{
varobj_update_result r (changed[i]);
varobj_update_result item (changed[i]);
r.changed = true;
r.value_installed = true;
item.changed = true;
item.value_installed = true;
stack.push_back (std::move (r));
stack.push_back (std::move (item));
}
for (int i = unchanged.size () - 1; i >= 0; --i)
{
if (!unchanged[i]->frozen)
{
varobj_update_result r (unchanged[i]);
varobj_update_result item (unchanged[i]);
r.value_installed = true;
item.value_installed = true;
stack.push_back (std::move (r));
stack.push_back (std::move (item));
}
}
if (r.changed || r.children_changed)