From patchwork Sat Jul 14 21:54:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 28397 Received: (qmail 93115 invoked by alias); 14 Jul 2018 21:54:12 -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 93103 invoked by uid 89); 14 Jul 2018 21:54:11 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=777, ppc-linux-nat.c, ppclinuxnatc, UD:ppc-linux-nat.c X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 14 Jul 2018 21:54:09 +0000 Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 1239C1E093; Sat, 14 Jul 2018 17:54:08 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=simark.ca; s=mail; t=1531605248; bh=imdOWD4BceXzgbZ+1lyqmN4H0wJ2cUicGoaw0gfn7Qk=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=NRxlOyU8hPAbWzPpNbmC7PqhQsOB2ikZOVbrp9bkjpQcPvxjQbAZaQH/AUdM6K7ST KKaAGo2SJmAXBtGMeispk6QJqRwGQddrckhtOge1AuRoiUye1MxMZy7WuhL9hxN/QP XTIl3y3w96Umer+3lg68ACWTXhlmFENNEPifkoW0= Subject: Re: [RFA 01/13] Simple unused variable removals To: Tom Tromey Cc: gdb-patches@sourceware.org References: <20180712205208.32646-1-tom@tromey.com> <20180712205208.32646-2-tom@tromey.com> <87b519fc-318a-84aa-7ced-aea354f059fb@simark.ca> <87in5i9ej4.fsf@tromey.com> From: Simon Marchi Message-ID: <9fdcebc6-c0c8-a65b-131c-64d18cfc3329@simark.ca> Date: Sat, 14 Jul 2018 17:54:07 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <87in5i9ej4.fsf@tromey.com> On 2018-07-14 08:40 AM, Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi writes: > > Simon> - CORE_ADDR size = extract_unsigned_integer (ovly_table + 16*i + 4, > Simon> - 4, byte_order); > > Simon> I wondered this was a bug (should that variable really be used), but I > Simon> wouldn't know without some quite extensive research... so all-in-all, LGTM. > > Yes, this one was on the bubble and I almost put it in its own patch... > I can't recall offhand if there were others like this. > > Tom Here are a few more found by cross-compiling or trying to compile random files. I think we have to accept the fact that we'll find more after the patch series is merged. Simon From 1f97f379df3e3eab48da3a4a6a6843add8a60673 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Fri, 13 Jul 2018 21:49:43 -0400 Subject: [PATCH] obvious --- gdb/aarch64-linux-nat.c | 2 +- gdb/aix-thread.c | 5 ----- gdb/arm-linux-nat.c | 12 ++++-------- gdb/gdbserver/linux-mips-low.c | 2 -- gdb/mips-linux-nat.c | 1 - gdb/nat/aarch64-sve-linux-ptrace.c | 1 - gdb/ppc-linux-nat.c | 10 ---------- gdb/remote-sim.c | 3 --- gdb/sparc64-obsd-nat.c | 1 - gdb/xtensa-linux-nat.c | 2 -- 10 files changed, 5 insertions(+), 34 deletions(-) diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c index 43af99d11d2d..678c89029d40 100644 --- a/gdb/aarch64-linux-nat.c +++ b/gdb/aarch64-linux-nat.c @@ -819,7 +819,7 @@ bool aarch64_linux_nat_target::stopped_data_address (CORE_ADDR *addr_p) { siginfo_t siginfo; - int i, tid; + int i; struct aarch64_debug_reg_state *state; if (!linux_nat_get_siginfo (inferior_ptid, &siginfo)) diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index 97592e5b1f70..6c8607af295d 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -671,8 +671,6 @@ giter_accum (struct thread_info *thread, void *bufp) static int ptid_cmp (ptid_t ptid1, ptid_t ptid2) { - int pid1, pid2; - if (ptid1.pid () < ptid2.pid ()) return -1; else if (ptid1.pid () > ptid2.pid ()) @@ -708,7 +706,6 @@ get_signaled_thread (void) { struct thrdsinfo64 thrinf; tid_t ktid = 0; - int result = 0; while (1) { @@ -1502,7 +1499,6 @@ store_regs_user_thread (const struct regcache *regcache, pthdb_pthread_t pdtid) pthdb_context_t ctx; uint32_t int32; uint64_t int64; - double dbl; if (debug_aix_thread) fprintf_unfiltered (gdb_stdlog, @@ -1594,7 +1590,6 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno, double fprs[ppc_num_fprs]; struct ptxsprs sprs64; struct ptsprs sprs32; - int i; if (debug_aix_thread) fprintf_unfiltered (gdb_stdlog, diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c index 3c552ecde265..7d287c656800 100644 --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c @@ -205,7 +205,7 @@ store_fpregs (const struct regcache *regcache) static void fetch_regs (struct regcache *regcache) { - int ret, regno, tid; + int ret, tid; elf_gregset_t regs; /* Get the thread id for the ptrace call. */ @@ -232,7 +232,7 @@ fetch_regs (struct regcache *regcache) static void store_regs (const struct regcache *regcache) { - int ret, regno, tid; + int ret, tid; elf_gregset_t regs; /* Get the thread id for the ptrace call. */ @@ -339,7 +339,7 @@ static void fetch_vfp_regs (struct regcache *regcache) { gdb_byte regbuf[VFP_REGS_SIZE]; - int ret, regno, tid; + int ret, tid; struct gdbarch *gdbarch = regcache->arch (); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); @@ -368,7 +368,7 @@ static void store_vfp_regs (const struct regcache *regcache) { gdb_byte regbuf[VFP_REGS_SIZE]; - int ret, regno, tid; + int ret, tid; struct gdbarch *gdbarch = regcache->arch (); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); @@ -1064,7 +1064,6 @@ int arm_linux_nat_target::insert_hw_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { - struct lwp_info *lp; struct arm_linux_hw_breakpoint p; if (arm_linux_get_hw_breakpoint_count () == 0) @@ -1082,7 +1081,6 @@ int arm_linux_nat_target::remove_hw_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { - struct lwp_info *lp; struct arm_linux_hw_breakpoint p; if (arm_linux_get_hw_breakpoint_count () == 0) @@ -1134,7 +1132,6 @@ arm_linux_nat_target::insert_watchpoint (CORE_ADDR addr, int len, enum target_hw_bp_type rw, struct expression *cond) { - struct lwp_info *lp; struct arm_linux_hw_breakpoint p; if (arm_linux_get_hw_watchpoint_count () == 0) @@ -1153,7 +1150,6 @@ arm_linux_nat_target::remove_watchpoint (CORE_ADDR addr, int len, enum target_hw_bp_type rw, struct expression *cond) { - struct lwp_info *lp; struct arm_linux_hw_breakpoint p; if (arm_linux_get_hw_watchpoint_count () == 0) diff --git a/gdb/gdbserver/linux-mips-low.c b/gdb/gdbserver/linux-mips-low.c index 2194af6c0a50..393488ac5ba9 100644 --- a/gdb/gdbserver/linux-mips-low.c +++ b/gdb/gdbserver/linux-mips-low.c @@ -852,7 +852,6 @@ static void mips_collect_ptrace_register (struct regcache *regcache, int regno, char *buf) { - const struct target_desc *tdesc = current_process ()->tdesc; int use_64bit = sizeof (PTRACE_XFER_TYPE) == 8; if (use_64bit && register_size (regcache->tdesc, regno) == 4) @@ -872,7 +871,6 @@ static void mips_supply_ptrace_register (struct regcache *regcache, int regno, const char *buf) { - const struct target_desc *tdesc = current_process ()->tdesc; int use_64bit = sizeof (PTRACE_XFER_TYPE) == 8; if (use_64bit && register_size (regcache->tdesc, regno) == 4) diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c index 21b1f583b922..f143367a13bc 100644 --- a/gdb/mips-linux-nat.c +++ b/gdb/mips-linux-nat.c @@ -677,7 +677,6 @@ mips_linux_nat_target::insert_watchpoint (CORE_ADDR addr, int len, struct mips_watchpoint *new_watch; struct mips_watchpoint **pw; - int i; int retval; if (!mips_linux_read_watch_registers (inferior_ptid.lwp (), diff --git a/gdb/nat/aarch64-sve-linux-ptrace.c b/gdb/nat/aarch64-sve-linux-ptrace.c index a2f9261ba6f8..7b4027195be9 100644 --- a/gdb/nat/aarch64-sve-linux-ptrace.c +++ b/gdb/nat/aarch64-sve-linux-ptrace.c @@ -67,7 +67,6 @@ std::unique_ptr aarch64_sve_get_sveregs (int tid) { struct iovec iovec; - struct user_sve_header header; uint64_t vq = aarch64_sve_get_vq (tid); if (vq == 0) diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index 9719a0e906de..0b7052d0f6de 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -532,11 +532,9 @@ static void fetch_register (struct regcache *regcache, int tid, int regno) { struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); /* This isn't really an address. But ptrace thinks of it as one. */ CORE_ADDR regaddr = ppc_register_u_addr (gdbarch, regno); int bytes_transferred; - unsigned int offset; /* Offset of registers within the u area. */ gdb_byte buf[PPC_MAX_REGISTER_SIZE]; if (altivec_register_p (gdbarch, regno)) @@ -630,8 +628,6 @@ fetch_register (struct regcache *regcache, int tid, int regno) static int fetch_all_gp_regs (struct regcache *regcache, int tid) { - struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); gdb_gregset_t gregset; if (ptrace (PTRACE_GETREGS, tid, 0, (void *) &gregset) < 0) @@ -728,7 +724,6 @@ fetch_fp_regs (struct regcache *regcache, int tid) static void fetch_ppc_registers (struct regcache *regcache, int tid) { - int i; struct gdbarch *gdbarch = regcache->arch (); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); @@ -1004,8 +999,6 @@ store_register (const struct regcache *regcache, int tid, int regno) static int store_all_gp_regs (const struct regcache *regcache, int tid, int regno) { - struct gdbarch *gdbarch = regcache->arch (); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); gdb_gregset_t gregset; if (ptrace (PTRACE_GETREGS, tid, 0, (void *) &gregset) < 0) @@ -1122,7 +1115,6 @@ store_fp_regs (const struct regcache *regcache, int tid, int regno) static void store_ppc_registers (const struct regcache *regcache, int tid) { - int i; struct gdbarch *gdbarch = regcache->arch (); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); @@ -1407,7 +1399,6 @@ hwdebug_insert_point (struct ppc_hw_breakpoint *b, int tid) gdb::unique_xmalloc_ptr p (XDUP (ppc_hw_breakpoint, b)); struct hw_break_tuple *hw_breaks; struct thread_points *t; - struct hw_break_tuple *tuple; errno = 0; slot = ptrace (PPC_PTRACE_SETHWDEBUG, tid, 0, p.get ()); @@ -1627,7 +1618,6 @@ can_use_watchpoint_cond_accel (void) struct thread_points *p; int tid = inferior_ptid.lwp (); int cnt = hwdebug_info.num_condition_regs, i; - CORE_ADDR tmp_value; if (!have_ptrace_hwdebug_interface () || cnt == 0) return 0; diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index f76261dadf64..cc7a6f27fc99 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -377,9 +377,6 @@ end_callbacks (void) static int gdb_os_write_stdout (host_callback *p, const char *buf, int len) { - int i; - char b[2]; - ui_file_write (gdb_stdtarg, buf, len); return len; } diff --git a/gdb/sparc64-obsd-nat.c b/gdb/sparc64-obsd-nat.c index 593a7ac651b4..7f7bb78b656f 100644 --- a/gdb/sparc64-obsd-nat.c +++ b/gdb/sparc64-obsd-nat.c @@ -77,7 +77,6 @@ static int sparc64obsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) { u_int64_t state; - int regnum; /* The following is true for OpenBSD 3.0: diff --git a/gdb/xtensa-linux-nat.c b/gdb/xtensa-linux-nat.c index 007a5c3f058f..ea113bdd7146 100644 --- a/gdb/xtensa-linux-nat.c +++ b/gdb/xtensa-linux-nat.c @@ -204,7 +204,6 @@ fetch_gregs (struct regcache *regcache, int regnum) { int tid = regcache->ptid ().lwp (); gdb_gregset_t regs; - int areg; if (ptrace (PTRACE_GETREGS, tid, 0, (long) ®s) < 0) { @@ -223,7 +222,6 @@ store_gregs (struct regcache *regcache, int regnum) { int tid = regcache->ptid ().lwp (); gdb_gregset_t regs; - int areg; if (ptrace (PTRACE_GETREGS, tid, 0, (long) ®s) < 0) {