Fix crash

This commit is contained in:
Daniel Marjamäki 2017-04-11 20:16:33 +02:00
parent f4327f5e45
commit 41a64f6d1f
2 changed files with 17 additions and 0 deletions

View File

@ -172,6 +172,18 @@ void CheckFunctions::checkIgnoredReturnValue()
tok = tok->link();
}
if (Token::simpleMatch(tok, ") (") && Token::Match(tok->link()->previous(), "%name% (")) {
while (tok && tok->str() != ";") {
if (Token::Match(tok, "(|["))
tok = tok->link();
else
tok = tok->next();
}
if (!tok)
break;
continue;
}
if (tok->varId() || !Token::Match(tok, "%name% ("))
continue;

View File

@ -918,6 +918,11 @@ private:
" DEBUG(x(); mystrcmp(a,b););\n"
"}", "test.cpp", &settings2);
ASSERT_EQUALS("", errout.str());
check("void foo() {\n" // don't crash
" DEBUG(123)(mystrcmp(a,b))(fd);\n"
"}", "test.c", &settings2);
}
};