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  <tom@tromey.com>

	* 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) <DW_MACINFO_vendor_ext>: 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".
This commit is contained in:
Tom Tromey 2016-06-06 14:18:23 -06:00
parent 764c99c18a
commit ac29888840
7 changed files with 28 additions and 20 deletions

View File

@ -1,3 +1,15 @@
2016-07-14 Tom Tromey <tom@tromey.com>
* 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) <DW_MACINFO_vendor_ext>: 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 <tom@tromey.com>
* symfile.c (simple_overlay_update_1): Remove initialization

View File

@ -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, &current_pc, &bp_len);
gdbarch_breakpoint_from_pc (gdbarch, &current_pc, &bp_len);
current_pc += bp_len;
regcache_write_pc (regcache, current_pc);
}

View File

@ -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);
}

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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);