From patchwork Mon Jun 6 21:33:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 12821 Received: (qmail 120229 invoked by alias); 6 Jun 2016 21:34:04 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 119937 invoked by uid 89); 6 Jun 2016 21:34:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL, BAYES_00, FSL_HELO_HOME, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=no version=3.3.2 spammy=abfd, pleasing, writer, sk:read_in X-HELO: gproxy5-pub.mail.unifiedlayer.com Received: from gproxy5-pub.mail.unifiedlayer.com (HELO gproxy5-pub.mail.unifiedlayer.com) (67.222.38.55) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with SMTP; Mon, 06 Jun 2016 21:33:47 +0000 Received: (qmail 9551 invoked by uid 0); 6 Jun 2016 21:33:44 -0000 Received: from unknown (HELO cmgw4) (10.0.90.85) by gproxy5.mail.unifiedlayer.com with SMTP; 6 Jun 2016 21:33:44 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by cmgw4 with id 3ZZh1t00s2f2jeq01ZZkpN; Mon, 06 Jun 2016 15:33:44 -0600 X-Authority-Analysis: v=2.1 cv=ecGuId0H c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=PnD2wP_eR3oA:10 a=-N9Dh3nx2ZYA:10 a=pD_ry4oyNxEA:10 a=zstS-IiYAAAA:8 a=AOj9ZYwLXtEEdSkXT68A:9 a=nKFtGddgKPSymMpP:21 a=atXICokmI2dp-N7d:21 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from [65.128.48.199] (port=46482 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1bA29V-0006Xd-5v; Mon, 06 Jun 2016 15:33:41 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 4/6] Remove some variables but call functions for side effects Date: Mon, 6 Jun 2016 15:33:30 -0600 Message-Id: <1465248812-23902-5-git-send-email-tom@tromey.com> In-Reply-To: <1465248812-23902-1-git-send-email-tom@tromey.com> References: <1465248812-23902-1-git-send-email-tom@tromey.com> X-Identified-User: {36111:box522.bluehost.com:elynrobi:tromey.com} {sentby:smtp auth 65.128.48.199 authed with tom+tromey.com} X-Exim-ID: 1bA29V-0006Xd-5v X-Source-Sender: (bapiya.Home) [65.128.48.199]:46482 X-Source-Auth: tom+tromey.com X-Email-Count: 0 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== 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-06-06 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". --- gdb/ChangeLog | 12 ++++++++++++ gdb/arch-utils.c | 3 +-- gdb/disasm.c | 4 +--- gdb/dwarf2read.c | 9 +++++---- gdb/m32c-tdep.c | 9 +++------ gdb/microblaze-tdep.c | 4 ++-- gdb/tracefile.c | 7 ++++--- 7 files changed, 28 insertions(+), 20 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9839c55..b164911 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,17 @@ 2016-06-06 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-06-06 Tom Tromey + * symfile.c (simple_overlay_update_1): Comment out initialization of "size". (simple_overlay_update): Likewise. diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 604042f..53121bc 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 f611721..bd1f760 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 6658a38..58b502b 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 59927a6..1e98f73 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 9cfe3fe..665ec0c 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 c32bcf4..56fb0d2 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);