Fixed varId0 message #6443.

This commit is contained in:
PKEuS 2015-01-31 10:33:15 +01:00
parent 57ec1aea91
commit 33f5d27b53
3 changed files with 9 additions and 1 deletions

View File

@ -1603,6 +1603,8 @@ static void valueFlowSubFunction(TokenList *tokenlist, ErrorLogger *errorLogger,
// Set value in function scope..
const unsigned int varid2 = arg->declarationId();
if (!varid2)
continue;
for (const Token *tok2 = functionScope->classStart->next(); tok2 != functionScope->classEnd; tok2 = tok2->next()) {
if (Token::Match(tok2, "%varid% !!=", varid2)) {
for (std::list<ValueFlow::Value>::const_iterator val = argvalues.begin(); val != argvalues.end(); ++val)

View File

@ -385,7 +385,7 @@ private:
"{\n"
" (foo(s, , 2, , , 5, , 7)) abort()\n"
"}\n";
ASSERT_THROW(checkCode(code), InternalError);
checkCode(code);
// #6106
code = " f { int i ; b2 , [ ] ( for ( i = 0 ; ; ) ) }";

View File

@ -1395,6 +1395,12 @@ private:
" dostuff(x+1);\n"
"}\n";
ASSERT_EQUALS(true, testValueOfX(code, 2U, 2));
code = "void leaveNotifyEvent(const XCrossingEvent * const) { }\n"
"void motionNotifyEvent() {\n"
" leaveNotifyEvent(0);\n"
"}";
testValueOfX(code, 2U, 2); // No complaint about Token::Match called with varid 0. (#6443)
}
void valueFlowFunctionReturn() {