Fixed false positives about uninitialized variables
This commit is contained in:
parent
ef21ba7425
commit
b6c320de8a
|
@ -1286,6 +1286,8 @@ private:
|
||||||
static void use(bool &foundError, std::list<ExecutionPath *> &checks, const Token *tok, const int mode)
|
static void use(bool &foundError, std::list<ExecutionPath *> &checks, const Token *tok, const int mode)
|
||||||
{
|
{
|
||||||
const unsigned int varid(tok->varId());
|
const unsigned int varid(tok->varId());
|
||||||
|
if (varid == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
std::list<ExecutionPath *>::const_iterator it;
|
std::list<ExecutionPath *>::const_iterator it;
|
||||||
for (it = checks.begin(); it != checks.end(); ++it)
|
for (it = checks.begin(); it != checks.end(); ++it)
|
||||||
|
|
|
@ -1315,6 +1315,13 @@ private:
|
||||||
" strcpy(hex, sha1_to_hex(suspect->commit->object.sha1));\n"
|
" strcpy(hex, sha1_to_hex(suspect->commit->object.sha1));\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
checkUninitVar("void foo()\n"
|
||||||
|
"{\n"
|
||||||
|
" const std::string s(x());\n"
|
||||||
|
" strchr(s.c_str(), ',');\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue