-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
fixed #12378 FN containerOutOfBounds with scope operator / Library: cleaned up usage of Container::startPattern2
#5908
Merged
+36
−29
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 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 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 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
Oops, something went wrong.
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 was wrong. The pattern is actually
Vector < !!::
.The test now fails at the very first assert in this block so I think we might have a bug on our hands here as the pattern does not seem to make sense as code like
Vector<::
should not appear.Turns out this was a bug in introduced in an optimization in 16ebb90.
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.
Actually - the code was wrong before. So it seems it wasn't my change after all.
The test also initially did not include a
<
- that was added by @danmar in f131a99.The initial code to append this was also added by @danmar in 2a82968. The whole changes are unfortunately spread across several commits.
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.
Since this is a SDB test, why not replace
&set
with&settings1
,Vector
withstd::vector
,test::string
withstd::string
?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 might be a way. But I am not sure if that will fix the test (will try later).
It still seems there is something wrong here as the
startPattern2
will never match in that case.I assume if
startPattern
ends with<
we should not generatestartPattern2
at all. But the question is what we should do in that case. Just skip it or drop the trailing<
, append!!::
and match it like the test previously did manually?The original code before my optimization suggests that something different should have been matched since the
Token::Match()
was redundant which was most likely a copy&paste error.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.
The test strangely works when using
std::vector
which puzzles me. I want to know what the difference is.Actually. The
!!::
instartPattern2
would not make any sense since the last token would always match since it would never occur in real code. So in case it ends with a<
we should not be appending::!!
at all.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 found the error in the changes. I forgot to terminate the encoded
<
character<
- the;
is missing at the end.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 will fix https://trac.cppcheck.net/ticket/12378
Feel free to take the test case from #5910