Revert "Fixed #4165 (False positive:(error) Uninitialized variable: here)"
This reverts commit 96b1890797
.
This commit is contained in:
parent
96b1890797
commit
753942df0c
|
@ -1325,7 +1325,7 @@ bool CheckUninitVar::isVariableUsage(const Token *vartok, bool pointer) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Token::Match(vartok->next(), "++|--|%op%") && !Token::simpleMatch(vartok->tokAt(-2), "( &"))
|
if (Token::Match(vartok->next(), "++|--|%op%"))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (vartok->strAt(1) == "]")
|
if (vartok->strAt(1) == "]")
|
||||||
|
|
|
@ -2002,12 +2002,6 @@ private:
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("[test.cpp:3]: (error) Uninitialized variable: x\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:3]: (error) Uninitialized variable: x\n", errout.str());
|
||||||
|
|
||||||
checkUninitVar2("void f() {\n" // #4165 - fp when & is used as address-of in condition
|
|
||||||
" int x;\n"
|
|
||||||
" if (&x < p) { }\n"
|
|
||||||
"}");
|
|
||||||
ASSERT_EQUALS("", errout.str());
|
|
||||||
|
|
||||||
// ?:
|
// ?:
|
||||||
checkUninitVar2("int f(int *ptr) {\n"
|
checkUninitVar2("int f(int *ptr) {\n"
|
||||||
" int a;\n"
|
" int a;\n"
|
||||||
|
|
Loading…
Reference in New Issue