Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Enze Li via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Cc: enze.li@gmx.com
Subject: [PATCH] gdb/amd64: clean up unused variable
Date: Sun, 31 Jul 2022 12:14:44 +0800	[thread overview]
Message-ID: <OS3P286MB2152BC4BABBC7C76441025A5F09B9@OS3P286MB2152.JPNP286.PROD.OUTLOOK.COM> (raw)

When building with clang 15, I got this,

  CXX    amd64-tdep.o
amd64-tdep.c:1410:13: error: variable 'insn' set but not used[-Werror,-Wunused-but-set-variable]
    gdb_byte *insn = insn_details->raw_insn + modrm_offset;
                ^
1 error generated.

The function that uses this variable has been removed in this commit,

commit 870f88f7551b0f2d6aaaa36fb684b5ff8f468107
Date:   Mon Apr 18 13:16:27 2016 -0400

    remove trivialy unused variables

Fix this by removing unused variable.

Tested by rebuilding on x86_64-linux with clang 15 and gcc 12.
---
 gdb/amd64-tdep.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 0563b32a54bf..3fbbf20fc2b1 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -1407,14 +1407,12 @@ fixup_riprel (struct gdbarch *gdbarch,
 {
   const struct amd64_insn *insn_details = &dsc->insn_details;
   int modrm_offset = insn_details->modrm_offset;
-  gdb_byte *insn = insn_details->raw_insn + modrm_offset;
   CORE_ADDR rip_base;
   int insn_length;
   int arch_tmp_regno, tmp_regno;
   ULONGEST orig_value;
 
   /* %rip+disp32 addressing mode, displacement follows ModRM byte.  */
-  ++insn;
 
   /* Compute the rip-relative address.	*/
   insn_length = gdb_buffered_insn_length (gdbarch, dsc->insn_buf.data (),
-- 
2.37.1


             reply	other threads:[~2022-07-31  4:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-31  4:14 Enze Li via Gdb-patches [this message]
2022-08-01 17:55 ` John Baldwin
2022-08-01 22:23 ` [PATCH v2] " Enze Li via Gdb-patches
2022-08-02 15:44   ` John Baldwin
2022-08-03 12:30     ` Enze Li via Gdb-patches

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=OS3P286MB2152BC4BABBC7C76441025A5F09B9@OS3P286MB2152.JPNP286.PROD.OUTLOOK.COM \
    --to=gdb-patches@sourceware.org \
    --cc=enze.li@gmx.com \
    --cc=enze.li@hotmail.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