Uninitialized variables: Fixed simple undetected case for '= %var% -'
This commit is contained in:
parent
cbdae275ed
commit
35c72db251
|
@ -465,7 +465,7 @@ private:
|
|||
}
|
||||
|
||||
// Used..
|
||||
if (Token::Match(tok.previous(), "[[(,+-*/] %var% []),;+-*/]"))
|
||||
if (Token::Match(tok.previous(), "[[(,+-*/=] %var% []),;+-*/]"))
|
||||
{
|
||||
use(checks, &tok);
|
||||
return &tok;
|
||||
|
|
|
@ -73,6 +73,12 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (error) Uninitialized variable: a\n", errout.str());
|
||||
|
||||
checkUninitVar("void foo() {\n"
|
||||
" int a;\n"
|
||||
" b = a - c;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (error) Uninitialized variable: a\n", errout.str());
|
||||
|
||||
// dereferencing uninitialized pointer..
|
||||
checkUninitVar("static void foo()\n"
|
||||
"{\n"
|
||||
|
|
Loading…
Reference in New Issue