Uninitialized variables: fix fp when 'a=((b)=c)' is used
This commit is contained in:
parent
3404bc9ab0
commit
a87fb96eaf
|
@ -376,7 +376,7 @@ private:
|
||||||
if (tok2->varId() &&
|
if (tok2->varId() &&
|
||||||
!Token::Match(tok2->previous(), "&|::") &&
|
!Token::Match(tok2->previous(), "&|::") &&
|
||||||
!Token::simpleMatch(tok2->tokAt(-2), "& (") &&
|
!Token::simpleMatch(tok2->tokAt(-2), "& (") &&
|
||||||
tok2->strAt(1) != "=") {
|
!Token::Match(tok2->tokAt(1), ")| =")) {
|
||||||
// Multiple assignments..
|
// Multiple assignments..
|
||||||
if (Token::Match(tok2->next(), ".|[")) {
|
if (Token::Match(tok2->next(), ".|[")) {
|
||||||
const Token * tok3 = tok2;
|
const Token * tok3 = tok2;
|
||||||
|
|
|
@ -303,6 +303,12 @@ private:
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
checkUninitVar("static void foo() {\n"
|
||||||
|
" int x, y;\n"
|
||||||
|
" x = ((y) = 10);\n"
|
||||||
|
"}");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
// Ticket #3597
|
// Ticket #3597
|
||||||
checkUninitVar("int f() {\n"
|
checkUninitVar("int f() {\n"
|
||||||
" int a;\n"
|
" int a;\n"
|
||||||
|
|
Loading…
Reference in New Issue