Fixed #3507 (false positive: comma-separated statements before return in methods)

This commit is contained in:
Daniel Marjamäki 2012-09-15 11:55:08 +02:00
parent 84c0368bfd
commit f1ebd99dc2
2 changed files with 9 additions and 0 deletions

View File

@ -5793,6 +5793,9 @@ void Tokenizer::simplifyInitVar()
if (!tok->isName() || (tok->previous() && !Token::Match(tok->previous(), "[;{}]")))
continue;
if (tok->str() == "return")
continue;
if (Token::Match(tok, "class|struct|union| %type% *| %var% ( &| %any% ) ;") ||
Token::Match(tok, "%type% *| %var% ( %type% (")) {
tok = initVar(tok);

View File

@ -6110,6 +6110,12 @@ private:
ASSERT_EQUALS("int x ; x = f ( ) ;", tokenizeAndStringify(code, false));
ASSERT_EQUALS("", errout.str());
}
{
const char code[] = "return doSomething(X), 0;";
ASSERT_EQUALS("return doSomething ( X ) , 0 ;", tokenizeAndStringify(code, false));
ASSERT_EQUALS("", errout.str());
}
}
void bitfields1() {