aboutsummaryrefslogtreecommitdiff
path: root/gdb/infrun.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-04-21 16:16:27 -0600
committerTom Tromey <tom@tromey.com>2018-10-04 22:51:45 -0600
commitb926417afaea99ed17663e06d6654d0048536017 (patch)
treeb26a979c2f74c28f5c8979f55acfdacefdb18cfb /gdb/infrun.c
parent1f88d0c87c37d3a15fa6376335e8b0d1c79d85aa (diff)
downloadgdb-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/infrun.c')
-rw-r--r--gdb/infrun.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c
index f1cd85c..72e2496 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -4747,7 +4747,7 @@ handle_no_resumed (struct execution_control_state *ecs)
if (inf->pid == 0)
continue;
- thread_info *thread = any_live_thread_of_inferior (inf);
+ thread = any_live_thread_of_inferior (inf);
if (thread == NULL)
{
if (debug_infrun)
@@ -5662,13 +5662,13 @@ handle_signal_stop (struct execution_control_state *ecs)
if (debug_infrun)
{
struct regcache *regcache = get_thread_regcache (ecs->event_thread);
- struct gdbarch *gdbarch = regcache->arch ();
+ struct gdbarch *reg_gdbarch = regcache->arch ();
scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
inferior_ptid = ecs->ptid;
fprintf_unfiltered (gdb_stdlog, "infrun: stop_pc = %s\n",
- paddress (gdbarch,
+ paddress (reg_gdbarch,
ecs->event_thread->suspend.stop_pc));
if (target_stopped_by_watchpoint ())
{
@@ -5679,7 +5679,7 @@ handle_signal_stop (struct execution_control_state *ecs)
if (target_stopped_data_address (current_top_target (), &addr))
fprintf_unfiltered (gdb_stdlog,
"infrun: stopped data address = %s\n",
- paddress (gdbarch, addr));
+ paddress (reg_gdbarch, addr));
else
fprintf_unfiltered (gdb_stdlog,
"infrun: (no data address available)\n");
@@ -8461,7 +8461,7 @@ static void
handle_command (const char *args, int from_tty)
{
int digits, wordlen;
- int sigfirst, signum, siglast;
+ int sigfirst, siglast;
enum gdb_signal oursig;
int allsigs;
int nsigs;
@@ -8556,9 +8556,7 @@ handle_command (const char *args, int from_tty)
if (sigfirst > siglast)
{
/* Bet he didn't figure we'd think of this case... */
- signum = sigfirst;
- sigfirst = siglast;
- siglast = signum;
+ std::swap (sigfirst, siglast);
}
}
else
@@ -8578,7 +8576,7 @@ handle_command (const char *args, int from_tty)
/* If any signal numbers or symbol names were found, set flags for
which signals to apply actions to. */
- for (signum = sigfirst; signum >= 0 && signum <= siglast; signum++)
+ for (int signum = sigfirst; signum >= 0 && signum <= siglast; signum++)
{
switch ((enum gdb_signal) signum)
{
@@ -8611,7 +8609,7 @@ Are you sure you want to change it? "),
}
}
- for (signum = 0; signum < nsigs; signum++)
+ for (int signum = 0; signum < nsigs; signum++)
if (sigs[signum])
{
signal_cache_update (-1);