aboutsummaryrefslogtreecommitdiff
path: root/gdb
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
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')
-rw-r--r--gdb/ChangeLog153
-rw-r--r--gdb/arch/arm-get-next-pcs.c8
-rw-r--r--gdb/arm-tdep.c6
-rw-r--r--gdb/breakpoint.c26
-rw-r--r--gdb/c-exp.y2
-rw-r--r--gdb/cli/cli-cmds.c11
-rw-r--r--gdb/cli/cli-utils.c7
-rw-r--r--gdb/coffread.c12
-rw-r--r--gdb/common/agent.c1
-rw-r--r--gdb/compile/compile.c8
-rw-r--r--gdb/cp-support.c3
-rw-r--r--gdb/cp-valprint.c2
-rw-r--r--gdb/csky-tdep.c3
-rw-r--r--gdb/ctf.c10
-rw-r--r--gdb/disasm-selftests.c8
-rw-r--r--gdb/disasm.c7
-rw-r--r--gdb/dwarf2-frame.c12
-rw-r--r--gdb/dwarf2expr.c10
-rw-r--r--gdb/dwarf2loc.c23
-rw-r--r--gdb/dwarf2read.c50
-rw-r--r--gdb/elfread.c4
-rw-r--r--gdb/eval.c46
-rw-r--r--gdb/f-exp.y11
-rw-r--r--gdb/findvar.c2
-rw-r--r--gdb/guile/scm-symbol.c4
-rw-r--r--gdb/hppa-bsd-tdep.c2
-rw-r--r--gdb/ia64-tdep.c17
-rw-r--r--gdb/infrun.c18
-rw-r--r--gdb/linespec.c26
-rw-r--r--gdb/linux-tdep.c8
-rw-r--r--gdb/machoread.c2
-rw-r--r--gdb/main.c16
-rw-r--r--gdb/mdebugread.c74
-rw-r--r--gdb/mep-tdep.c3
-rw-r--r--gdb/mi/mi-cmd-var.c2
-rw-r--r--gdb/mi/mi-main.c10
-rw-r--r--gdb/microblaze-tdep.c7
-rw-r--r--gdb/mips-tdep.c38
-rw-r--r--gdb/nat/linux-osdata.c72
-rw-r--r--gdb/nios2-tdep.c21
-rw-r--r--gdb/objfiles.c10
-rw-r--r--gdb/p-exp.y9
-rw-r--r--gdb/p-valprint.c134
-rw-r--r--gdb/parse.c6
-rw-r--r--gdb/ppc-linux-tdep.c7
-rw-r--r--gdb/ppc-sysv-tdep.c11
-rw-r--r--gdb/record-btrace.c4
-rw-r--r--gdb/regcache.c21
-rw-r--r--gdb/remote.c30
-rw-r--r--gdb/riscv-tdep.c6
-rw-r--r--gdb/rs6000-tdep.c24
-rw-r--r--gdb/rust-lang.c8
-rw-r--r--gdb/s390-tdep.c6
-rw-r--r--gdb/stack.c5
-rw-r--r--gdb/symtab.c10
-rw-r--r--gdb/target-float.c3
-rw-r--r--gdb/tic6x-tdep.c4
-rw-r--r--gdb/tracepoint.c5
-rw-r--r--gdb/tui/tui-stack.c3
-rw-r--r--gdb/unittests/array-view-selftests.c8
-rw-r--r--gdb/v850-tdep.c6
-rw-r--r--gdb/valops.c20
-rw-r--r--gdb/valprint.c8
-rw-r--r--gdb/varobj.c39
-rw-r--r--gdb/xcoffread.c8
-rw-r--r--gdb/xstormy16-tdep.c3
-rw-r--r--gdb/xtensa-tdep.c9
67 files changed, 639 insertions, 513 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0e5a3f4..6284051 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,156 @@
+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.
+
+ * regcache.c (cooked_read_test): Rename "regnum".
+ * record-btrace.c (cmd_record_btrace_start): Rename inner
+ "exception".
+ * ppc-sysv-tdep.c (ppc64_sysv_abi_return_value): Declare "i" in
+ loop header.
+ * ppc-linux-tdep.c (ppc_linux_syscall_record): Declare "i" in loop
+ header.
+ (ppu2spu_sniffer): Rename inner "buf".
+ * parse.c (operator_check_standard): Rename inner "type",
+ "objfile".
+ * p-valprint.c (pascal_val_print): Introduce new scope for
+ "low_bound", "high_bound".
+ * p-exp.y (yylex): Declare "i" in loop header.
+ * objfiles.c (objfile_relocate1): Declare "i" in loop header.
+ Lower declaration of "s".
+ * nios2-tdep.c (nios2_analyze_prologue): Declare "i" in loop
+ header.
+ (nios2_push_dummy_call): Rename "len".
+ * nat/linux-osdata.c (linux_xfer_osdata_cpus): Rename static
+ "buf".
+ (linux_xfer_osdata_fds, linux_xfer_osdata_shm)
+ (linux_xfer_osdata_sem, linux_xfer_osdata_msg)
+ (linux_xfer_osdata_modules): Likewise.
+ * mips-tdep.c (mips_eabi_push_dummy_call): Rename outer "len".
+ (mips_n32n64_push_dummy_call, mips_o32_push_dummy_call)
+ (mips_o64_push_dummy_call): Likewise.
+ * microblaze-tdep.c (microblaze_analyze_prologue): Rename inner
+ "op".
+ * mi/mi-main.c (list_available_thread_groups): Rename inner
+ "tuple_emitter".
+ (mi_cmd_data_read_memory): Rename inner "opts".
+ * mi/mi-cmd-var.c (varobj_update_one): Rename inner
+ "tuple_emitter".
+ * mep-tdep.c (mep_analyze_prologue): Declare "rn" in loop header.
+ * mdebugread.c (parse_symbol): Rename inner "b". Declare "f" in
+ more inner scope.
+ (parse_partial_symbols): Rename inner "pst", "p", "name"
+ * main.c (captured_main_1): Rename inner "i"s.
+ * machoread.c (macho_symfile_read_all_oso): Don't redeclare
+ "oso2".
+ * linux-tdep.c (linux_info_proc): Rename inner "filename".
+ * linespec.c (linespec_lexer_lex_string): Rename inner "p".
+ * infrun.c (handle_no_resumed): Don't redeclare "thread".
+ (handle_signal_stop): Rename inner "gdbarch".
+ (handle_command): Declare "signum" in loop header.
+ * ia64-tdep.c (ia64_pseudo_register_read): Don't redeclare
+ "status".
+ (examine_prologue): Rename inner "sol" and "sof".
+ (ia64_extract_return_value): Rename inner "val". Declare another
+ "val" in a more inner scope.
+ * hppa-bsd-tdep.c (hppabsd_find_global_pointer): Declare "buf" in
+ inner scope.
+ * guile/scm-symbol.c (gdbscm_lookup_symbol): Rename inner
+ "except".
+ * findvar.c (default_read_var_value): Don't redeclare "addr".
+ * f-exp.y (yylex): Declare "i" in loop header.
+ * eval.c (evaluate_subexp_standard): Don't redeclare "type".
+ Rename inner "type", "expect_type".
+ (evaluate_subexp_for_sizeof): Rename inner "pc".
+ * elfread.c (elf_symfile_read): Rename inner "abfd".
+ * dwarf2read.c (read_debug_names_from_section): Don't redeclare
+ "bytes_read".
+ (process_psymtab_comp_unit_reader): Don't redeclare "gdbarch".
+ (add_partial_subprogram): Rename inner "lowpc" and "highpc".
+ (dwarf_decode_line_header): Rename inner "lh".
+ * dwarf2loc.c (dwarf2_compile_expr_to_ax): Don't redeclare
+ "offset". Declare "i" in loop header.
+ (disassemble_dwarf_expression): Rename inner "addr_size".
+ * dwarf2expr.c (dwarf_expr_context::execute_stack_op): Rename
+ inner "result".
+ (dwarf_expr_context::execute_stack_op): Rename inner "offset".
+ * dwarf2-frame.c (decode_frame_entry_1): Rename inner "length"s.
+ * disasm.c (do_mixed_source_and_assembly_deprecated): Rename inner
+ "inner_list_emitter".
+ (do_mixed_source_and_assembly): Rename inner "tuple_emitter".
+ * disasm-selftests.c (print_one_insn_test): Wrap "bplen"
+ declaration in a block.
+ * csky-tdep.c (csky_analyze_prologue): Declare "offset" lower.
+ * cp-valprint.c (cp_print_value_fields): Don't redeclare
+ "obstack_final_size".
+ * cp-support.c (inspect_type): Declare "i" in loop header.
+ * compile/compile.c (compile_instance::insert_symbol_error):
+ Rename inner "e".
+ * common/agent.c (agent_run_command): Remove inner "ret"
+ declaration.
+ * coffread.c (coff_symfile_read): Rename inner "name".
+ (coff_symfile_read): Rename inner "abfd".
+ * cli/cli-utils.c (get_number_trailer): Rename inner "val".
+ * cli/cli-cmds.c (print_disassembly): Rename inner "low" and
+ "high".
+ * c-exp.y (lex_one_token): Move "len" declaration lower.
+ * breakpoint.c (create_longjmp_master_breakpoint): Don't redeclare
+ "gdbarch".
+ (create_exception_master_breakpoint): Likewise. Don't redeclare
+ "b".
+ (watch_command_1): Declare "mark" later.
+ (clear_command): Don't shadow "a" or "b".
+ (delete_command): Rename inner "b".
+ (delete_trace_command): Likewise.
+ * arm-tdep.c (thumb_process_displaced_32bit_insn): Rename inner
+ "op".
+ (arm_gdbarch_init): Remove inner "e_flags".
+ * arch/arm-get-next-pcs.c (thumb_get_next_pcs_raw): Declare
+ "offset" in inner blocks.
+
2018-10-04 Simon Marchi <simon.marchi@ericsson.com>
* dwarf-index-write.c (file_write): Don't write if the vector is
diff --git a/gdb/arch/arm-get-next-pcs.c b/gdb/arch/arm-get-next-pcs.c
index 3178bf3..256d5f8 100644
--- a/gdb/arch/arm-get-next-pcs.c
+++ b/gdb/arch/arm-get-next-pcs.c
@@ -271,7 +271,6 @@ thumb_get_next_pcs_raw (struct arm_get_next_pcs *self)
unsigned long pc_val = ((unsigned long) pc) + 4; /* PC after prefetch */
unsigned short inst1;
CORE_ADDR nextpc = pc + 2; /* Default is next instruction. */
- unsigned long offset;
ULONGEST status, itstate;
struct regcache *regcache = self->regcache;
std::vector<CORE_ADDR> next_pcs;
@@ -409,7 +408,7 @@ thumb_get_next_pcs_raw (struct arm_get_next_pcs *self)
/* Fetch the saved PC from the stack. It's stored above
all of the other registers. */
- offset = bitcount (bits (inst1, 0, 7)) * INT_REGISTER_SIZE;
+ unsigned long offset = bitcount (bits (inst1, 0, 7)) * INT_REGISTER_SIZE;
sp = regcache_raw_get_unsigned (regcache, ARM_SP_REGNUM);
nextpc = self->ops->read_mem_uint (sp + offset, 4, byte_order);
}
@@ -450,7 +449,7 @@ thumb_get_next_pcs_raw (struct arm_get_next_pcs *self)
j1 = bit (inst2, 13);
j2 = bit (inst2, 11);
- offset = ((imm1 << 12) + (imm2 << 1));
+ unsigned long offset = ((imm1 << 12) + (imm2 << 1));
offset ^= ((!j2) << 22) | ((!j1) << 23);
nextpc = pc_val + offset;
@@ -477,7 +476,8 @@ thumb_get_next_pcs_raw (struct arm_get_next_pcs *self)
j1 = bit (inst2, 13);
j2 = bit (inst2, 11);
- offset = (sign << 20) + (j2 << 19) + (j1 << 18);
+ unsigned long offset
+ = (sign << 20) + (j2 << 19) + (j1 << 18);
offset += (imm1 << 12) + (imm2 << 1);
nextpc = pc_val + offset;
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index c3280ee..53eee76 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -7460,9 +7460,9 @@ thumb_process_displaced_32bit_insn (struct gdbarch *gdbarch, uint16_t insn1,
{
if (bit (insn1, 9)) /* Data processing (plain binary imm). */
{
- int op = bits (insn1, 4, 8);
+ int dp_op = bits (insn1, 4, 8);
int rn = bits (insn1, 0, 3);
- if ((op == 0 || op == 0xa) && rn == 0xf)
+ if ((dp_op == 0 || dp_op == 0xa) && rn == 0xf)
err = thumb_copy_pc_relative_32bit (gdbarch, insn1, insn2,
regs, dsc);
else
@@ -9046,8 +9046,6 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
if (fp_model == ARM_FLOAT_AUTO)
{
- int e_flags = elf_elfheader (info.abfd)->e_flags;
-
switch (e_flags & (EF_ARM_SOFT_FLOAT | EF_ARM_VFP_FLOAT))
{
case 0:
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index eb408d7..3d25434 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -3300,8 +3300,6 @@ create_longjmp_master_breakpoint (void)
if (!bp_objfile_data->longjmp_probes.empty ())
{
- struct gdbarch *gdbarch = get_objfile_arch (objfile);
-
for (probe *p : bp_objfile_data->longjmp_probes)
{
struct breakpoint *b;
@@ -3453,12 +3451,10 @@ create_exception_master_breakpoint (void)
if (!bp_objfile_data->exception_probes.empty ())
{
- struct gdbarch *gdbarch = get_objfile_arch (objfile);
+ gdbarch = get_objfile_arch (objfile);
for (probe *p : bp_objfile_data->exception_probes)
{
- struct breakpoint *b;
-
b = create_internal_breakpoint (gdbarch,
p->get_relocated_address (objfile),
bp_exception_master,
@@ -10518,7 +10514,7 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
{
struct breakpoint *scope_breakpoint = NULL;
const struct block *exp_valid_block = NULL, *cond_exp_valid_block = NULL;
- struct value *mark, *result;
+ struct value *result;
int saved_bitpos = 0, saved_bitsize = 0;
const char *exp_start = NULL;
const char *exp_end = NULL;
@@ -10643,7 +10639,7 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
}
exp_valid_block = innermost_block.block ();
- mark = value_mark ();
+ struct value *mark = value_mark ();
struct value *val_as_value = nullptr;
fetch_subexp_value (exp.get (), &pc, &val_as_value, &result, NULL,
just_location);
@@ -11494,14 +11490,14 @@ clear_command (const char *arg, int from_tty)
/* Remove duplicates from the vec. */
std::sort (found.begin (), found.end (),
- [] (const breakpoint *a, const breakpoint *b)
+ [] (const breakpoint *bp_a, const breakpoint *bp_b)
{
- return compare_breakpoints (a, b) < 0;
+ return compare_breakpoints (bp_a, bp_b) < 0;
});
found.erase (std::unique (found.begin (), found.end (),
- [] (const breakpoint *a, const breakpoint *b)
+ [] (const breakpoint *bp_a, const breakpoint *bp_b)
{
- return compare_breakpoints (a, b) == 0;
+ return compare_breakpoints (bp_a, bp_b) == 0;
}),
found.end ());
@@ -13290,9 +13286,9 @@ delete_command (const char *arg, int from_tty)
}
else
map_breakpoint_numbers
- (arg, [&] (breakpoint *b)
+ (arg, [&] (breakpoint *br)
{
- iterate_over_related_breakpoints (b, delete_breakpoint);
+ iterate_over_related_breakpoints (br, delete_breakpoint);
});
}
@@ -14861,9 +14857,9 @@ delete_trace_command (const char *arg, int from_tty)
}
else
map_breakpoint_numbers
- (arg, [&] (breakpoint *b)
+ (arg, [&] (breakpoint *br)
{
- iterate_over_related_breakpoints (b, delete_breakpoint);
+ iterate_over_related_breakpoints (br, delete_breakpoint);
});
}
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 09e31d2..bfc7841 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -2660,7 +2660,6 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
case '@':
{
const char *p = &tokstart[1];
- size_t len = strlen ("entry");
if (parse_language (par_state)->la_language == language_objc)
{
@@ -2678,6 +2677,7 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
while (ISSPACE (*p))
p++;
+ size_t len = strlen ("entry");
if (strncmp (p, "entry", len) == 0 && !c_ident_is_alnum (p[len])
&& p[len] != '_')
{
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index c60e5ef..b871e47 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1123,12 +1123,13 @@ print_disassembly (struct gdbarch *gdbarch, const char *name,
{
for (int i = 0; i < BLOCK_NRANGES (block); i++)
{
- CORE_ADDR low = BLOCK_RANGE_START (block, i);
- CORE_ADDR high = BLOCK_RANGE_END (block, i);
+ CORE_ADDR range_low = BLOCK_RANGE_START (block, i);
+ CORE_ADDR range_high = BLOCK_RANGE_END (block, i);
printf_filtered (_("Address range %s to %s:\n"),
- paddress (gdbarch, low),
- paddress (gdbarch, high));
- gdb_disassembly (gdbarch, current_uiout, flags, -1, low, high);
+ paddress (gdbarch, range_low),
+ paddress (gdbarch, range_high));
+ gdb_disassembly (gdbarch, current_uiout, flags, -1,
+ range_low, range_high);
}
}
printf_filtered ("End of assembler dump.\n");
diff --git a/gdb/cli/cli-utils.c b/gdb/cli/cli-utils.c
index 98b7414..30ee445 100644
--- a/gdb/cli/cli-utils.c
+++ b/gdb/cli/cli-utils.c
@@ -58,15 +58,16 @@ get_number_trailer (const char **pp, int trailer)
null-terminate it to pass to lookup_internalvar(). */
char *varname;
const char *start = ++p;
- LONGEST val;
+ LONGEST longest_val;
while (isalnum (*p) || *p == '_')
p++;
varname = (char *) alloca (p - start + 1);
strncpy (varname, start, p - start);
varname[p - start] = '\0';
- if (get_internalvar_integer (lookup_internalvar (varname), &val))
- retval = (int) val;
+ if (get_internalvar_integer (lookup_internalvar (varname),
+ &longest_val))
+ retval = (int) longest_val;
else
{
printf_filtered (_("Convenience variable must "
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 623467d..a473b78 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -565,7 +565,7 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
struct coff_symfile_info *info;
bfd *abfd = objfile->obfd;
coff_data_type *cdata = coff_data (abfd);
- char *name = bfd_get_filename (abfd);
+ char *filename = bfd_get_filename (abfd);
int val;
unsigned int num_symbols;
int symtab_offset;
@@ -637,7 +637,7 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
val = init_lineno (abfd, info->min_lineno_offset,
info->max_lineno_offset - info->min_lineno_offset);
if (val < 0)
- error (_("\"%s\": error reading line numbers."), name);
+ error (_("\"%s\": error reading line numbers."), filename);
}
/* Now read the string table, all at once. */
@@ -645,7 +645,7 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
make_cleanup (free_stringtab_cleanup, 0 /*ignore*/);
val = init_stringtab (abfd, stringtab_offset);
if (val < 0)
- error (_("\"%s\": can't get string table"), name);
+ error (_("\"%s\": can't get string table"), filename);
minimal_symbol_reader reader (objfile);
@@ -709,7 +709,7 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
{
error (_("The debugging information in `%s' is corrupted.\nThe "
"file has a `.stabs' section, but no `.stabstr' section."),
- name);
+ filename);
}
/* FIXME: dubious. Why can't we use something normal like
@@ -741,9 +741,9 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
if (!debugfile.empty ())
{
- gdb_bfd_ref_ptr abfd (symfile_bfd_open (debugfile.c_str ()));
+ gdb_bfd_ref_ptr debug_bfd (symfile_bfd_open (debugfile.c_str ()));
- symbol_file_add_separate (abfd.get (), debugfile.c_str (),
+ symbol_file_add_separate (debug_bfd.get (), debugfile.c_str (),
symfile_flags, objfile);
}
}
diff --git a/gdb/common/agent.c b/gdb/common/agent.c
index 41884b9..1ea62d2 100644
--- a/gdb/common/agent.c
+++ b/gdb/common/agent.c
@@ -212,7 +212,6 @@ agent_run_command (int pid, const char *cmd, int len)
if (fd >= 0)
{
char buf[1] = "";
- int ret;
DEBUG_AGENT ("agent: signalling helper thread\n");
diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c
index 02c162c..ec644a7 100644
--- a/gdb/compile/compile.c
+++ b/gdb/compile/compile.c
@@ -195,11 +195,11 @@ compile_instance::insert_symbol_error (const struct symbol *sym,
slot = htab_find_slot (m_symbol_err_map.get (), &e, INSERT);
if (*slot == NULL)
{
- struct symbol_error *e = XNEW (struct symbol_error);
+ struct symbol_error *ep = XNEW (struct symbol_error);
- e->sym = sym;
- e->message = xstrdup (text);
- *slot = e;
+ ep->sym = sym;
+ ep->message = xstrdup (text);
+ *slot = ep;
}
}
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index 3ce5f60..25c8870 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -133,7 +133,6 @@ inspect_type (struct demangle_parse_info *info,
canonicalization_ftype *finder,
void *data)
{
- int i;
char *name;
struct symbol *sym;
@@ -144,7 +143,7 @@ inspect_type (struct demangle_parse_info *info,
name[ret_comp->u.s_name.len] = '\0';
/* Ignore any typedefs that should not be substituted. */
- for (i = 0; i < ARRAY_SIZE (ignore_typedefs); ++i)
+ for (int i = 0; i < ARRAY_SIZE (ignore_typedefs); ++i)
{
if (strcmp (name, ignore_typedefs[i]) == 0)
return 0;
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index f67eaed..3cece92 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -378,7 +378,7 @@ cp_print_value_fields (struct type *type, struct type *real_type,
if (last_set_recurse != recurse)
{
- size_t obstack_final_size =
+ obstack_final_size =
obstack_object_size (&dont_print_stat_array_obstack);
if (obstack_final_size > stat_array_obstack_initial_size)
diff --git a/gdb/csky-tdep.c b/gdb/csky-tdep.c
index 95bcead..f843732 100644
--- a/gdb/csky-tdep.c
+++ b/gdb/csky-tdep.c
@@ -1205,7 +1205,6 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
else if (CSKY_16_IS_LRW4 (insn) || CSKY_16_IS_MOVI4 (insn))
{
int adjust = 0;
- int offset = 0;
unsigned int insn2;
if (csky_debug)
@@ -1239,7 +1238,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
fprintf_unfiltered (gdb_stdlog,
"csky: looking for r4 adjusters...\n");
}
- offset = 2;
+ int offset = 2;
insn_len = csky_get_insn (gdbarch, addr + offset, &insn2);
while (CSKY_IS_R4_ADJUSTER (insn2))
{
diff --git a/gdb/ctf.c b/gdb/ctf.c
index 43bb18e..ca5266f 100644
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -1011,14 +1011,14 @@ ctf_read_tsv (struct uploaded_tsv **uploaded_tsvs)
#define SET_ARRAY_FIELD(EVENT, SCOPE, VAR, NUM, ARRAY) \
do \
{ \
- uint32_t u32, i; \
+ uint32_t lu32, i; \
const struct bt_definition *def; \
\
- u32 = (uint32_t) bt_ctf_get_uint64 (bt_ctf_get_field ((EVENT), \
- (SCOPE), \
- #NUM)); \
+ lu32 = (uint32_t) bt_ctf_get_uint64 (bt_ctf_get_field ((EVENT), \
+ (SCOPE), \
+ #NUM)); \
def = bt_ctf_get_field ((EVENT), (SCOPE), #ARRAY); \
- for (i = 0; i < u32; i++) \
+ for (i = 0; i < lu32; i++) \
{ \
const struct bt_definition *element \
= bt_ctf_get_index ((EVENT), def, i); \
diff --git a/gdb/disasm-selftests.c b/gdb/disasm-selftests.c
index 8cc2676..67fc425 100644
--- a/gdb/disasm-selftests.c
+++ b/gdb/disasm-selftests.c
@@ -81,9 +81,11 @@ print_one_insn_test (struct gdbarch *gdbarch)
/* nios2, riscv, and score need to know the current instruction
to select breakpoint instruction. Give the breakpoint
instruction kind explicitly. */
- int bplen;
- insn = gdbarch_sw_breakpoint_from_kind (gdbarch, 4, &bplen);
- len = bplen;
+ {
+ int bplen;
+ insn = gdbarch_sw_breakpoint_from_kind (gdbarch, 4, &bplen);
+ len = bplen;
+ }
break;
default:
{
diff --git a/gdb/disasm.c b/gdb/disasm.c
index de1c7dc..128c3ab 100644
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -433,8 +433,8 @@ do_mixed_source_and_assembly_deprecated
"src_and_asm_line");
print_source_lines (symtab, next_line, next_line + 1,
psl_flags);
- ui_out_emit_list inner_list_emitter (uiout,
- "line_asm_insn");
+ ui_out_emit_list temp_list_emitter (uiout,
+ "line_asm_insn");
}
/* Print the last line and leave list open for
asm instructions to be added. */
@@ -660,7 +660,8 @@ do_mixed_source_and_assembly (struct gdbarch *gdbarch,
l < end_preceding_line_to_display;
++l)
{
- ui_out_emit_tuple tuple_emitter (uiout, "src_and_asm_line");
+ ui_out_emit_tuple line_tuple_emitter (uiout,
+ "src_and_asm_line");
print_source_lines (sal.symtab, l, l + 1, psl_flags);
ui_out_emit_list chain_line_emitter (uiout, "line_asm_insn");
}
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index 118bc11..2d61167 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -1943,12 +1943,12 @@ decode_frame_entry_1 (struct comp_unit *unit, const gdb_byte *start,
cie->saw_z_augmentation = (*augmentation == 'z');
if (cie->saw_z_augmentation)
{
- uint64_t length;
+ uint64_t uleb_length;
- buf = gdb_read_uleb128 (buf, end, &length);
+ buf = gdb_read_uleb128 (buf, end, &uleb_length);
if (buf == NULL)
return NULL;
- cie->initial_instructions = buf + length;
+ cie->initial_instructions = buf + uleb_length;
augmentation++;
}
@@ -2061,12 +2061,12 @@ decode_frame_entry_1 (struct comp_unit *unit, const gdb_byte *start,
can skip the whole thing. */
if (fde->cie->saw_z_augmentation)
{
- uint64_t length;
+ uint64_t uleb_length;
- buf = gdb_read_uleb128 (buf, end, &length);
+ buf = gdb_read_uleb128 (buf, end, &uleb_length);
if (buf == NULL)
return NULL;
- buf += length;
+ buf += uleb_length;
if (buf > end)
return NULL;
}
diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c
index f1ca033..0387ef5 100644
--- a/gdb/dwarf2expr.c
+++ b/gdb/dwarf2expr.c
@@ -952,12 +952,12 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
from the type length, we need to zero-extend it. */
if (TYPE_LENGTH (type) != addr_size)
{
- ULONGEST result =
+ ULONGEST datum =
extract_unsigned_integer (buf, addr_size, byte_order);
buf = (gdb_byte *) alloca (TYPE_LENGTH (type));
store_unsigned_integer (buf, TYPE_LENGTH (type),
- byte_order, result);
+ byte_order, datum);
}
result_val = value_from_contents_and_address (type, buf, addr);
@@ -1218,12 +1218,12 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
case DW_OP_bit_piece:
{
- uint64_t size, offset;
+ uint64_t size, uleb_offset;
/* Record the piece. */
op_ptr = safe_read_uleb128 (op_ptr, op_end, &size);
- op_ptr = safe_read_uleb128 (op_ptr, op_end, &offset);
- add_piece (size, offset);
+ op_ptr = safe_read_uleb128 (op_ptr, op_end, &uleb_offset);
+ add_piece (size, uleb_offset);
/* Pop off the address/regnum, and reset the location
type. */
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 1c21895..ee6a8e2 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -3069,7 +3069,6 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
struct dwarf2_per_cu_data *per_cu)
{
gdbarch *arch = expr->gdbarch;
- int i;
std::vector<int> dw_labels, patches;
const gdb_byte * const base = op_ptr;
const gdb_byte *previous_piece = op_ptr;
@@ -3611,7 +3610,7 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
case DW_OP_piece:
case DW_OP_bit_piece:
{
- uint64_t size, offset;
+ uint64_t size;
if (op_ptr - 1 == previous_piece)
error (_("Cannot translate empty pieces to agent expressions"));
@@ -3621,10 +3620,10 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
if (op == DW_OP_piece)
{
size *= 8;
- offset = 0;
+ uoffset = 0;
}
else
- op_ptr = safe_read_uleb128 (op_ptr, op_end, &offset);
+ op_ptr = safe_read_uleb128 (op_ptr, op_end, &uoffset);
if (bits_collected + size > 8 * sizeof (LONGEST))
error (_("Expression pieces exceed word size"));
@@ -3638,11 +3637,11 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
case axs_lvalue_memory:
/* Offset the pointer, if needed. */
- if (offset > 8)
+ if (uoffset > 8)
{
- ax_const_l (expr, offset / 8);
+ ax_const_l (expr, uoffset / 8);
ax_simple (expr, aop_add);
- offset %= 8;
+ uoffset %= 8;
}
access_memory (arch, expr, size);
break;
@@ -3688,8 +3687,8 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
uoffset = extract_unsigned_integer (op_ptr, size, byte_order);
op_ptr += size;
- cu_offset offset = (cu_offset) uoffset;
- block = dwarf2_fetch_die_loc_cu_off (offset, per_cu,
+ cu_offset cuoffset = (cu_offset) uoffset;
+ block = dwarf2_fetch_die_loc_cu_off (cuoffset, per_cu,
get_ax_pc, expr);
/* DW_OP_call_ref is currently not supported. */
@@ -3712,7 +3711,7 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
}
/* Patch all the branches we emitted. */
- for (i = 0; i < patches.size (); ++i)
+ for (int i = 0; i < patches.size (); ++i)
{
int targ = offsets[dw_labels[i]];
if (targ == -1)
@@ -4234,7 +4233,7 @@ disassemble_dwarf_expression (struct ui_file *stream,
case DW_OP_deref_type:
case DW_OP_GNU_deref_type:
{
- int addr_size = *data++;
+ int deref_addr_size = *data++;
struct type *type;
data = safe_read_uleb128 (data, end, &ul);
@@ -4244,7 +4243,7 @@ disassemble_dwarf_expression (struct ui_file *stream,
type_print (type, "", stream, -1);
fprintf_filtered (stream, " [0x%s]> %d",
phex_nz (to_underlying (offset), 0),
- addr_size);
+ deref_addr_size);
}
break;
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 929a8be..e0fd565 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -5497,7 +5497,6 @@ read_debug_names_from_section (struct objfile *objfile,
const gdb_byte *abbrev_table_start = addr;
for (;;)
{
- unsigned int bytes_read;
const ULONGEST index_num = read_unsigned_leb128 (abfd, addr, &bytes_read);
addr += bytes_read;
if (index_num == 0)
@@ -8079,18 +8078,14 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
dwarf2_build_include_psymtabs (cu, comp_unit_die, pst);
if (dwarf_read_debug)
- {
- struct gdbarch *gdbarch = get_objfile_arch (objfile);
-
- fprintf_unfiltered (gdb_stdlog,
- "Psymtab for %s unit @%s: %s - %s"
- ", %d global, %d static syms\n",
- per_cu->is_debug_types ? "type" : "comp",
- sect_offset_str (per_cu->sect_off),
- paddress (gdbarch, pst->text_low (objfile)),
- paddress (gdbarch, pst->text_high (objfile)),
- pst->n_global_syms, pst->n_static_syms);
- }
+ fprintf_unfiltered (gdb_stdlog,
+ "Psymtab for %s unit @%s: %s - %s"
+ ", %d global, %d static syms\n",
+ per_cu->is_debug_types ? "type" : "comp",
+ sect_offset_str (per_cu->sect_off),
+ paddress (gdbarch, pst->text_low (objfile)),
+ paddress (gdbarch, pst->text_high (objfile)),
+ pst->n_global_syms, pst->n_static_syms);
}
/* Subroutine of dwarf2_build_psymtabs_hard to simplify it.
@@ -9112,18 +9107,21 @@ add_partial_subprogram (struct partial_die_info *pdi,
struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile);
CORE_ADDR baseaddr;
- CORE_ADDR highpc;
- CORE_ADDR lowpc;
+ CORE_ADDR this_highpc;
+ CORE_ADDR this_lowpc;
baseaddr = ANOFFSET (objfile->section_offsets,
SECT_OFF_TEXT (objfile));
- lowpc = (gdbarch_adjust_dwarf2_addr (gdbarch,
- pdi->lowpc + baseaddr)
- - baseaddr);
- highpc = (gdbarch_adjust_dwarf2_addr (gdbarch,
- pdi->highpc + baseaddr)
- - baseaddr);
- addrmap_set_empty (objfile->psymtabs_addrmap, lowpc, highpc - 1,
+ this_lowpc
+ = (gdbarch_adjust_dwarf2_addr (gdbarch,
+ pdi->lowpc + baseaddr)
+ - baseaddr);
+ this_highpc
+ = (gdbarch_adjust_dwarf2_addr (gdbarch,
+ pdi->highpc + baseaddr)
+ - baseaddr);
+ addrmap_set_empty (objfile->psymtabs_addrmap,
+ this_lowpc, this_highpc - 1,
cu->per_cu->v.psymtab);
}
}
@@ -20339,21 +20337,21 @@ dwarf_decode_line_header (sect_offset sect_off, struct dwarf2_cu *cu)
/* Read directory table. */
read_formatted_entries (dwarf2_per_objfile, abfd, &line_ptr, lh.get (),
&cu->header,
- [] (struct line_header *lh, const char *name,
+ [] (struct line_header *header, const char *name,
dir_index d_index, unsigned int mod_time,
unsigned int length)
{
- lh->add_include_dir (name);
+ header->add_include_dir (name);
});
/* Read file name table. */
read_formatted_entries (dwarf2_per_objfile, abfd, &line_ptr, lh.get (),
&cu->header,
- [] (struct line_header *lh, const char *name,
+ [] (struct line_header *header, const char *name,
dir_index d_index, unsigned int mod_time,
unsigned int length)
{
- lh->add_file_name (name, d_index, mod_time, length);
+ header->add_file_name (name, d_index, mod_time, length);
});
}
else
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 71dcb23..9f1fa2b 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -1296,9 +1296,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
if (!debugfile.empty ())
{
- gdb_bfd_ref_ptr abfd (symfile_bfd_open (debugfile.c_str ()));
+ gdb_bfd_ref_ptr debug_bfd (symfile_bfd_open (debugfile.c_str ()));
- symbol_file_add_separate (abfd.get (), debugfile.c_str (),
+ symbol_file_add_separate (debug_bfd.get (), debugfile.c_str (),
symfile_flags, objfile);
}
}
diff --git a/gdb/eval.c b/gdb/eval.c
index 2144b1d..5ee5990 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -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)
{
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index 5ef1612..390bd45 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -923,7 +923,7 @@ yylex (void)
{
int c;
int namelen;
- unsigned int i,token;
+ unsigned int token;
const char *tokstart;
retry:
@@ -937,7 +937,7 @@ yylex (void)
if (*lexptr == '.')
{
- for (i = 0; boolean_values[i].name != NULL; i++)
+ for (int i = 0; boolean_values[i].name != NULL; i++)
{
if (strncmp (tokstart, boolean_values[i].name,
strlen (boolean_values[i].name)) == 0)
@@ -951,7 +951,7 @@ yylex (void)
/* See if it is a special .foo. operator. */
- for (i = 0; dot_ops[i].oper != NULL; i++)
+ for (int i = 0; dot_ops[i].oper != NULL; i++)
if (strncmp (tokstart, dot_ops[i].oper,
strlen (dot_ops[i].oper)) == 0)
{
@@ -1120,7 +1120,7 @@ yylex (void)
/* Catch specific keywords. */
- for (i = 0; f77_keywords[i].oper != NULL; i++)
+ for (int i = 0; f77_keywords[i].oper != NULL; i++)
if (strlen (f77_keywords[i].oper) == namelen
&& strncmp (tokstart, f77_keywords[i].oper, namelen) == 0)
{
@@ -1151,10 +1151,9 @@ yylex (void)
VAR_DOMAIN,
MODULE_DOMAIN
};
- int i;
int hextype;
- for (i = 0; i < ARRAY_SIZE (lookup_domains); ++i)
+ for (int i = 0; i < ARRAY_SIZE (lookup_domains); ++i)
{
/* Initialize this in case we *don't* use it in this call; that
way we can refer to it unconditionally below. */
diff --git a/gdb/findvar.c b/gdb/findvar.c
index be6c9d6..41ffedd 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -632,7 +632,7 @@ default_read_var_value (struct symbol *var, const struct block *var_block,
v = allocate_value (type);
if (overlay_debugging)
{
- CORE_ADDR addr
+ addr
= symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var),
SYMBOL_OBJ_SECTION (symbol_objfile (var),
var));
diff --git a/gdb/guile/scm-symbol.c b/gdb/guile/scm-symbol.c
index 8495ca5..2c4ac5a 100644
--- a/gdb/guile/scm-symbol.c
+++ b/gdb/guile/scm-symbol.c
@@ -609,10 +609,10 @@ gdbscm_lookup_symbol (SCM name_scm, SCM rest)
selected_frame = get_selected_frame (_("no frame selected"));
block = get_frame_block (selected_frame, NULL);
}
- CATCH (except, RETURN_MASK_ALL)
+ CATCH (ex, RETURN_MASK_ALL)
{
xfree (name);
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ GDBSCM_HANDLE_GDB_EXCEPTION (ex);
}
END_CATCH
}
diff --git a/gdb/hppa-bsd-tdep.c b/gdb/hppa-bsd-tdep.c
index 61f0b82..ee8b213 100644
--- a/gdb/hppa-bsd-tdep.c
+++ b/gdb/hppa-bsd-tdep.c
@@ -35,12 +35,12 @@ hppabsd_find_global_pointer (struct gdbarch *gdbarch, struct value *function)
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR faddr = value_as_address (function);
struct obj_section *faddr_sec;
- gdb_byte buf[4];
/* Is this a plabel? If so, dereference it to get the Global Pointer
value. */
if (faddr & 2)
{
+ gdb_byte buf[4];
if (target_read_memory ((faddr & ~3) + 4, buf, sizeof buf) == 0)
return extract_unsigned_integer (buf, sizeof buf, byte_order);
}
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index 5e9ecb5..d381ecc 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -947,7 +947,6 @@ ia64_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
found sequentially in memory starting at $bof. This
isn't always true, but without libunwind, this is the
best we can do. */
- enum register_status status;
ULONGEST cfm;
ULONGEST bsp;
CORE_ADDR reg;
@@ -1399,8 +1398,8 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
&& it == M && ((instr & 0x1ee0000003fLL) == 0x02c00000000LL))
{
/* alloc - start of a regular function. */
- int sol = (int) ((instr & 0x00007f00000LL) >> 20);
- int sof = (int) ((instr & 0x000000fe000LL) >> 13);
+ int sol_bits = (int) ((instr & 0x00007f00000LL) >> 20);
+ int sof_bits = (int) ((instr & 0x000000fe000LL) >> 13);
int rN = (int) ((instr & 0x00000001fc0LL) >> 6);
/* Verify that the current cfm matches what we think is the
@@ -1409,8 +1408,8 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
addresses of various registers such as the return address.
We will instead treat the frame as frameless. */
if (!this_frame ||
- (sof == (cache->cfm & 0x7f) &&
- sol == ((cache->cfm >> 7) & 0x7f)))
+ (sof_bits == (cache->cfm & 0x7f) &&
+ sol_bits == ((cache->cfm >> 7) & 0x7f)))
frameless = 0;
cfm_reg = rN;
@@ -3229,9 +3228,9 @@ ia64_extract_return_value (struct type *type, struct regcache *regcache,
while (n-- > 0)
{
- ULONGEST val;
- regcache_cooked_read_unsigned (regcache, regnum, &val);
- memcpy ((char *)valbuf + offset, &val, reglen);
+ ULONGEST regval;
+ regcache_cooked_read_unsigned (regcache, regnum, &regval);
+ memcpy ((char *)valbuf + offset, &regval, reglen);
offset += reglen;
regnum++;
}
@@ -3270,7 +3269,6 @@ ia64_store_return_value (struct type *type, struct regcache *regcache,
}
else
{
- ULONGEST val;
int offset = 0;
int regnum = IA64_GR8_REGNUM;
int reglen = TYPE_LENGTH (register_type (gdbarch, IA64_GR8_REGNUM));
@@ -3288,6 +3286,7 @@ ia64_store_return_value (struct type *type, struct regcache *regcache,
if (m)
{
+ ULONGEST val;
memcpy (&val, (char *)valbuf + offset, m);
regcache_cooked_write_unsigned (regcache, regnum, val);
}
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);
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 84258ad..00f59f9 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -793,16 +793,16 @@ linespec_lexer_lex_string (linespec_parser *parser)
== language_cplus)
&& (PARSER_STREAM (parser) - start) >= CP_OPERATOR_LEN)
{
- const char *p = PARSER_STREAM (parser);
+ const char *op = PARSER_STREAM (parser);
- while (p > start && isspace (p[-1]))
- p--;
- if (p - start >= CP_OPERATOR_LEN)
+ while (op > start && isspace (op[-1]))
+ op--;
+ if (op - start >= CP_OPERATOR_LEN)
{
- p -= CP_OPERATOR_LEN;
- if (strncmp (p, CP_OPERATOR_STR, CP_OPERATOR_LEN) == 0
- && (p == start
- || !(isalnum (p[-1]) || p[-1] == '_')))
+ op -= CP_OPERATOR_LEN;
+ if (strncmp (op, CP_OPERATOR_STR, CP_OPERATOR_LEN) == 0
+ && (op == start
+ || !(isalnum (op[-1]) || op[-1] == '_')))
{
/* This is an operator name. Keep going. */
++(PARSER_STREAM (parser));
@@ -813,15 +813,15 @@ linespec_lexer_lex_string (linespec_parser *parser)
}
}
- const char *p = find_parameter_list_end (PARSER_STREAM (parser));
- PARSER_STREAM (parser) = p;
+ const char *end = find_parameter_list_end (PARSER_STREAM (parser));
+ PARSER_STREAM (parser) = end;
/* Don't loop around to the normal \0 case above because
we don't want to misinterpret a potential keyword at
the end of the token when the string isn't
"()<>"-balanced. This handles "b
function(thread<tab>" in completion mode. */
- if (*p == '\0')
+ if (*end == '\0')
{
LS_TOKEN_STOKEN (token).ptr = start;
LS_TOKEN_STOKEN (token).length
@@ -839,9 +839,9 @@ linespec_lexer_lex_string (linespec_parser *parser)
== language_cplus)
&& (PARSER_STREAM (parser) - start) > CP_OPERATOR_LEN)
{
- const char *p = strstr (start, CP_OPERATOR_STR);
+ const char *op = strstr (start, CP_OPERATOR_STR);
- if (p != NULL && is_operator_name (p))
+ if (op != NULL && is_operator_name (op))
{
/* This is an operator name. Keep going. */
++(PARSER_STREAM (parser));
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 5bfd7ed..8c76ec3 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -822,13 +822,13 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
line = strtok (NULL, "\n"))
{
ULONGEST addr, endaddr, offset, inode;
- const char *permissions, *device, *filename;
+ const char *permissions, *device, *mapping_filename;
size_t permissions_len, device_len;
read_mapping (line, &addr, &endaddr,
&permissions, &permissions_len,
&offset, &device, &device_len,
- &inode, &filename);
+ &inode, &mapping_filename);
if (gdbarch_addr_bit (gdbarch) == 32)
{
@@ -837,7 +837,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
paddress (gdbarch, endaddr),
hex_string (endaddr - addr),
hex_string (offset),
- *filename? filename : "");
+ *mapping_filename ? mapping_filename : "");
}
else
{
@@ -846,7 +846,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
paddress (gdbarch, endaddr),
hex_string (endaddr - addr),
hex_string (offset),
- *filename? filename : "");
+ *mapping_filename ? mapping_filename : "");
}
}
}
diff --git a/gdb/machoread.c b/gdb/machoread.c
index 3040fe7..c586607 100644
--- a/gdb/machoread.c
+++ b/gdb/machoread.c
@@ -697,7 +697,7 @@ macho_symfile_read_all_oso (std::vector<oso_el> *oso_vector_ptr,
}
for (ix2 = ix; ix2 < last_ix; ix2++)
{
- oso_el *oso2 = &(*oso_vector_ptr)[ix2];
+ oso2 = &(*oso_vector_ptr)[ix2];
if (oso2->name != NULL)
warning (_("Could not find specified archive member "
diff --git a/gdb/main.c b/gdb/main.c
index 1552e95..8709357 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -801,28 +801,28 @@ captured_main_1 (struct captured_main_args *context)
break;
case 'b':
{
- int i;
+ int rate;
char *p;
- i = strtol (optarg, &p, 0);
- if (i == 0 && p == optarg)
+ rate = strtol (optarg, &p, 0);
+ if (rate == 0 && p == optarg)
warning (_("could not set baud rate to `%s'."),
optarg);
else
- baud_rate = i;
+ baud_rate = rate;
}
break;
case 'l':
{
- int i;
+ int timeout;
char *p;
- i = strtol (optarg, &p, 0);
- if (i == 0 && p == optarg)
+ timeout = strtol (optarg, &p, 0);
+ if (timeout == 0 && p == optarg)
warning (_("could not set timeout limit to `%s'."),
optarg);
else
- remote_timeout = i;
+ remote_timeout = timeout;
}
break;
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,
diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
index 69e7fdd..4b5bfcb 100644
--- a/gdb/mep-tdep.c
+++ b/gdb/mep-tdep.c
@@ -1661,14 +1661,13 @@ mep_analyze_prologue (struct gdbarch *gdbarch,
{
CORE_ADDR pc;
unsigned long insn;
- int rn;
pv_t reg[MEP_NUM_REGS];
CORE_ADDR after_last_frame_setup_insn = start_pc;
memset (result, 0, sizeof (*result));
result->gdbarch = gdbarch;
- for (rn = 0; rn < MEP_NUM_REGS; rn++)
+ for (int rn = 0; rn < MEP_NUM_REGS; rn++)
{
reg[rn] = pv_register (rn, 0);
result->reg_offset[rn] = 1;
diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
index 08e360c..d320a9b 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -752,7 +752,7 @@ varobj_update_one (struct varobj *var, enum print_values print_values,
for (varobj *child : r.newobj)
{
- ui_out_emit_tuple tuple_emitter (uiout, NULL);
+ ui_out_emit_tuple inner_tuple_emitter (uiout, NULL);
print_varobj (child, print_values, 1 /* print_expression */);
}
}
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 1e31040..f6fbebc 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -768,7 +768,7 @@ list_available_thread_groups (const std::set<int> &ids, int recurse)
for (const osdata_item &child : children)
{
- ui_out_emit_tuple tuple_emitter (uiout, NULL);
+ ui_out_emit_tuple inner_tuple_emitter (uiout, NULL);
const std::string *tid = get_osdata_column (child, "tid");
const std::string *tcore = get_osdata_column (child, "core");
@@ -1376,7 +1376,7 @@ mi_cmd_data_read_memory (const char *command, char **argv, int argc)
{
int col;
int col_byte;
- struct value_print_options opts;
+ struct value_print_options print_opts;
ui_out_emit_tuple tuple_emitter (uiout, NULL);
uiout->field_core_addr ("addr", gdbarch, addr + row_byte);
@@ -1384,7 +1384,7 @@ mi_cmd_data_read_memory (const char *command, char **argv, int argc)
row_byte); */
{
ui_out_emit_list list_data_emitter (uiout, "data");
- get_formatted_print_options (&opts, word_format);
+ get_formatted_print_options (&print_opts, word_format);
for (col = 0, col_byte = row_byte;
col < nr_cols;
col++, col_byte += word_size)
@@ -1396,8 +1396,8 @@ mi_cmd_data_read_memory (const char *command, char **argv, int argc)
else
{
stream.clear ();
- print_scalar_formatted (&mbuf[col_byte], word_type, &opts,
- word_asize, &stream);
+ print_scalar_formatted (&mbuf[col_byte], word_type,
+ &print_opts, word_asize, &stream);
uiout->field_stream (NULL, stream);
}
}
diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
index 9bac864..4dbfd1b 100644
--- a/gdb/microblaze-tdep.c
+++ b/gdb/microblaze-tdep.c
@@ -353,12 +353,13 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
instruction. */
{
- unsigned op = (unsigned)insn >> 26;
+ unsigned ctrl_op = (unsigned)insn >> 26;
/* continue if not control flow (branch, return). */
- if (op != 0x26 && op != 0x27 && op != 0x2d && op != 0x2e && op != 0x2f)
+ if (ctrl_op != 0x26 && ctrl_op != 0x27 && ctrl_op != 0x2d
+ && ctrl_op != 0x2e && ctrl_op != 0x2f)
continue;
- else if (op == 0x2c)
+ else if (ctrl_op == 0x2c)
continue; /* continue if imm. */
}
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 5e0a606..bf44c52 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -4500,7 +4500,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int argreg;
int float_argreg;
int argnum;
- int len = 0;
+ int arg_space = 0;
int stack_offset = 0;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR func_addr = find_function_addr (function, NULL);
@@ -4527,13 +4527,14 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
than necessary for EABI, because the first few arguments are
passed in registers, but that's OK. */
for (argnum = 0; argnum < nargs; argnum++)
- len += align_up (TYPE_LENGTH (value_type (args[argnum])), abi_regsize);
- sp -= align_up (len, 16);
+ arg_space += align_up (TYPE_LENGTH (value_type (args[argnum])), abi_regsize);
+ sp -= align_up (arg_space, 16);
if (mips_debug)
fprintf_unfiltered (gdb_stdlog,
"mips_eabi_push_dummy_call: sp=%s allocated %ld\n",
- paddress (gdbarch, sp), (long) align_up (len, 16));
+ paddress (gdbarch, sp),
+ (long) align_up (arg_space, 16));
/* Initialize the integer and float register pointers. */
argreg = MIPS_A0_REGNUM;
@@ -4894,7 +4895,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int argreg;
int float_argreg;
int argnum;
- int len = 0;
+ int arg_space = 0;
int stack_offset = 0;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR func_addr = find_function_addr (function, NULL);
@@ -4918,13 +4919,14 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Now make space on the stack for the args. */
for (argnum = 0; argnum < nargs; argnum++)
- len += align_up (TYPE_LENGTH (value_type (args[argnum])), MIPS64_REGSIZE);
- sp -= align_up (len, 16);
+ arg_space += align_up (TYPE_LENGTH (value_type (args[argnum])), MIPS64_REGSIZE);
+ sp -= align_up (arg_space, 16);
if (mips_debug)
fprintf_unfiltered (gdb_stdlog,
"mips_n32n64_push_dummy_call: sp=%s allocated %ld\n",
- paddress (gdbarch, sp), (long) align_up (len, 16));
+ paddress (gdbarch, sp),
+ (long) align_up (arg_space, 16));
/* Initialize the integer and float register pointers. */
argreg = MIPS_A0_REGNUM;
@@ -5350,7 +5352,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int argreg;
int float_argreg;
int argnum;
- int len = 0;
+ int arg_space = 0;
int stack_offset = 0;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR func_addr = find_function_addr (function, NULL);
@@ -5379,16 +5381,17 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Align to double-word if necessary. */
if (mips_type_needs_double_align (arg_type))
- len = align_up (len, MIPS32_REGSIZE * 2);
+ arg_space = align_up (arg_space, MIPS32_REGSIZE * 2);
/* Allocate space on the stack. */
- len += align_up (TYPE_LENGTH (arg_type), MIPS32_REGSIZE);
+ arg_space += align_up (TYPE_LENGTH (arg_type), MIPS32_REGSIZE);
}
- sp -= align_up (len, 16);
+ sp -= align_up (arg_space, 16);
if (mips_debug)
fprintf_unfiltered (gdb_stdlog,
"mips_o32_push_dummy_call: sp=%s allocated %ld\n",
- paddress (gdbarch, sp), (long) align_up (len, 16));
+ paddress (gdbarch, sp),
+ (long) align_up (arg_space, 16));
/* Initialize the integer and float register pointers. */
argreg = MIPS_A0_REGNUM;
@@ -5874,7 +5877,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int argreg;
int float_argreg;
int argnum;
- int len = 0;
+ int arg_space = 0;
int stack_offset = 0;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR func_addr = find_function_addr (function, NULL);
@@ -5902,14 +5905,15 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct type *arg_type = check_typedef (value_type (args[argnum]));
/* Allocate space on the stack. */
- len += align_up (TYPE_LENGTH (arg_type), MIPS64_REGSIZE);
+ arg_space += align_up (TYPE_LENGTH (arg_type), MIPS64_REGSIZE);
}
- sp -= align_up (len, 16);
+ sp -= align_up (arg_space, 16);
if (mips_debug)
fprintf_unfiltered (gdb_stdlog,
"mips_o64_push_dummy_call: sp=%s allocated %ld\n",
- paddress (gdbarch, sp), (long) align_up (len, 16));
+ paddress (gdbarch, sp),
+ (long) align_up (arg_space, 16));
/* Initialize the integer and float register pointers. */
argreg = MIPS_A0_REGNUM;
diff --git a/gdb/nat/linux-osdata.c b/gdb/nat/linux-osdata.c
index 7d603a6..98bded0 100644
--- a/gdb/nat/linux-osdata.c
+++ b/gdb/nat/linux-osdata.c
@@ -644,7 +644,7 @@ static LONGEST
linux_xfer_osdata_cpus (gdb_byte *readbuf,
ULONGEST offset, ULONGEST len)
{
- static const char *buf;
+ static const char *saved_buf;
static LONGEST len_avail = -1;
static struct buffer buffer;
@@ -655,7 +655,7 @@ linux_xfer_osdata_cpus (gdb_byte *readbuf,
if (len_avail != -1 && len_avail != 0)
buffer_free (&buffer);
len_avail = 0;
- buf = NULL;
+ saved_buf = NULL;
buffer_init (&buffer);
buffer_grow_str (&buffer, "<osdata type=\"cpus\">\n");
@@ -713,22 +713,22 @@ linux_xfer_osdata_cpus (gdb_byte *readbuf,
}
buffer_grow_str0 (&buffer, "</osdata>\n");
- buf = buffer_finish (&buffer);
- len_avail = strlen (buf);
+ saved_buf = buffer_finish (&buffer);
+ len_avail = strlen (saved_buf);
}
if (offset >= len_avail)
{
/* Done. Get rid of the buffer. */
buffer_free (&buffer);
- buf = NULL;
+ saved_buf = NULL;
len_avail = 0;
return 0;
}
if (len > len_avail - offset)
len = len_avail - offset;
- memcpy (readbuf, buf + offset, len);
+ memcpy (readbuf, saved_buf + offset, len);
return len;
}
@@ -741,7 +741,7 @@ linux_xfer_osdata_fds (gdb_byte *readbuf,
ULONGEST offset, ULONGEST len)
{
/* We make the process list snapshot when the object starts to be read. */
- static const char *buf;
+ static const char *saved_buf;
static LONGEST len_avail = -1;
static struct buffer buffer;
@@ -752,7 +752,7 @@ linux_xfer_osdata_fds (gdb_byte *readbuf,
if (len_avail != -1 && len_avail != 0)
buffer_free (&buffer);
len_avail = 0;
- buf = NULL;
+ saved_buf = NULL;
buffer_init (&buffer);
buffer_grow_str (&buffer, "<osdata type=\"files\">\n");
@@ -829,22 +829,22 @@ linux_xfer_osdata_fds (gdb_byte *readbuf,
}
buffer_grow_str0 (&buffer, "</osdata>\n");
- buf = buffer_finish (&buffer);
- len_avail = strlen (buf);
+ saved_buf = buffer_finish (&buffer);
+ len_avail = strlen (saved_buf);
}
if (offset >= len_avail)
{
/* Done. Get rid of the buffer. */
buffer_free (&buffer);
- buf = NULL;
+ saved_buf = NULL;
len_avail = 0;
return 0;
}
if (len > len_avail - offset)
len = len_avail - offset;
- memcpy (readbuf, buf + offset, len);
+ memcpy (readbuf, saved_buf + offset, len);
return len;
}
@@ -1126,7 +1126,7 @@ static LONGEST
linux_xfer_osdata_shm (gdb_byte *readbuf,
ULONGEST offset, ULONGEST len)
{
- static const char *buf;
+ static const char *saved_buf;
static LONGEST len_avail = -1;
static struct buffer buffer;
@@ -1135,7 +1135,7 @@ linux_xfer_osdata_shm (gdb_byte *readbuf,
if (len_avail != -1 && len_avail != 0)
buffer_free (&buffer);
len_avail = 0;
- buf = NULL;
+ saved_buf = NULL;
buffer_init (&buffer);
buffer_grow_str (&buffer, "<osdata type=\"shared memory\">\n");
@@ -1223,22 +1223,22 @@ linux_xfer_osdata_shm (gdb_byte *readbuf,
}
buffer_grow_str0 (&buffer, "</osdata>\n");
- buf = buffer_finish (&buffer);
- len_avail = strlen (buf);
+ saved_buf = buffer_finish (&buffer);
+ len_avail = strlen (saved_buf);
}
if (offset >= len_avail)
{
/* Done. Get rid of the buffer. */
buffer_free (&buffer);
- buf = NULL;
+ saved_buf = NULL;
len_avail = 0;
return 0;
}
if (len > len_avail - offset)
len = len_avail - offset;
- memcpy (readbuf, buf + offset, len);
+ memcpy (readbuf, saved_buf + offset, len);
return len;
}
@@ -1250,7 +1250,7 @@ static LONGEST
linux_xfer_osdata_sem (gdb_byte *readbuf,
ULONGEST offset, ULONGEST len)
{
- static const char *buf;
+ static const char *saved_buf;
static LONGEST len_avail = -1;
static struct buffer buffer;
@@ -1259,7 +1259,7 @@ linux_xfer_osdata_sem (gdb_byte *readbuf,
if (len_avail != -1 && len_avail != 0)
buffer_free (&buffer);
len_avail = 0;
- buf = NULL;
+ saved_buf = NULL;
buffer_init (&buffer);
buffer_grow_str (&buffer, "<osdata type=\"semaphores\">\n");
@@ -1331,22 +1331,22 @@ linux_xfer_osdata_sem (gdb_byte *readbuf,
}
buffer_grow_str0 (&buffer, "</osdata>\n");
- buf = buffer_finish (&buffer);
- len_avail = strlen (buf);
+ saved_buf = buffer_finish (&buffer);
+ len_avail = strlen (saved_buf);
}
if (offset >= len_avail)
{
/* Done. Get rid of the buffer. */
buffer_free (&buffer);
- buf = NULL;
+ saved_buf = NULL;
len_avail = 0;
return 0;
}
if (len > len_avail - offset)
len = len_avail - offset;
- memcpy (readbuf, buf + offset, len);
+ memcpy (readbuf, saved_buf + offset, len);
return len;
}
@@ -1358,7 +1358,7 @@ static LONGEST
linux_xfer_osdata_msg (gdb_byte *readbuf,
ULONGEST offset, ULONGEST len)
{
- static const char *buf;
+ static const char *saved_buf;
static LONGEST len_avail = -1;
static struct buffer buffer;
@@ -1367,7 +1367,7 @@ linux_xfer_osdata_msg (gdb_byte *readbuf,
if (len_avail != -1 && len_avail != 0)
buffer_free (&buffer);
len_avail = 0;
- buf = NULL;
+ saved_buf = NULL;
buffer_init (&buffer);
buffer_grow_str (&buffer, "<osdata type=\"message queues\">\n");
@@ -1453,22 +1453,22 @@ linux_xfer_osdata_msg (gdb_byte *readbuf,
}
buffer_grow_str0 (&buffer, "</osdata>\n");
- buf = buffer_finish (&buffer);
- len_avail = strlen (buf);
+ saved_buf = buffer_finish (&buffer);
+ len_avail = strlen (saved_buf);
}
if (offset >= len_avail)
{
/* Done. Get rid of the buffer. */
buffer_free (&buffer);
- buf = NULL;
+ saved_buf = NULL;
len_avail = 0;
return 0;
}
if (len > len_avail - offset)
len = len_avail - offset;
- memcpy (readbuf, buf + offset, len);
+ memcpy (readbuf, saved_buf + offset, len);
return len;
}
@@ -1480,7 +1480,7 @@ static LONGEST
linux_xfer_osdata_modules (gdb_byte *readbuf,
ULONGEST offset, ULONGEST len)
{
- static const char *buf;
+ static const char *saved_buf;
static LONGEST len_avail = -1;
static struct buffer buffer;
@@ -1489,7 +1489,7 @@ linux_xfer_osdata_modules (gdb_byte *readbuf,
if (len_avail != -1 && len_avail != 0)
buffer_free (&buffer);
len_avail = 0;
- buf = NULL;
+ saved_buf = NULL;
buffer_init (&buffer);
buffer_grow_str (&buffer, "<osdata type=\"modules\">\n");
@@ -1559,22 +1559,22 @@ linux_xfer_osdata_modules (gdb_byte *readbuf,
}
buffer_grow_str0 (&buffer, "</osdata>\n");
- buf = buffer_finish (&buffer);
- len_avail = strlen (buf);
+ saved_buf = buffer_finish (&buffer);
+ len_avail = strlen (saved_buf);
}
if (offset >= len_avail)
{
/* Done. Get rid of the buffer. */
buffer_free (&buffer);
- buf = NULL;
+ saved_buf = NULL;
len_avail = 0;
return 0;
}
if (len > len_avail - offset)
len = len_avail - offset;
- memcpy (readbuf, buf + offset, len);
+ memcpy (readbuf, saved_buf + offset, len);
return len;
}
diff --git a/gdb/nios2-tdep.c b/gdb/nios2-tdep.c
index 008b1d4..c972b4b 100644
--- a/gdb/nios2-tdep.c
+++ b/gdb/nios2-tdep.c
@@ -1202,8 +1202,6 @@ nios2_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
struct reg_value *value = cache->reg_value;
struct reg_value temp_value[NIOS2_NUM_REGS];
- int i;
-
/* Save the starting PC so we can correct the pc after running
through the prolog, using symbol info. */
CORE_ADDR pc = start_pc;
@@ -1285,7 +1283,7 @@ nios2_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
/* If any registers were saved on the stack before then
we can't backtrace into them now. */
- for (i = 0 ; i < NIOS2_NUM_REGS ; i++)
+ for (int i = 0 ; i < NIOS2_NUM_REGS ; i++)
{
if (cache->reg_saved[i].basereg == NIOS2_SP_REGNUM)
cache->reg_saved[i].basereg = -1;
@@ -1416,7 +1414,6 @@ nios2_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
/* PUSH.N {reglist}, adjust
or
STWM {reglist}, --(SP)[, writeback] */
- int i;
int off = 0;
if (ra != NIOS2_SP_REGNUM || id != 0)
@@ -1424,7 +1421,7 @@ nios2_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
part of the prologue. */
break;
- for (i = 31; i >= 0; i--)
+ for (int i = 31; i >= 0; i--)
if (reglist & (1 << i))
{
int orig = value[i].reg;
@@ -1469,9 +1466,9 @@ nios2_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
if ra has been stored into r8 beforehand and if it's
before the stack adjust.
Note mcount corrupts r2-r3, r9-r15 & ra. */
- for (i = 2 ; i <= 3 ; i++)
+ for (int i = 2 ; i <= 3 ; i++)
value[i].reg = -1;
- for (i = 9 ; i <= 15 ; i++)
+ for (int i = 9 ; i <= 15 ; i++)
value[i].reg = -1;
value[NIOS2_RA_REGNUM].reg = -1;
@@ -1621,14 +1618,14 @@ nios2_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
/* Adjust all the saved registers such that they contain addresses
instead of offsets. */
- for (i = 0; i < NIOS2_NUM_REGS; i++)
+ for (int i = 0; i < NIOS2_NUM_REGS; i++)
if (cache->reg_saved[i].basereg == NIOS2_SP_REGNUM)
{
cache->reg_saved[i].basereg = NIOS2_Z_REGNUM;
cache->reg_saved[i].addr += frame_high;
}
- for (i = 0; i < NIOS2_NUM_REGS; i++)
+ for (int i = 0; i < NIOS2_NUM_REGS; i++)
if (cache->reg_saved[i].basereg == NIOS2_GP_REGNUM)
{
CORE_ADDR gp = get_frame_register_unsigned (this_frame,
@@ -1818,7 +1815,7 @@ nios2_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
int argreg;
int argnum;
- int len = 0;
+ int arg_space = 0;
int stack_offset = 0;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -1828,8 +1825,8 @@ nios2_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Now make space on the stack for the args. */
for (argnum = 0; argnum < nargs; argnum++)
- len += align_up (TYPE_LENGTH (value_type (args[argnum])), 4);
- sp -= len;
+ arg_space += align_up (TYPE_LENGTH (value_type (args[argnum])), 4);
+ sp -= arg_space;
/* Initialize the register pointer. */
argreg = NIOS2_FIRST_ARGREG;
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 4bffd20..a9b8fa7 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -773,15 +773,13 @@ static int
objfile_relocate1 (struct objfile *objfile,
const struct section_offsets *new_offsets)
{
- struct obj_section *s;
struct section_offsets *delta =
((struct section_offsets *)
alloca (SIZEOF_N_SECTION_OFFSETS (objfile->num_sections)));
- int i;
int something_changed = 0;
- for (i = 0; i < objfile->num_sections; ++i)
+ for (int i = 0; i < objfile->num_sections; ++i)
{
delta->offsets[i] =
ANOFFSET (new_offsets, i) - ANOFFSET (objfile->section_offsets, i);
@@ -799,13 +797,12 @@ objfile_relocate1 (struct objfile *objfile,
ALL_OBJFILE_FILETABS (objfile, cust, s)
{
struct linetable *l;
- int i;
/* First the line table. */
l = SYMTAB_LINETABLE (s);
if (l)
{
- for (i = 0; i < l->nitems; ++i)
+ for (int i = 0; i < l->nitems; ++i)
l->item[i].pc += ANOFFSET (delta,
COMPUNIT_BLOCK_LINE_SECTION
(cust));
@@ -821,7 +818,7 @@ objfile_relocate1 (struct objfile *objfile,
addrmap_relocate (BLOCKVECTOR_MAP (bv),
ANOFFSET (delta, block_line_section));
- for (i = 0; i < BLOCKVECTOR_NBLOCKS (bv); ++i)
+ for (int i = 0; i < BLOCKVECTOR_NBLOCKS (bv); ++i)
{
struct block *b;
struct symbol *sym;
@@ -872,6 +869,7 @@ objfile_relocate1 (struct objfile *objfile,
get_objfile_pspace_data (objfile->pspace)->section_map_dirty = 1;
/* Update the table in exec_ops, used to read memory. */
+ struct obj_section *s;
ALL_OBJFILE_OSECTIONS (objfile, s)
{
int idx = s - objfile->sections;
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index 9ffaccd..c6fe191 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -1112,7 +1112,6 @@ yylex (void)
{
int c;
int namelen;
- unsigned int i;
const char *tokstart;
char *uptokstart;
const char *tokptr;
@@ -1129,7 +1128,7 @@ yylex (void)
/* See if it is a special token of length 3. */
if (explen > 2)
- for (i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++)
+ for (int i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++)
if (strncasecmp (tokstart, tokentab3[i].oper, 3) == 0
&& (!isalpha (tokentab3[i].oper[0]) || explen == 3
|| (!isalpha (tokstart[3])
@@ -1142,7 +1141,7 @@ yylex (void)
/* See if it is a special token of length 2. */
if (explen > 1)
- for (i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++)
+ for (int i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++)
if (strncasecmp (tokstart, tokentab2[i].oper, 2) == 0
&& (!isalpha (tokentab2[i].oper[0]) || explen == 2
|| (!isalpha (tokstart[2])
@@ -1519,7 +1518,7 @@ yylex (void)
/* second chance uppercased (as Free Pascal does). */
if (!sym && is_a_field_of_this.type == NULL && !is_a_field)
{
- for (i = 0; i <= namelen; i++)
+ for (int i = 0; i <= namelen; i++)
{
if ((tmp[i] >= 'a' && tmp[i] <= 'z'))
tmp[i] -= ('a'-'A');
@@ -1535,7 +1534,7 @@ yylex (void)
/* Third chance Capitalized (as GPC does). */
if (!sym && is_a_field_of_this.type == NULL && !is_a_field)
{
- for (i = 0; i <= namelen; i++)
+ for (int i = 0; i <= namelen; i++)
{
if (i == 0)
{
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index 766ccc6..c719460 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -69,7 +69,6 @@ pascal_val_print (struct type *type,
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
unsigned int i = 0; /* Number of characters printed */
unsigned len;
- LONGEST low_bound, high_bound;
struct type *elttype;
unsigned eltlen;
int length_pos, length_size, string_pos;
@@ -82,67 +81,71 @@ pascal_val_print (struct type *type,
switch (TYPE_CODE (type))
{
case TYPE_CODE_ARRAY:
- if (get_array_bounds (type, &low_bound, &high_bound))
- {
- len = high_bound - low_bound + 1;
- elttype = check_typedef (TYPE_TARGET_TYPE (type));
- eltlen = TYPE_LENGTH (elttype);
- if (options->prettyformat_arrays)
- {
- print_spaces_filtered (2 + 2 * recurse, stream);
- }
- /* If 's' format is used, try to print out as string.
- If no format is given, print as string if element type
- is of TYPE_CODE_CHAR and element size is 1,2 or 4. */
- if (options->format == 's'
- || ((eltlen == 1 || eltlen == 2 || eltlen == 4)
- && TYPE_CODE (elttype) == TYPE_CODE_CHAR
- && options->format == 0))
- {
- /* If requested, look for the first null char and only print
- elements up to it. */
- if (options->stop_print_at_null)
- {
- unsigned int temp_len;
-
- /* Look for a NULL char. */
- for (temp_len = 0;
- extract_unsigned_integer (valaddr + embedded_offset +
- temp_len * eltlen, eltlen,
- byte_order)
- && temp_len < len && temp_len < options->print_max;
- temp_len++);
- len = temp_len;
- }
-
- LA_PRINT_STRING (stream, TYPE_TARGET_TYPE (type),
- valaddr + embedded_offset, len, NULL, 0,
- options);
- i = len;
- }
- else
- {
- fprintf_filtered (stream, "{");
- /* If this is a virtual function table, print the 0th
- entry specially, and the rest of the members normally. */
- if (pascal_object_is_vtbl_ptr_type (elttype))
- {
- i = 1;
- fprintf_filtered (stream, "%d vtable entries", len - 1);
- }
- else
- {
- i = 0;
- }
- val_print_array_elements (type, embedded_offset,
- address, stream, recurse,
- original_value, options, i);
- fprintf_filtered (stream, "}");
- }
- break;
- }
- /* Array of unspecified length: treat like pointer to first elt. */
- addr = address + embedded_offset;
+ {
+ LONGEST low_bound, high_bound;
+
+ if (get_array_bounds (type, &low_bound, &high_bound))
+ {
+ len = high_bound - low_bound + 1;
+ elttype = check_typedef (TYPE_TARGET_TYPE (type));
+ eltlen = TYPE_LENGTH (elttype);
+ if (options->prettyformat_arrays)
+ {
+ print_spaces_filtered (2 + 2 * recurse, stream);
+ }
+ /* If 's' format is used, try to print out as string.
+ If no format is given, print as string if element type
+ is of TYPE_CODE_CHAR and element size is 1,2 or 4. */
+ if (options->format == 's'
+ || ((eltlen == 1 || eltlen == 2 || eltlen == 4)
+ && TYPE_CODE (elttype) == TYPE_CODE_CHAR
+ && options->format == 0))
+ {
+ /* If requested, look for the first null char and only print
+ elements up to it. */
+ if (options->stop_print_at_null)
+ {
+ unsigned int temp_len;
+
+ /* Look for a NULL char. */
+ for (temp_len = 0;
+ extract_unsigned_integer (valaddr + embedded_offset +
+ temp_len * eltlen, eltlen,
+ byte_order)
+ && temp_len < len && temp_len < options->print_max;
+ temp_len++);
+ len = temp_len;
+ }
+
+ LA_PRINT_STRING (stream, TYPE_TARGET_TYPE (type),
+ valaddr + embedded_offset, len, NULL, 0,
+ options);
+ i = len;
+ }
+ else
+ {
+ fprintf_filtered (stream, "{");
+ /* If this is a virtual function table, print the 0th
+ entry specially, and the rest of the members normally. */
+ if (pascal_object_is_vtbl_ptr_type (elttype))
+ {
+ i = 1;
+ fprintf_filtered (stream, "%d vtable entries", len - 1);
+ }
+ else
+ {
+ i = 0;
+ }
+ val_print_array_elements (type, embedded_offset,
+ address, stream, recurse,
+ original_value, options, i);
+ fprintf_filtered (stream, "}");
+ }
+ break;
+ }
+ /* Array of unspecified length: treat like pointer to first elt. */
+ addr = address + embedded_offset;
+ }
goto print_unpacked_pointer;
case TYPE_CODE_PTR:
@@ -353,22 +356,21 @@ pascal_val_print (struct type *type,
{
struct type *range = elttype;
LONGEST low_bound, high_bound;
- int i;
int need_comma = 0;
fputs_filtered ("[", stream);
- i = get_discrete_bounds (range, &low_bound, &high_bound);
+ int bound_info = get_discrete_bounds (range, &low_bound, &high_bound);
if (low_bound == 0 && high_bound == -1 && TYPE_LENGTH (type) > 0)
{
/* If we know the size of the set type, we can figure out the
maximum value. */
- i = 0;
+ bound_info = 0;
high_bound = TYPE_LENGTH (type) * TARGET_CHAR_BIT - 1;
TYPE_HIGH_BOUND (range) = high_bound;
}
maybe_bad_bstring:
- if (i < 0)
+ if (bound_info < 0)
{
fputs_filtered ("<error value>", stream);
goto done;
diff --git a/gdb/parse.c b/gdb/parse.c
index 8a128a7..1e7782e 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -1743,10 +1743,10 @@ operator_check_standard (struct expression *exp, int pos,
for (arg = 0; arg < nargs; arg++)
{
- struct type *type = elts[pos + 3 + arg].type;
- struct objfile *objfile = TYPE_OBJFILE (type);
+ struct type *inst_type = elts[pos + 3 + arg].type;
+ struct objfile *inst_objfile = TYPE_OBJFILE (inst_type);
- if (objfile && (*objfile_func) (objfile, data))
+ if (inst_objfile && (*objfile_func) (inst_objfile, data))
return 1;
}
}
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 817a002..19c8092 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -877,7 +877,6 @@ ppc_linux_syscall_record (struct regcache *regcache)
ULONGEST scnum;
enum gdb_syscall syscall_gdb;
int ret;
- int i;
regcache_raw_read_unsigned (regcache, tdep->ppc_gp0_regnum, &scnum);
syscall_gdb = ppc_canonicalize_syscall (scnum);
@@ -932,7 +931,7 @@ ppc_linux_syscall_record (struct regcache *regcache)
return ret;
/* Record registers clobbered during syscall. */
- for (i = 3; i <= 12; i++)
+ for (int i = 3; i <= 12; i++)
{
if (record_full_arch_list_add_reg (regcache, tdep->ppc_gp0_regnum + i))
return -1;
@@ -1434,9 +1433,9 @@ ppu2spu_sniffer (const struct frame_unwind *self,
data.gprs, 0, sizeof data.gprs)
== sizeof data.gprs)
{
- auto cooked_read = [&data] (int regnum, gdb_byte *buf)
+ auto cooked_read = [&data] (int regnum, gdb_byte *out_buf)
{
- return ppu2spu_unwind_register (&data, regnum, buf);
+ return ppu2spu_unwind_register (&data, regnum, out_buf);
};
struct ppu2spu_cache *cache
= FRAME_OBSTACK_CALLOC (1, struct ppu2spu_cache);
diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c
index 0bac225..ede666a 100644
--- a/gdb/ppc-sysv-tdep.c
+++ b/gdb/ppc-sysv-tdep.c
@@ -1907,7 +1907,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
struct type *func_type = function ? value_type (function) : NULL;
int opencl_abi = func_type? ppc_sysv_use_opencl_abi (func_type) : 0;
struct type *eltype;
- int nelt, i, ok;
+ int nelt, ok;
/* This function exists to support a calling convention that
requires floating-point registers. It shouldn't be used on
@@ -1919,7 +1919,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
{
eltype = check_typedef (TYPE_TARGET_TYPE (valtype));
- for (i = 0; i < 2; i++)
+ for (int i = 0; i < 2; i++)
{
ok = ppc64_sysv_abi_return_value_base (gdbarch, eltype, regcache,
readbuf, writebuf, i);
@@ -1945,7 +1945,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
eltype = register_type (gdbarch, tdep->ppc_vr0_regnum);
nelt = TYPE_LENGTH (valtype) / TYPE_LENGTH (eltype);
- for (i = 0; i < nelt; i++)
+ for (int i = 0; i < nelt; i++)
{
ok = ppc64_sysv_abi_return_value_base (gdbarch, eltype, regcache,
readbuf, writebuf, i);
@@ -2001,7 +2001,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
&& tdep->vector_abi == POWERPC_VEC_ALTIVEC
&& TYPE_LENGTH (eltype) == 16)))
{
- for (i = 0; i < nelt; i++)
+ for (int i = 0; i < nelt; i++)
{
ok = ppc64_sysv_abi_return_value_base (gdbarch, eltype, regcache,
readbuf, writebuf, i);
@@ -2027,9 +2027,8 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
{
int n_regs = ((TYPE_LENGTH (valtype) + tdep->wordsize - 1)
/ tdep->wordsize);
- int i;
- for (i = 0; i < n_regs; i++)
+ for (int i = 0; i < n_regs; i++)
{
gdb_byte regval[PPC_MAX_REGISTER_SIZE];
int regnum = tdep->ppc_gp0_regnum + 3 + i;
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 8f1346e..aabe9f5 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -2972,10 +2972,10 @@ cmd_record_btrace_start (const char *args, int from_tty)
{
execute_command ("target record-btrace", from_tty);
}
- CATCH (exception, RETURN_MASK_ALL)
+ CATCH (ex, RETURN_MASK_ALL)
{
record_btrace_conf.format = BTRACE_FORMAT_NONE;
- throw_exception (exception);
+ throw_exception (ex);
}
END_CATCH
}
diff --git a/gdb/regcache.c b/gdb/regcache.c
index f3f845a..b2f9b05 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -1609,19 +1609,21 @@ cooked_read_test (struct gdbarch *gdbarch)
/* Test that read one raw register from regcache_no_target will go
to the target layer. */
- int regnum;
/* Find a raw register which size isn't zero. */
- for (regnum = 0; regnum < gdbarch_num_regs (gdbarch); regnum++)
+ int nonzero_regnum;
+ for (nonzero_regnum = 0;
+ nonzero_regnum < gdbarch_num_regs (gdbarch);
+ nonzero_regnum++)
{
- if (register_size (gdbarch, regnum) != 0)
+ if (register_size (gdbarch, nonzero_regnum) != 0)
break;
}
readwrite_regcache readwrite (gdbarch);
- gdb::def_vector<gdb_byte> buf (register_size (gdbarch, regnum));
+ gdb::def_vector<gdb_byte> buf (register_size (gdbarch, nonzero_regnum));
- readwrite.raw_read (regnum, buf.data ());
+ readwrite.raw_read (nonzero_regnum, buf.data ());
/* raw_read calls target_fetch_registers. */
SELF_CHECK (mock_target.fetch_registers_called > 0);
@@ -1642,9 +1644,10 @@ cooked_read_test (struct gdbarch *gdbarch)
if (register_size (gdbarch, regnum) == 0)
continue;
- gdb::def_vector<gdb_byte> buf (register_size (gdbarch, regnum));
+ gdb::def_vector<gdb_byte> inner_buf (register_size (gdbarch, regnum));
- SELF_CHECK (REG_VALID == readwrite.cooked_read (regnum, buf.data ()));
+ SELF_CHECK (REG_VALID == readwrite.cooked_read (regnum,
+ inner_buf.data ()));
SELF_CHECK (mock_target.fetch_registers_called == 0);
SELF_CHECK (mock_target.store_registers_called == 0);
@@ -1669,9 +1672,9 @@ cooked_read_test (struct gdbarch *gdbarch)
if (register_size (gdbarch, regnum) == 0)
continue;
- gdb::def_vector<gdb_byte> buf (register_size (gdbarch, regnum));
+ gdb::def_vector<gdb_byte> inner_buf (register_size (gdbarch, regnum));
enum register_status status = readonly.cooked_read (regnum,
- buf.data ());
+ inner_buf.data ());
if (regnum < gdbarch_num_regs (gdbarch))
{
diff --git a/gdb/remote.c b/gdb/remote.c
index 39b3823..724f41c 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -3830,7 +3830,7 @@ remote_target::update_thread_list ()
remote_notice_new_inferior (item.ptid, executing);
- thread_info *tp = find_thread_ptid (item.ptid);
+ tp = find_thread_ptid (item.ptid);
remote_thread_info *info = get_remote_thread_info (tp);
info->core = item.core;
info->extra = std::move (item.extra);
@@ -4398,7 +4398,6 @@ remote_target::process_initial_stop_replies (int from_tty)
ptid_t event_ptid;
struct target_waitstatus ws;
int ignore_event = 0;
- struct thread_info *thread;
memset (&ws, 0, sizeof (ws));
event_ptid = target_wait (waiton_ptid, &ws, TARGET_WNOHANG);
@@ -4427,7 +4426,7 @@ remote_target::process_initial_stop_replies (int from_tty)
if (ignore_event)
continue;
- thread = find_thread_ptid (event_ptid);
+ struct thread_info *evthread = find_thread_ptid (event_ptid);
if (ws.kind == TARGET_WAITKIND_STOPPED)
{
@@ -4437,19 +4436,19 @@ remote_target::process_initial_stop_replies (int from_tty)
instead of signal 0. Suppress it. */
if (sig == GDB_SIGNAL_TRAP)
sig = GDB_SIGNAL_0;
- thread->suspend.stop_signal = sig;
+ evthread->suspend.stop_signal = sig;
ws.value.sig = sig;
}
- thread->suspend.waitstatus = ws;
+ evthread->suspend.waitstatus = ws;
if (ws.kind != TARGET_WAITKIND_STOPPED
|| ws.value.sig != GDB_SIGNAL_0)
- thread->suspend.waitstatus_pending_p = 1;
+ evthread->suspend.waitstatus_pending_p = 1;
set_executing (event_ptid, 0);
set_running (event_ptid, 0);
- get_remote_thread_info (thread)->vcont_resumed = 0;
+ get_remote_thread_info (evthread)->vcont_resumed = 0;
}
/* "Notice" the new inferiors before anything related to
@@ -7509,7 +7508,6 @@ Packet: '%s'\n"),
break;
case 'w': /* Thread exited. */
{
- const char *p;
ULONGEST value;
event->ws.kind = TARGET_WAITKIND_THREAD_EXITED;
@@ -7523,7 +7521,6 @@ Packet: '%s'\n"),
case 'W': /* Target exited. */
case 'X':
{
- const char *p;
int pid;
ULONGEST value;
@@ -7864,8 +7861,6 @@ remote_target::wait_as (ptid_t ptid, target_waitstatus *status, int options)
break;
case 'N': case 'T': case 'S': case 'X': case 'W':
{
- struct stop_reply *stop_reply;
-
/* There is a stop reply to handle. */
rs->waiting_for_stop_reply = 0;
@@ -11550,10 +11545,10 @@ remote_target::get_thread_local_address (ptid_t ptid, CORE_ADDR lm,
&remote_protocol_packets[PACKET_qGetTLSAddr]);
if (result == PACKET_OK)
{
- ULONGEST result;
+ ULONGEST addr;
- unpack_varlen_hex (rs->buf, &result);
- return result;
+ unpack_varlen_hex (rs->buf, &addr);
+ return addr;
}
else if (result == PACKET_UNKNOWN)
throw_error (TLS_GENERIC_ERROR,
@@ -11593,11 +11588,10 @@ remote_target::get_tib_address (ptid_t ptid, CORE_ADDR *addr)
&remote_protocol_packets[PACKET_qGetTIBAddr]);
if (result == PACKET_OK)
{
- ULONGEST result;
-
- unpack_varlen_hex (rs->buf, &result);
+ ULONGEST val;
+ unpack_varlen_hex (rs->buf, &val);
if (addr)
- *addr = (CORE_ADDR) result;
+ *addr = (CORE_ADDR) val;
return true;
}
else if (result == PACKET_UNKNOWN)
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index 319e01b..3402241 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -2242,7 +2242,6 @@ riscv_push_dummy_call (struct gdbarch *gdbarch,
struct riscv_arg_info *arg_info =
(struct riscv_arg_info *) alloca (nargs * sizeof (struct riscv_arg_info));
- struct riscv_arg_info *info;
struct riscv_call_info call_info (gdbarch);
@@ -2252,12 +2251,11 @@ riscv_push_dummy_call (struct gdbarch *gdbarch,
if (struct_return)
++call_info.int_regs.next_regnum;
- for (i = 0, info = &arg_info[0];
- i < nargs;
- ++i, ++info)
+ for (i = 0; i < nargs; ++i)
{
struct value *arg_value;
struct type *arg_type;
+ struct riscv_arg_info *info = &arg_info[i];
arg_value = args[i];
arg_type = check_typedef (value_type (arg_value));
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 5a3e65f..ce01be5 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -5651,15 +5651,15 @@ ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
case 47: /* Store Multiple Word */
{
- ULONGEST addr = 0;
+ ULONGEST iaddr = 0;
if (PPC_RA (insn) != 0)
regcache_raw_read_unsigned (regcache,
tdep->ppc_gp0_regnum + PPC_RA (insn),
- &addr);
+ &iaddr);
- addr += PPC_D (insn);
- record_full_arch_list_add_mem (addr, 4 * (32 - PPC_RS (insn)));
+ iaddr += PPC_D (insn);
+ record_full_arch_list_add_mem (iaddr, 4 * (32 - PPC_RS (insn)));
}
break;
@@ -5677,14 +5677,14 @@ ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
case 52: /* Store Floating-Point Single */
case 54: /* Store Floating-Point Double */
{
- ULONGEST addr = 0;
+ ULONGEST iaddr = 0;
int size = -1;
if (PPC_RA (insn) != 0)
regcache_raw_read_unsigned (regcache,
tdep->ppc_gp0_regnum + PPC_RA (insn),
- &addr);
- addr += PPC_D (insn);
+ &iaddr);
+ iaddr += PPC_D (insn);
if (op6 == 36 || op6 == 37 || op6 == 52 || op6 == 53)
size = 4;
@@ -5697,7 +5697,7 @@ ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
else
gdb_assert (0);
- record_full_arch_list_add_mem (addr, size);
+ record_full_arch_list_add_mem (iaddr, size);
}
break;
@@ -5750,7 +5750,7 @@ ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
/* Store Doubleword with Update */
/* Store Quadword with Update */
{
- ULONGEST addr = 0;
+ ULONGEST iaddr = 0;
int size;
int sub2 = PPC_FIELD (insn, 30, 2);
@@ -5760,12 +5760,12 @@ ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
if (PPC_RA (insn) != 0)
regcache_raw_read_unsigned (regcache,
tdep->ppc_gp0_regnum + PPC_RA (insn),
- &addr);
+ &iaddr);
size = (sub2 == 2) ? 16 : 8;
- addr += PPC_DS (insn) << 2;
- record_full_arch_list_add_mem (addr, size);
+ iaddr += PPC_DS (insn) << 2;
+ record_full_arch_list_add_mem (iaddr, size);
if (op6 == 62 && sub2 == 1)
record_full_arch_list_add_reg (regcache,
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 43db722..152413a 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -811,8 +811,6 @@ rust_internal_print_type (struct type *type, const char *varstring,
const struct type_print_options *flags,
bool for_rust_enum, print_offset_data *podata)
{
- int i;
-
QUIT;
if (show <= 0
&& TYPE_NAME (type) != NULL)
@@ -846,7 +844,7 @@ rust_internal_print_type (struct type *type, const char *varstring,
if (varstring != NULL)
fputs_filtered (varstring, stream);
fputs_filtered ("(", stream);
- for (i = 0; i < TYPE_NFIELDS (type); ++i)
+ for (int i = 0; i < TYPE_NFIELDS (type); ++i)
{
QUIT;
if (i > 0)
@@ -891,7 +889,7 @@ rust_internal_print_type (struct type *type, const char *varstring,
case TYPE_CODE_ENUM:
{
- int i, len = 0;
+ int len = 0;
fputs_filtered ("enum ", stream);
if (TYPE_NAME (type) != NULL)
@@ -902,7 +900,7 @@ rust_internal_print_type (struct type *type, const char *varstring,
}
fputs_filtered ("{\n", stream);
- for (i = 0; i < TYPE_NFIELDS (type); ++i)
+ for (int i = 0; i < TYPE_NFIELDS (type); ++i)
{
const char *name = TYPE_FIELD_NAME (type, i);
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index e962824..81fa032 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -2360,11 +2360,11 @@ s390_prologue_frame_unwind_cache (struct frame_info *this_frame,
Recognize this case by looking ahead a bit ... */
struct s390_prologue_data data2;
- pv_t *sp = &data2.gpr[S390_SP_REGNUM - S390_R0_REGNUM];
+ pv_t *sp2 = &data2.gpr[S390_SP_REGNUM - S390_R0_REGNUM];
if (!(s390_analyze_prologue (gdbarch, func, (CORE_ADDR)-1, &data2)
- && pv_is_register (*sp, S390_SP_REGNUM)
- && sp->k != 0))
+ && pv_is_register (*sp2, S390_SP_REGNUM)
+ && sp2->k != 0))
return 0;
}
}
diff --git a/gdb/stack.c b/gdb/stack.c
index fc1ccb3..9b0e740 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1187,7 +1187,6 @@ print_frame (struct frame_info *frame, int print_level,
uiout->text (" (");
if (print_args)
{
- struct gdbarch *gdbarch = get_frame_arch (frame);
int numargs;
if (gdbarch_frame_num_args_p (gdbarch))
@@ -2458,11 +2457,11 @@ return_command (const char *retval_exp, int from_tty)
if (return_value != NULL)
{
struct type *return_type = value_type (return_value);
- struct gdbarch *gdbarch = get_current_regcache ()->arch ();
+ struct gdbarch *cache_arch = get_current_regcache ()->arch ();
gdb_assert (rv_conv != RETURN_VALUE_STRUCT_CONVENTION
&& rv_conv != RETURN_VALUE_ABI_RETURNS_ADDRESS);
- gdbarch_return_value (gdbarch, function, return_type,
+ gdbarch_return_value (cache_arch, function, return_type,
get_current_regcache (), NULL /*read*/,
value_contents (return_value) /*write*/);
}
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 04dd5e2..2e48d65 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -2141,12 +2141,12 @@ lookup_local_symbol (const char *name,
if (language == language_cplus || language == language_fortran)
{
- struct block_symbol sym
+ struct block_symbol blocksym
= cp_lookup_symbol_imports_or_template (scope, name, block,
domain);
- if (sym.symbol != NULL)
- return sym;
+ if (blocksym.symbol != NULL)
+ return blocksym;
}
if (BLOCK_FUNCTION (block) != NULL && block_inlined_p (block))
@@ -3213,10 +3213,10 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
if (item->pc > pc && (!alt || item->pc < alt->pc))
alt = item;
- auto pc_compare = [](const CORE_ADDR & pc,
+ auto pc_compare = [](const CORE_ADDR & comp_pc,
const struct linetable_entry & lhs)->bool
{
- return pc < lhs.pc;
+ return comp_pc < lhs.pc;
};
struct linetable_entry *first = item;
diff --git a/gdb/target-float.c b/gdb/target-float.c
index a12f216..7faebda 100644
--- a/gdb/target-float.c
+++ b/gdb/target-float.c
@@ -627,7 +627,6 @@ host_float_ops<T>::from_target (const struct floatformat *fmt,
}
unsigned char *ufrom = (unsigned char *) from;
- T dto;
long exponent;
unsigned long mant;
unsigned int mant_bits, mant_off;
@@ -685,7 +684,7 @@ host_float_ops<T>::from_target (const struct floatformat *fmt,
mant_bits_left = fmt->man_len;
mant_off = fmt->man_start;
- dto = 0.0;
+ T dto = 0.0;
special_exponent = exponent == 0 || exponent == fmt->exp_nan;
diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c
index b1711ba..13ad67f 100644
--- a/gdb/tic6x-tdep.c
+++ b/gdb/tic6x-tdep.c
@@ -147,7 +147,6 @@ tic6x_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
struct tic6x_unwind_cache *cache,
struct frame_info *this_frame)
{
- unsigned long inst;
unsigned int src_reg, base_reg, dst_reg;
int i;
CORE_ADDR pc = start_pc;
@@ -242,7 +241,7 @@ tic6x_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
}
/* Step 2: Skip insn on setting up dsbt if it is. Usually, it looks like,
ldw .D2T2 *+b14(0),b14 */
- inst = tic6x_fetch_instruction (gdbarch, pc);
+ unsigned long inst = tic6x_fetch_instruction (gdbarch, pc);
/* The s bit determines which file dst will be loaded into, same effect as
other places. */
dst_reg = tic6x_register_number ((inst >> 23) & 0x1f, (inst >> 1) & 1, 0);
@@ -1067,7 +1066,6 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (typecode == TYPE_CODE_COMPLEX)
{
/* The argument is being passed by reference on stack. */
- CORE_ADDR addr;
references_offset = align_up (references_offset, 8);
addr = sp + references_offset;
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 6d964c1..8cd5337 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -3224,7 +3224,6 @@ void
merge_uploaded_trace_state_variables (struct uploaded_tsv **uploaded_tsvs)
{
struct uploaded_tsv *utsv;
- struct trace_state_variable *tsv;
int highest;
/* Most likely some numbers will have to be reassigned as part of
@@ -3234,7 +3233,7 @@ merge_uploaded_trace_state_variables (struct uploaded_tsv **uploaded_tsvs)
for (utsv = *uploaded_tsvs; utsv; utsv = utsv->next)
{
- tsv = find_matching_tsv (utsv);
+ struct trace_state_variable *tsv = find_matching_tsv (utsv);
if (tsv)
{
if (info_verbose)
@@ -3727,7 +3726,7 @@ print_one_static_tracepoint_marker (int count,
int ix;
{
- ui_out_emit_tuple tuple_emitter (uiout, "tracepoints-at");
+ ui_out_emit_tuple inner_tuple_emitter (uiout, "tracepoints-at");
uiout->text (extra_field_indent);
uiout->text (_("Probed by static tracepoints: "));
diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c
index 07767bb..d527319 100644
--- a/gdb/tui/tui-stack.c
+++ b/gdb/tui/tui-stack.c
@@ -358,7 +358,6 @@ tui_show_frame_info (struct frame_info *fi)
{
struct tui_win_info *win_info;
int locator_changed_p;
- int i;
if (fi)
{
@@ -473,7 +472,7 @@ tui_show_frame_info (struct frame_info *fi)
return 0;
tui_show_locator_content ();
- for (i = 0; i < (tui_source_windows ())->count; i++)
+ for (int i = 0; i < (tui_source_windows ())->count; i++)
{
win_info = (tui_source_windows ())->list[i];
tui_clear_source_content (win_info, EMPTY_SOURCE_PROMPT);
diff --git a/gdb/unittests/array-view-selftests.c b/gdb/unittests/array-view-selftests.c
index eba792f..3116ab2 100644
--- a/gdb/unittests/array-view-selftests.c
+++ b/gdb/unittests/array-view-selftests.c
@@ -444,14 +444,14 @@ run_tests ()
/* op[] */
{
- std::vector<gdb_byte> vec = {0x11, 0x22};
- gdb::array_view<gdb_byte> view = vec;
- gdb::array_view<const gdb_byte> cview = vec;
+ std::vector<gdb_byte> vec2 = {0x11, 0x22};
+ gdb::array_view<gdb_byte> view = vec2;
+ gdb::array_view<const gdb_byte> cview = vec2;
/* Check that op[] on a non-const view of non-const T returns a
mutable reference. */
view[0] = 0x33;
- SELF_CHECK (vec[0] == 0x33);
+ SELF_CHECK (vec2[0] == 0x33);
/* OTOH, check that assigning through op[] on a view of const T
wouldn't compile. */
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index 2a3812d..119fb6d 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -1019,7 +1019,7 @@ v850_push_dummy_call (struct gdbarch *gdbarch,
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int argreg;
int argnum;
- int len = 0;
+ int arg_space = 0;
int stack_offset;
if (gdbarch_tdep (gdbarch)->abi == V850_ABI_RH850)
@@ -1034,8 +1034,8 @@ v850_push_dummy_call (struct gdbarch *gdbarch,
/* Now make space on the stack for the args. */
for (argnum = 0; argnum < nargs; argnum++)
- len += ((TYPE_LENGTH (value_type (args[argnum])) + 3) & ~3);
- sp -= len + stack_offset;
+ arg_space += ((TYPE_LENGTH (value_type (args[argnum])) + 3) & ~3);
+ sp -= arg_space + stack_offset;
argreg = E_ARG0_REGNUM;
/* The struct_return pointer occupies the first parameter register. */
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
diff --git a/gdb/valprint.c b/gdb/valprint.c
index d1d3232..2b63a91 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -2360,13 +2360,13 @@ generic_emit_char (int c, struct type *type, struct ui_file *stream,
{
enum bfd_endian byte_order
= gdbarch_byte_order (get_type_arch (type));
- gdb_byte *buf;
+ gdb_byte *c_buf;
int need_escape = 0;
- buf = (gdb_byte *) alloca (TYPE_LENGTH (type));
- pack_long (buf, type, c);
+ c_buf = (gdb_byte *) alloca (TYPE_LENGTH (type));
+ pack_long (c_buf, type, c);
- wchar_iterator iter (buf, TYPE_LENGTH (type), encoding, TYPE_LENGTH (type));
+ wchar_iterator iter (c_buf, TYPE_LENGTH (type), encoding, TYPE_LENGTH (type));
/* This holds the printable form of the wchar_t data. */
auto_obstack wchar_buf;
diff --git a/gdb/varobj.c b/gdb/varobj.c
index e109926..3ae4de8 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -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)
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index a858ffe..941471a 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -1421,12 +1421,12 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
case C_BSTAT:
/* Begin static block. */
{
- struct internal_syment symbol;
+ struct internal_syment static_symbol;
- read_symbol (&symbol, cs->c_value);
- static_block_base = symbol.n_value;
+ read_symbol (&static_symbol, cs->c_value);
+ static_block_base = static_symbol.n_value;
static_block_section =
- secnum_to_section (symbol.n_scnum, objfile);
+ secnum_to_section (static_symbol.n_scnum, objfile);
}
break;
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index b80d23e..b3c2ba6 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -234,7 +234,6 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
int argreg = E_1ST_ARG_REGNUM;
int i, j;
int typelen, slacklen;
- const gdb_byte *val;
gdb_byte buf[xstormy16_pc_size];
/* If struct_return is true, then the struct return address will
@@ -257,7 +256,7 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
break;
/* Put argument into registers wordwise. */
- val = value_contents (args[i]);
+ const gdb_byte *val = value_contents (args[i]);
for (j = 0; j < typelen; j += xstormy16_reg_size)
{
ULONGEST regval;
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index 49a7f02..3b32bcf 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -1699,7 +1699,6 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
CORE_ADDR struct_addr)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- int i;
int size, onstack_size;
gdb_byte *buf = (gdb_byte *) alloca (16);
CORE_ADDR ra, ps;
@@ -1725,13 +1724,12 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
if (xtensa_debug_level > 3)
{
- int i;
DEBUGINFO ("[xtensa_push_dummy_call] nargs = %d\n", nargs);
DEBUGINFO ("[xtensa_push_dummy_call] sp=0x%x, struct_return=%d, "
"struct_addr=0x%x\n",
(int) sp, (int) struct_return, (int) struct_addr);
- for (i = 0; i < nargs; i++)
+ for (int i = 0; i < nargs; i++)
{
struct value *arg = args[i];
struct type *arg_type = check_typedef (value_type (arg));
@@ -1762,12 +1760,11 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
size = 0;
onstack_size = 0;
- i = 0;
if (struct_return)
size = REGISTER_SIZE;
- for (i = 0; i < nargs; i++)
+ for (int i = 0; i < nargs; i++)
{
struct argument_info *info = &arg_info[i];
struct value *arg = args[i];
@@ -1847,7 +1844,7 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
regcache->cooked_write (ARG_1ST (gdbarch), buf);
}
- for (i = 0; i < nargs; i++)
+ for (int i = 0; i < nargs; i++)
{
struct argument_info *info = &arg_info[i];