-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Fix #15079 Regression: FP syntaxError for C-style cast before ::
#8912
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9179,8 +9179,8 @@ void Tokenizer::findGarbageCode() const | |
| syntaxError(tok); | ||
| if (Token::simpleMatch(tok->tokAt(-1), ")")) { | ||
| const Token* const prev = tok->linkAt(-1)->tokAt(-1); | ||
| if (!Token::Match(prev, "%name% (") || (!prev->isControlFlowKeyword() && prev->str() != "decltype")) { | ||
| if (prev && prev->isUpperCaseName()) | ||
| if (prev && prev->isNameOnly()) { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an AI review take it with a grain of salt. Please feel free to reject it by clicking on Resolve button Whether a token is a keyword depends on The old code avoided this with |
||
| if (prev->isUpperCaseName()) | ||
| unknownMacroError(prev); | ||
| else | ||
| syntaxError(tok); | ||
|
|
||
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 is an AI review take it with a grain of salt. Please feel free to reject it by clicking on Resolve button
The old condition made the intent visible (
%name% (, "something that looks like a macro call"). WithisNameOnly()that's less obvious to a reader. A short comment would help, e.g.// NAME(...):: => NAME is probably an unknown macro; casts like (void)::f() and new (p) ::T are valid.Note also that
isNameOnly()is false for names with any extra flag set, so this is stricter than!prev->isKeyword(). That's fine from a no-false-positives point of view, just mentioning it in case it was unintentional.