-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix #14130: false positive: unusedStructMember with [[maybe_unused]] #7818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
bfad711
to
4ad7c65
Compare
We should add more tests which cover the added functionality. |
Most of the additions came about from failing tests in other components, but I could add some others that are more specific. |
b77f655
to
8f029d3
Compare
Good to know. Just looking at the changes this was not evident. So it should be fine then. |
Oops, I included a commit that shouldn't be here, I'll remove it later tonight. Edit: Done. |
|
else if (Token::Match(tok->previous(), "%name%") && Token::Match(tok->link(), "] [;={]")) { | ||
tok->previous()->isAttributeMaybeUnused(true); | ||
} else { | ||
if (Token::simpleMatch(head->next(), "[")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer if we make it explicit what code this is supposed to handle.. how about:
if (Token::simpleMatch(head->next(), "[")) { | |
if (Token::Match(head, "auto|*|&|&& [")) { // c++17 structured binding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that is a common pattern we should probably make it a helper.
No description provided.