From: Tom Tromey Date: Mon, 6 Jun 2016 20:18:23 +0000 (-0600) Subject: Remove some variables but call functions for side effects X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ac29888840f025448225e600d4cf99e126386878;p=binutils-gdb.git Remove some variables but call functions for side effects This patch consolidates the (possibly-questionable) spots where we remove a declaration but continue to call some function for side effects. In a couple of cases it wasn't entirely clear to me that this mattered; and in some other cases it might be more aesthetically pleasing to use ATTRIBUTE_UNUSED. So, I broke this out into a separate patch for simpler review. 2016-07-14 Tom Tromey * arch-utils.c (default_skip_permanent_breakpoint): Remove "bp_insn". * disasm.c (do_assembly_only): Remove "num_displayed". * dwarf2read.c (read_abbrev_offset): Remove "length". (dwarf_decode_macro_bytes) : Remove "constant". * m32c-tdep.c (make_regs): Remove "r2hl", "r3hl", and "intbhl". * microblaze-tdep.c (microblaze_frame_cache): Remove "func". * tracefile.c (trace_save): Remove "status". --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f70a2bfc62d..affce52ef97 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2016-07-14 Tom Tromey + + * arch-utils.c (default_skip_permanent_breakpoint): Remove + "bp_insn". + * disasm.c (do_assembly_only): Remove "num_displayed". + * dwarf2read.c (read_abbrev_offset): Remove "length". + (dwarf_decode_macro_bytes) : Remove + "constant". + * m32c-tdep.c (make_regs): Remove "r2hl", "r3hl", and "intbhl". + * microblaze-tdep.c (microblaze_frame_cache): Remove "func". + * tracefile.c (trace_save): Remove "status". + 2016-07-14 Tom Tromey * symfile.c (simple_overlay_update_1): Remove initialization diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 604042fa192..53121bcaf99 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -857,10 +857,9 @@ default_skip_permanent_breakpoint (struct regcache *regcache) { struct gdbarch *gdbarch = get_regcache_arch (regcache); CORE_ADDR current_pc = regcache_read_pc (regcache); - const gdb_byte *bp_insn; int bp_len; - bp_insn = gdbarch_breakpoint_from_pc (gdbarch, ¤t_pc, &bp_len); + gdbarch_breakpoint_from_pc (gdbarch, ¤t_pc, &bp_len); current_pc += bp_len; regcache_write_pc (regcache, current_pc); } diff --git a/gdb/disasm.c b/gdb/disasm.c index f611721db1c..bd1f760a6ee 100644 --- a/gdb/disasm.c +++ b/gdb/disasm.c @@ -737,13 +737,11 @@ do_assembly_only (struct gdbarch *gdbarch, struct ui_out *uiout, CORE_ADDR low, CORE_ADDR high, int how_many, int flags, struct ui_file *stb) { - int num_displayed = 0; struct cleanup *ui_out_chain; ui_out_chain = make_cleanup_ui_out_list_begin_end (uiout, "asm_insns"); - num_displayed = dump_insns (gdbarch, uiout, di, low, high, how_many, - flags, stb, NULL); + dump_insns (gdbarch, uiout, di, low, high, how_many, flags, stb, NULL); do_cleanups (ui_out_chain); } diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 6658a386ec9..58b502bc655 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -4497,12 +4497,12 @@ read_abbrev_offset (struct dwarf2_section_info *section, { bfd *abfd = get_section_bfd_owner (section); const gdb_byte *info_ptr; - unsigned int length, initial_length_size, offset_size; + unsigned int initial_length_size, offset_size; sect_offset abbrev_offset; dwarf2_read_section (dwarf2_per_objfile->objfile, section); info_ptr = section->buffer + offset.sect_off; - length = read_initial_length (abfd, info_ptr, &initial_length_size); + read_initial_length (abfd, info_ptr, &initial_length_size); offset_size = initial_length_size == 4 ? 4 : 8; info_ptr += initial_length_size + 2 /*version*/; abbrev_offset.sect_off = read_offset_1 (abfd, info_ptr, offset_size); @@ -21578,9 +21578,10 @@ dwarf_decode_macro_bytes (bfd *abfd, if (!section_is_gnu) { unsigned int bytes_read; - int constant; - constant = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); + /* This reads the constant, but since we don't recognize + any vendor extensions, we ignore it. */ + read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); mac_ptr += bytes_read; read_direct_string (abfd, mac_ptr, &bytes_read); mac_ptr += bytes_read; diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c index 59927a6fbb8..1e98f73a35c 100644 --- a/gdb/m32c-tdep.c +++ b/gdb/m32c-tdep.c @@ -823,9 +823,6 @@ make_regs (struct gdbarch *arch) struct m32c_reg *sp; struct m32c_reg *r0hl; struct m32c_reg *r1hl; - struct m32c_reg *r2hl; - struct m32c_reg *r3hl; - struct m32c_reg *intbhl; struct m32c_reg *r2r0; struct m32c_reg *r3r1; struct m32c_reg *r3r1r2r0; @@ -889,9 +886,9 @@ make_regs (struct gdbarch *arch) r0hl = CHL (r0, tdep->int8); r1hl = CHL (r1, tdep->int8); - r2hl = CHL (r2, tdep->int8); - r3hl = CHL (r3, tdep->int8); - intbhl = CHL (intb, tdep->int16); + CHL (r2, tdep->int8); + CHL (r3, tdep->int8); + CHL (intb, tdep->int16); r2r0 = CCAT (r2, r0, tdep->int32); r3r1 = CCAT (r3, r1, tdep->int32); diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c index 9cfe3fe51d4..665ec0cf33f 100644 --- a/gdb/microblaze-tdep.c +++ b/gdb/microblaze-tdep.c @@ -437,7 +437,6 @@ microblaze_frame_cache (struct frame_info *next_frame, void **this_cache) { struct microblaze_frame_cache *cache; struct gdbarch *gdbarch = get_frame_arch (next_frame); - CORE_ADDR func; int rn; if (*this_cache) @@ -451,7 +450,8 @@ microblaze_frame_cache (struct frame_info *next_frame, void **this_cache) for (rn = 0; rn < gdbarch_num_regs (gdbarch); rn++) cache->register_offsets[rn] = -1; - func = get_frame_func (next_frame); + /* Call for side effects. */ + get_frame_func (next_frame); cache->pc = get_frame_address_in_block (next_frame); diff --git a/gdb/tracefile.c b/gdb/tracefile.c index c32bcf4c283..56fb0d2e2be 100644 --- a/gdb/tracefile.c +++ b/gdb/tracefile.c @@ -57,7 +57,6 @@ trace_save (const char *filename, struct trace_file_writer *writer, int target_does_save) { struct trace_status *ts = current_trace_status (); - int status; struct uploaded_tp *uploaded_tps = NULL, *utp; struct uploaded_tsv *uploaded_tsvs = NULL, *utsv; @@ -77,8 +76,10 @@ trace_save (const char *filename, struct trace_file_writer *writer, } /* Get the trace status first before opening the file, so if the - target is losing, we can get out without touching files. */ - status = target_get_trace_status (ts); + target is losing, we can get out without touching files. Since + we're just calling this for side effects, we ignore the + result. */ + target_get_trace_status (ts); writer->ops->start (writer, filename);