Tokenizer; Warn about unknown macro used in string concatenation
This commit is contained in:
parent
bf781f79b6
commit
5df6d5bc7c
|
@ -9332,6 +9332,15 @@ void Tokenizer::reportUnknownMacros()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// String concatenation with unknown macros
|
||||
for (const Token *tok = tokens(); tok; tok = tok->next()) {
|
||||
if (Token::Match(tok, "%str% %name% (") && Token::Match(tok->linkAt(2), ") %str%")) {
|
||||
if (list.isKeyword(tok->next()->str()))
|
||||
continue;
|
||||
unknownMacroError(tok->next());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Tokenizer::findGarbageCode() const
|
||||
|
|
|
@ -7982,6 +7982,9 @@ private:
|
|||
|
||||
const char code2[] = "void foo() { dostuff(x 0); }";
|
||||
ASSERT_THROW(tokenizeAndStringify(code2), InternalError);
|
||||
|
||||
const char code3[] = "f(\"1\" __stringify(48) \"1\");";
|
||||
ASSERT_THROW(tokenizeAndStringify(code3), InternalError);
|
||||
}
|
||||
|
||||
void findGarbageCode() { // Test Tokenizer::findGarbageCode()
|
||||
|
|
Loading…
Reference in New Issue