[binutils-gdb] binutils/readelf: Remove unused static variables

Luis Machado via Binutils-cvs <[email protected]>
Newsgroups gmane.comp.gnu.binutils.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a04e10c4b7b0a7621e452fdfce716aacab633bed

commit a04e10c4b7b0a7621e452fdfce716aacab633bed
Author: Bratislav Filipovic <[email protected]>
Date:   Wed Apr 1 16:39:14 2026 +0530

    binutils/readelf: Remove unused static variables
    
    Remove static variables do_ctf and do_sframe that are set but never
    read, causing build failures with LLVM's extended
    -Wunused-but-set-variable warning.
    
    These variables are dead code:
    - Declared at lines 244-245 as static booleans
    - Set to true when --ctf or --sframe options are parsed
    - Never actually used or read anywhere in the code
    - The actual dump functionality is triggered by request_dump() calls
    
    Build error with -Werror enabled:
    
    binutils/readelf.c:244:13: error: variable 'do_ctf' set but not used
      [-Werror,-Wunused-but-set-variable]
    binutils/readelf.c:245:13: error: variable 'do_sframe' set but not used
      [-Werror,-Wunused-but-set-variable]

Diff:
---
 binutils/readelf.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/binutils/readelf.c b/binutils/readelf.c
index 3b6d606b36c..869bb23e48f 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -241,8 +241,6 @@ static bool do_dump = false;
 static bool do_version = false;
 static bool do_histogram = false;
 static bool do_debugging = false;
-static bool do_ctf = false;
-static bool do_sframe = false;
 static bool do_arch = false;
 static bool do_notes = false;
 static bool do_archive_index = false;
@@ -6962,7 +6960,6 @@ parse_args (struct dump_data *dumpdata, int argc, char ** argv)
 	  dwarf_check = true;
 	  break;
 	case OPTION_CTF_DUMP:
-	  do_ctf = true;
 	  request_dump (dumpdata, CTF_DUMP);
 	  break;
 	case OPTION_CTF_SYMBOLS:
@@ -6978,7 +6975,6 @@ parse_args (struct dump_data *dumpdata, int argc, char ** argv)
 	  dump_ctf_parent_name = strdup (optarg);
 	  break;
 	case OPTION_SFRAME_DUMP:
-	  do_sframe = true;
 	  /* Fix PR/32589 but keep the error messaging same ?  */
 	  if (optarg != NULL && strcmp (optarg, "") == 0)
 	    {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.