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/valops.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/valops.c')
-rw-r--r-- | gdb/valops.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/gdb/valops.c b/gdb/valops.c index 521f2ca..e6e11a6 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -2675,20 +2675,20 @@ find_overload_match (struct value **args, int nargs, && TYPE_CODE (check_typedef (SYMBOL_TYPE (fsym))) == TYPE_CODE_FUNC) { - char *temp; + char *temp_func; - temp = cp_func_name (qualified_name); + temp_func = cp_func_name (qualified_name); /* If cp_func_name did not remove anything, the name of the symbol did not include scope or argument types - it was probably a C-style function. */ - if (temp) + if (temp_func) { - make_cleanup (xfree, temp); - if (strcmp (temp, qualified_name) == 0) + make_cleanup (xfree, temp_func); + if (strcmp (temp_func, qualified_name) == 0) func_name = NULL; else - func_name = temp; + func_name = temp_func; } } } @@ -3337,7 +3337,7 @@ value_struct_elt_for_reference (struct type *domain, int offset, { struct type *t = check_typedef (curtype); int i; - struct value *v, *result; + struct value *result; if (TYPE_CODE (t) != TYPE_CODE_STRUCT && TYPE_CODE (t) != TYPE_CODE_UNION) @@ -3352,7 +3352,7 @@ value_struct_elt_for_reference (struct type *domain, int offset, { if (field_is_static (&TYPE_FIELD (t, i))) { - v = value_static_field (t, i); + struct value *v = value_static_field (t, i); if (want_address) v = value_addr (v); return v; @@ -3371,7 +3371,7 @@ value_struct_elt_for_reference (struct type *domain, int offset, /* Try to evaluate NAME as a qualified name with implicit this pointer. In this case, attempt to return the equivalent to `this->*(&TYPE::NAME)'. */ - v = value_of_this_silent (current_language); + struct value *v = value_of_this_silent (current_language); if (v != NULL) { struct value *ptr; @@ -3519,7 +3519,7 @@ value_struct_elt_for_reference (struct type *domain, int offset, if (s == NULL) return NULL; - v = read_var_value (s, 0, 0); + struct value *v = read_var_value (s, 0, 0); if (!want_address) result = v; else |