Fix FP unknownMacro (#5249)
This commit is contained in:
parent
c2ed362c11
commit
2878c68ec0
|
@ -8059,6 +8059,8 @@ void Tokenizer::reportUnknownMacros() const
|
|||
// Report unknown macros before } "{ .. if (x) MACRO }"
|
||||
for (const Token *tok = tokens(); tok; tok = tok->next()) {
|
||||
if (Token::Match(tok, ")|; %name% } !!)")) {
|
||||
if (tok->link() && !Token::simpleMatch(tok->link()->tokAt(-1), "if"))
|
||||
continue;
|
||||
const Token* prev = tok->linkAt(2);
|
||||
while (Token::simpleMatch(prev, "{"))
|
||||
prev = prev->previous();
|
||||
|
|
|
@ -6880,6 +6880,11 @@ private:
|
|||
ASSERT_NO_THROW(tokenizeAndStringify("void f(void* q) {\n"
|
||||
" g(&(S) { .p = (int*)q });\n"
|
||||
"}\n", /*expand*/ true, cppcheck::Platform::Type::Native, "test.c"));
|
||||
|
||||
ASSERT_NO_THROW(tokenizeAndStringify("typedef struct { int i; } S;\n"
|
||||
"void f(float a) {\n"
|
||||
"S s = (S){ .i = (int)a };\n"
|
||||
"}\n", /*expand*/ true, cppcheck::Platform::Type::Native, "test.c"));
|
||||
}
|
||||
|
||||
void findGarbageCode() { // Test Tokenizer::findGarbageCode()
|
||||
|
|
Loading…
Reference in New Issue