public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb/amd64: clean up unused variable
@ 2022-08-03 12:29 Enze Li
  0 siblings, 0 replies; only message in thread
From: Enze Li @ 2022-08-03 12:29 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8b8da1a9f31941fa167c9f2bd2a80cdd1dccb452

commit 8b8da1a9f31941fa167c9f2bd2a80cdd1dccb452
Author: Enze Li <enze.li@hotmail.com>
Date:   Tue Aug 2 06:11:50 2022 +0800

    gdb/amd64: clean up unused variable
    
    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.

Diff:
---
 gdb/amd64-tdep.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 0563b32a54b..d89e06d27cb 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -1407,15 +1407,11 @@ 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 (),
 					  dsc->insn_buf.size (), from);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-03 12:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-03 12:29 [binutils-gdb] gdb/amd64: clean up unused variable Enze Li

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).