Fixed #3507 (false positive: comma-separated statements before return in methods)
This commit is contained in:
parent
84c0368bfd
commit
f1ebd99dc2
|
@ -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);
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue