-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fix #14075 (False positive: unusedStructMember, member usage by alignas is ignored) #7842
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
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.
Pull Request Overview
This PR fixes a false positive in the unused struct member checker where members referenced in alignas
attributes were incorrectly flagged as unused. The fix adds detection for member usage within alignas
expressions.
- Added logic to detect struct member references in
alignas
attributes - Added test case to verify the fix for issue #14075
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
test/testunusedvar.cpp | Added test case structmember29 to verify alignas member usage detection |
lib/checkunusedvar.cpp | Added code to check for member references in alignas attributes |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
@firewave you reacted with a thumb down, do you see any problem here that I don't see? |
This should be reviewed extra carefully; I used ai to fix the ticket. |
Yes, I read the summary and I had to double-check that what it wrote actually matches what is contained in the PR. It turned out it is basically just the title and the comment blown up, so it adds nothing at all and is just a waste of time and resources.
In this case I would like to have that stated somewhere very clearly and I would even like to have such commits annotated with something which can be searched for in the commit log. As Cppcheck is a security-related tool which handles confidential data I think that might be worth pointing out. FYI I am 100% and totally against any usage of it at all. I think it should never be allowed to write any code which will make it into production. I do see the potential in the area of testing (heck, fuzzing is still controversial in this project and it is essentially the same) but it is not worth any of the cost it implies - at least for me. And that is all I am gonna to say about it. |
This should be reviewed extra carefully; I used ai to fix the ticket.