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(), "[;{}]")))
|
if (!tok->isName() || (tok->previous() && !Token::Match(tok->previous(), "[;{}]")))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (tok->str() == "return")
|
||||||
|
continue;
|
||||||
|
|
||||||
if (Token::Match(tok, "class|struct|union| %type% *| %var% ( &| %any% ) ;") ||
|
if (Token::Match(tok, "class|struct|union| %type% *| %var% ( &| %any% ) ;") ||
|
||||||
Token::Match(tok, "%type% *| %var% ( %type% (")) {
|
Token::Match(tok, "%type% *| %var% ( %type% (")) {
|
||||||
tok = initVar(tok);
|
tok = initVar(tok);
|
||||||
|
|
|
@ -6110,6 +6110,12 @@ private:
|
||||||
ASSERT_EQUALS("int x ; x = f ( ) ;", tokenizeAndStringify(code, false));
|
ASSERT_EQUALS("int x ; x = f ( ) ;", tokenizeAndStringify(code, false));
|
||||||
ASSERT_EQUALS("", errout.str());
|
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() {
|
void bitfields1() {
|
||||||
|
|
Loading…
Reference in New Issue