Fixed #2491 (Tokenizer::setVarId : wrong handling of function call: 'a(b * c, 1);')

This commit is contained in:
Daniel Marjamäki 2011-01-22 09:27:16 +01:00
parent 0746c2410a
commit bc31f317bc
2 changed files with 3 additions and 4 deletions

View File

@ -3303,7 +3303,7 @@ void Tokenizer::setVarId()
// If pattern is "( %type% *|& %var% )" then check if it's a
// variable declaration or a multiplication / mask
if (Token::Match(tok, "( %type% *|& %var% )") && !tok->next()->isStandardType())
if (Token::Match(tok, "( %type% *|& %var% [),]") && !tok->next()->isStandardType())
{
if (!Token::Match(tok->previous(), "%type%"))
continue;

View File

@ -2722,6 +2722,7 @@ private:
void varidFunctionCall2()
{
// #2491
const std::string code("void f(int b) {\n"
" x(a*b,10);\n"
"}");
@ -2730,8 +2731,7 @@ private:
"2: x ( a * b");
const std::string expected2(" , 10 ) ;\n"
"3: }\n");
TODO_ASSERT_EQUALS(expected1+"@1"+expected2, tokenizeDebugListing(code));
ASSERT_EQUALS(expected1+"@2"+expected2, tokenizeDebugListing(code));
ASSERT_EQUALS(expected1+"@1"+expected2, tokenizeDebugListing(code));
}
void varidFunctionCall3()
@ -2751,7 +2751,6 @@ private:
ASSERT_EQUALS(expected, tokenizeDebugListing(code));
}
void varidStl()
{
const std::string actual = tokenizeDebugListing(