Skip to content

binutils/readelf: Remove unused static variables#55

Open
amd-bfilipov wants to merge 1 commit intoamd-stagingfrom
users/bfilipov/readelf-remove-dead-variables
Open

binutils/readelf: Remove unused static variables#55
amd-bfilipov wants to merge 1 commit intoamd-stagingfrom
users/bfilipov/readelf-remove-dead-variables

Conversation

@amd-bfilipov
Copy link
Copy Markdown
Contributor

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]

Fixes: AIROCGDB-553

There is a commit that supresses the issue: 3e011457055bd3868bd05cf80bc1a4482777809b but we should still fix this.
I will send the same patch upstream, this is just a stand in until it gets merged, so we don't block LLVM bumps.

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]

Fixes: AIROCGDB-553
@lumachad lumachad requested a review from simark March 30, 2026 20:53
@lumachad
Copy link
Copy Markdown
Collaborator

I think this should go upstream first.

@lancesix
Copy link
Copy Markdown
Collaborator

I think this should go upstream first.

I agree. This should be simple enough to not take too long to land upstream. Do you have a link to the upstream submission?

@amd-bfilipov
Copy link
Copy Markdown
Contributor Author

@lancesix
Copy link
Copy Markdown
Collaborator

https://inbox.sourceware.org/gdb-patches/20260331102230.3969229-1-bfilipov@amd.com/T/#u

I think this should have been posted to binutils@, not gdb-patches@.

@lumachad
Copy link
Copy Markdown
Collaborator

lumachad commented Apr 7, 2026

@amd-bfilipov If we're picking this from upstream, we don't need a PR. Feel free to close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants