gdb/amd-dbgapi: fix -Wdeprecated-enum-enum-conversion warning#109
Open
simark wants to merge 1 commit intoROCm:amd-stagingfrom
Open
gdb/amd-dbgapi: fix -Wdeprecated-enum-enum-conversion warning#109simark wants to merge 1 commit intoROCm:amd-stagingfrom
simark wants to merge 1 commit intoROCm:amd-stagingfrom
Conversation
With gcc 16, I get:
/home/smarchi/src/binutils-gdb/gdb/amd-dbgapi-target.c: In function ‘void info_dispatches_command(const char*, int)’:
/home/smarchi/src/binutils-gdb/gdb/amd-dbgapi-target.c:4729:26: error: bitwise operation between different enumeration types ‘amd_dbgapi_dispatch_barrier_t’ and ‘amd_dbgapi_dispatch_fence_scope_t’ is deprecated [-Werror=deprecated-enum-enum-conversion]
4729 | if ((barrier | acquire) && release)
| ~~~~~~~~^~~~~~~~~
IIUC, the intent of this is just to know if we've written something in `ss`
already, and if we're going to write more. And if so, write a `|`
separator. The `|` should probably have been a `||`, or because we like
to be explicit in GDB:
if ((barrier != AMD_DBGAPI_DISPATCH_BARRIER_NONE
|| acquire != AMD_DBGAPI_DISPATCH_FENCE_SCOPE_NONE)
&& release != AMD_DBGAPI_DISPATCH_FENCE_SCOPE_NONE)
ss << "|";
But I think it's simpler to rewrite this to append to a string, and
append a `|` if we're about to append something and the string is not
empty. A stringstream has no advantage over using a string in this
case.
Change-Id: I48307186f00a9943f6be388960c85ce53d10b0c3
4e81b2f to
6561727
Compare
lumachad
approved these changes
May 5, 2026
Collaborator
lumachad
left a comment
There was a problem hiding this comment.
Looks OK to me. I think the readability took a hit here, but I don't feel strongly about it if it works.
lancesix
approved these changes
May 5, 2026
Collaborator
lancesix
left a comment
There was a problem hiding this comment.
LGTM, thanks.
I think this makes things cleaner as well.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With gcc 16, I get:
IIUC, the intent of this is just to know if we've written something in
ssalready, and if we're going to write more. And if so, write a|separator. The|should probably have been a||, or because we like to be explicit in GDB:But I think it's simpler to rewrite this to append to a string, and append a
|if we're about to append something and the string is not empty. A stringstream has no advantage over using a string in this case.Change-Id: I48307186f00a9943f6be388960c85ce53d10b0c3
Motivation
Technical Details
Test Plan
Test Result
Submission Checklist