From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA 01/13] Simple unused variable removals
Date: Sat, 14 Jul 2018 21:54:00 -0000 [thread overview]
Message-ID: <9fdcebc6-c0c8-a65b-131c-64d18cfc3329@simark.ca> (raw)
In-Reply-To: <87in5i9ej4.fsf@tromey.com>
On 2018-07-14 08:40 AM, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simark@simark.ca> 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 <simon.marchi@polymtl.ca>
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<gdb_byte[]>
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<ppc_hw_breakpoint> 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)
{
--
2.18.0
next prev parent reply other threads:[~2018-07-14 21:54 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-12 20:52 [RFA 00/13] Add -Wunused-variable Tom Tromey
2018-07-12 20:52 ` [RFA 11/13] Remove unused variables from gdbserver Tom Tromey
2018-07-14 2:47 ` Simon Marchi
2018-07-16 14:16 ` Pedro Alves
2018-07-12 20:52 ` [RFA 13/13] Add -Wunused-variable to warnings.m4 Tom Tromey
2018-07-12 20:52 ` [RFA 04/13] Call some functions in guile/ for effect Tom Tromey
2018-07-14 1:19 ` Simon Marchi
2018-07-14 12:39 ` Tom Tromey
2018-07-16 13:54 ` Pedro Alves
2018-07-16 15:58 ` Tom Tromey
2018-07-12 20:52 ` [RFA 03/13] Use a previously unused variable in bfin-tdep.c Tom Tromey
2018-07-14 1:17 ` Simon Marchi
2018-07-12 20:52 ` [RFA 06/13] Remove dead code from m32c-tdep.c Tom Tromey
2018-07-12 22:18 ` Simon Marchi
2018-07-13 20:49 ` Tom Tromey
2018-07-12 20:52 ` [RFA 10/13] Remove unused declaration from value.c Tom Tromey
2018-07-13 2:52 ` Simon Marchi
2018-07-13 20:51 ` Tom Tromey
2018-07-13 21:49 ` Simon Marchi
2018-07-16 14:02 ` Pedro Alves
2018-07-16 15:34 ` Tom Tromey
2018-07-12 20:52 ` [RFA 05/13] Make a few calls in *-tdep.c for effect Tom Tromey
2018-07-12 21:58 ` Simon Marchi
2018-07-13 20:47 ` Tom Tromey
2018-07-16 14:03 ` Pedro Alves
2018-07-12 20:52 ` [RFA 09/13] Pass the correct argument to the observer in reread_symbols Tom Tromey
2018-07-13 2:49 ` Simon Marchi
2018-07-14 1:25 ` Simon Marchi
2018-07-12 20:52 ` [RFA 12/13] Add ATTRIBUTE_UNUSED to regdat.sh output Tom Tromey
2018-07-16 15:11 ` Pedro Alves
2018-07-16 16:41 ` Tom Tromey
2018-07-16 17:54 ` Pedro Alves
2018-07-16 19:06 ` Tom Tromey
2018-07-16 21:12 ` Tom Tromey
2018-07-12 20:52 ` [RFA 08/13] Fix ravenscar-thread.c to use arch_ops Tom Tromey
2018-07-14 1:25 ` Simon Marchi
2018-07-16 13:59 ` Pedro Alves
2018-07-16 15:36 ` Tom Tromey
2018-07-16 16:43 ` Pedro Alves
2018-07-12 20:52 ` [RFA 07/13] Remove unused declaration from py-prettyprint.c Tom Tromey
2018-07-14 1:24 ` Simon Marchi
2018-07-14 12:39 ` Tom Tromey
2018-07-16 14:11 ` Pedro Alves
2018-07-12 20:52 ` [RFA 01/13] Simple unused variable removals Tom Tromey
2018-07-14 1:15 ` Simon Marchi
2018-07-14 12:40 ` Tom Tromey
2018-07-14 21:54 ` Simon Marchi [this message]
2018-07-14 21:56 ` Simon Marchi
2018-07-16 13:38 ` Pedro Alves
2018-07-16 13:33 ` Pedro Alves
2018-07-16 15:35 ` Tom Tromey
2018-07-12 20:52 ` [RFA 02/13] Unused variable fixes related to conditional compilation Tom Tromey
2018-07-14 1:16 ` Simon Marchi
2018-07-14 21:50 ` Simon Marchi
2018-07-16 13:45 ` Pedro Alves
2018-07-22 2:25 ` Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9fdcebc6-c0c8-a65b-131c-64d18cfc3329@simark.ca \
--to=simark@simark.ca \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).