Repository navigation
Fix #11599 false negative: constParameter #4902
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
Merged
orbitcowboy
merged 27 commits into
cppcheck-opensource:main
from
chrchr-github:chr_Fix11599
Apr 2, 2023
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
714c919
Partial fix for #11599 false negative: constParameter
chrchr-github 7b48087
Adjust test
chrchr-github 3fb79f7
Update testother.cpp
chrchr-github d9baf91
Update testother.cpp
chrchr-github 44e4126
Fix #11599 false negative: constParameter
chrchr-github 31e34be
Merge
chrchr-github 077d160
Fix new warnings
chrchr-github ff8326b
Format
chrchr-github fba9174
Add difference_type
chrchr-github 39f808f
Remove isAliased()
chrchr-github dce4db2
Undo
chrchr-github 541dd7c
Adjust test
chrchr-github ccc7aaf
Add test
chrchr-github 5c78e53
Improve const check
chrchr-github a7e6795
Merge branch 'main' into chr_Fix11599
chrchr-github 8613ec8
Tweak constness, add tests
chrchr-github 2e6191b
Add tests
chrchr-github e534bdd
Merge
chrchr-github ed961ff
Use new helper function, fixtest
chrchr-github 6524de0
Remove bailout, fix check for cast
chrchr-github fab8fcf
Prevent FP
chrchr-github 8fe4e6f
Fix constVariable check, add tests
chrchr-github f1f8f74
Format
chrchr-github f8a945e
Format
chrchr-github 6035ee4
Add test for #11632
chrchr-github 4327909
Merge
chrchr-github f03f7d3
Merge branch 'danmar:main' into chr_Fix11599
chrchr-github File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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.
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.
This should be true because the
indirectwill be set to 1, which will check that the data is modified and not the pointer.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
indirectis set to 0 then it should befalse.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.
With the new formula and
indirectalways 0 (as it was before), this fails:Uh oh!
There was an error while loading. Please reload this page.
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.
We need to check for array and up the indirection since arrays are passed by pointer and not by value, I assume.
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.
Well, a
std::arraycan be passed by value, and since we like to conflate those...Uh oh!
There was an error while loading. Please reload this page.
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.
inconclusivewas not reset (it is only ever set totrue, neverfalse.So
inconclusiveis true if we haven't seen a declaration at all, but false if there is a possibly-changing declaration. Shouldn't the result also depend on the function's definition?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.
That's one of the things I want to address with the work started in #4798.