Fixed #3355 (False positive: member variable initialization (::ZeroMemory))
This commit is contained in:
parent
1084e4bece
commit
323019c48f
|
@ -395,7 +395,10 @@ void CheckClass::initializeVarList(const Function &func, std::list<std::string>
|
|||
else {
|
||||
assignAllVar(usage);
|
||||
}
|
||||
} else if (Token::Match(ftok, "%var% (") && ftok->str() != "if") {
|
||||
} else if (Token::Match(ftok, "::| %var% (") && ftok->str() != "if") {
|
||||
if (ftok->str() == "::")
|
||||
ftok = ftok->next();
|
||||
|
||||
// Passing "this" => assume that everything is initialized
|
||||
for (const Token *tok2 = ftok->next()->link(); tok2 && tok2 != ftok; tok2 = tok2->previous()) {
|
||||
if (tok2->str() == "this") {
|
||||
|
|
|
@ -76,6 +76,7 @@ private:
|
|||
TEST_CASE(uninitVarArray5);
|
||||
TEST_CASE(uninitVarArray6);
|
||||
TEST_CASE(uninitVarArray7);
|
||||
TEST_CASE(uninitVarArray8);
|
||||
TEST_CASE(uninitVarArray2D);
|
||||
TEST_CASE(uninitVarArray3D);
|
||||
TEST_CASE(uninitVarStruct1); // ticket #2172
|
||||
|
@ -2424,6 +2425,15 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void uninitVarArray8() {
|
||||
checkUninitVar("class Foo {\n"
|
||||
" char a[10];\n"
|
||||
"public:\n"
|
||||
" Foo() { ::ZeroMemory(a); }\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void uninitVarArray2D() {
|
||||
checkUninitVar("class John\n"
|
||||
"{\n"
|
||||
|
|
Loading…
Reference in New Issue