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/eval.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/eval.c')
-rw-r--r-- | gdb/eval.c | 46 |
1 files changed, 23 insertions, 23 deletions
@@ -1674,7 +1674,7 @@ evaluate_subexp_standard (struct type *expect_type, only). */ if (gnu_runtime) { - struct type *type = selector_type; + type = selector_type; type = lookup_function_type (type); type = lookup_pointer_type (type); @@ -1861,18 +1861,18 @@ evaluate_subexp_standard (struct type *expect_type, it's opinion (ie. through "whatis"), it won't offer it. */ - struct type *type = value_type (called_method); + struct type *callee_type = value_type (called_method); - if (type && TYPE_CODE (type) == TYPE_CODE_PTR) - type = TYPE_TARGET_TYPE (type); - type = TYPE_TARGET_TYPE (type); + if (callee_type && TYPE_CODE (callee_type) == TYPE_CODE_PTR) + callee_type = TYPE_TARGET_TYPE (callee_type); + callee_type = TYPE_TARGET_TYPE (callee_type); - if (type) + if (callee_type) { - if ((TYPE_CODE (type) == TYPE_CODE_ERROR) && expect_type) + if ((TYPE_CODE (callee_type) == TYPE_CODE_ERROR) && expect_type) return allocate_value (expect_type); else - return allocate_value (type); + return allocate_value (callee_type); } else error (_("Expression of type other than " @@ -2048,15 +2048,15 @@ evaluate_subexp_standard (struct type *expect_type, with rtti type in order to continue on with successful lookup of member / method only available in the rtti type. */ { - struct type *type = value_type (arg1); + struct type *arg_type = value_type (arg1); struct type *real_type; int full, using_enc; LONGEST top; struct value_print_options opts; get_user_print_options (&opts); - if (opts.objectprint && TYPE_TARGET_TYPE(type) - && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT)) + if (opts.objectprint && TYPE_TARGET_TYPE (arg_type) + && (TYPE_CODE (TYPE_TARGET_TYPE (arg_type)) == TYPE_CODE_STRUCT)) { real_type = value_rtti_indirect_type (arg1, &full, &top, &using_enc); @@ -2121,9 +2121,10 @@ evaluate_subexp_standard (struct type *expect_type, for (ix = 0; ix < nargs; ++ix) arg_types[ix] = exp->elts[pc + 2 + ix + 1].type; - fake_method expect_type (flags, nargs, arg_types); + fake_method fake_expect_type (flags, nargs, arg_types); *(pos) += 4 + nargs; - return evaluate_subexp_standard (expect_type.type (), exp, pos, noside); + return evaluate_subexp_standard (fake_expect_type.type (), exp, pos, + noside); } case BINOP_CONCAT: @@ -2704,9 +2705,8 @@ evaluate_subexp_standard (struct type *expect_type, case UNOP_ALIGNOF: { - struct type *type - = value_type (evaluate_subexp (NULL_TYPE, exp, pos, - EVAL_AVOID_SIDE_EFFECTS)); + type = value_type (evaluate_subexp (NULL_TYPE, exp, pos, + EVAL_AVOID_SIDE_EFFECTS)); /* FIXME: This should be size_t. */ struct type *size_type = builtin_type (exp->gdbarch)->builtin_int; ULONGEST align = type_align (type); @@ -2905,7 +2905,7 @@ evaluate_subexp_standard (struct type *expect_type, || sub_op == STRUCTOP_PTR || sub_op == OP_SCOPE)) { - struct type *type = value_type (result); + type = value_type (result); if (!TYPE_IS_REFERENCE (type)) { @@ -3193,11 +3193,11 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos, (*pos) += 4; minimal_symbol *msymbol = exp->elts[pc + 2].msymbol; - value *val = evaluate_var_msym_value (noside, - exp->elts[pc + 1].objfile, - msymbol); + value *mval = evaluate_var_msym_value (noside, + exp->elts[pc + 1].objfile, + msymbol); - type = value_type (val); + type = value_type (mval); if (TYPE_CODE (type) == TYPE_CODE_ERROR) error_unknown_type (MSYMBOL_PRINT_NAME (msymbol)); @@ -3212,9 +3212,9 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos, case BINOP_SUBSCRIPT: if (noside == EVAL_NORMAL) { - int pc = (*pos) + 1; + int npc = (*pos) + 1; - val = evaluate_subexp (NULL_TYPE, exp, &pc, EVAL_AVOID_SIDE_EFFECTS); + val = evaluate_subexp (NULL_TYPE, exp, &npc, EVAL_AVOID_SIDE_EFFECTS); type = check_typedef (value_type (val)); if (TYPE_CODE (type) == TYPE_CODE_ARRAY) { |