File tree 1 file changed +9
-3
lines changed
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -8729,10 +8729,16 @@ void Tokenizer::findGarbageCode() const
8729
8729
if (Token::Match (tok, " %num%|%bool%|%char%|%str% %num%|%bool%|%char%|%str%" ) && !Token::Match (tok, " %str% %str%" ))
8730
8730
syntaxError (tok);
8731
8731
if (Token::Match (tok, " %num%|%bool%|%char%|%str% {|(" )) {
8732
- if (tok->strAt (1 ) == " (" )
8732
+ if (tok->strAt (1 ) == " (" ) {
8733
+ if (tok->isExpandedMacro () && mSettings .userDefines .empty ()) {
8734
+ throw InternalError (tok, " literal used as function. Macro '" + tok->getMacroName () +
8735
+ " ' expands to '" + tok->str () + +" '. Use -D" + tok->getMacroName () +
8736
+ " =... to specify a value, or -U" + tok->getMacroName ()
8737
+ + " to undefine it." , InternalError::UNKNOWN_MACRO);
8738
+ }
8733
8739
syntaxError (tok);
8734
- else if (!(tok->tokType () == Token::Type::eString && Token::simpleMatch (tok->tokAt (-1 ), " extern" )) &&
8735
- !(tok->tokType () == Token::Type::eBoolean && cpp && Token::simpleMatch (tok->tokAt (-1 ), " requires" )))
8740
+ } else if (!(tok->tokType () == Token::Type::eString && Token::simpleMatch (tok->tokAt (-1 ), " extern" )) &&
8741
+ !(tok->tokType () == Token::Type::eBoolean && cpp && Token::simpleMatch (tok->tokAt (-1 ), " requires" )))
8736
8742
syntaxError (tok);
8737
8743
}
8738
8744
if (Token::Match (tok, " ( ) %num%|%bool%|%char%|%str%" ))
You can’t perform that action at this time.
0 commit comments