Fixed #5170 (False positive: warning (uninitMemberVar): Member variable 'ToDoubleArray::mfNaN' is not initialized in the constructor.)

This commit is contained in:
Daniel Marjamäki 2013-12-15 14:07:29 +01:00
parent a948b4f4b0
commit 92305ed1f9
2 changed files with 13 additions and 1 deletions

View File

@ -550,7 +550,7 @@ void CheckClass::initializeVarList(const Function &func, std::list<const Functio
ftok = ftok->tokAt(2); ftok = ftok->tokAt(2);
// Skip "classname :: " // Skip "classname :: "
if (Token::Match(ftok, "%var% ::")) while (Token::Match(ftok, "%var% ::"))
ftok = ftok->tokAt(2); ftok = ftok->tokAt(2);
// Clearing all variables.. // Clearing all variables..

View File

@ -121,6 +121,7 @@ private:
TEST_CASE(uninitVar24); // ticket #3190 TEST_CASE(uninitVar24); // ticket #3190
TEST_CASE(uninitVar25); // ticket #4789 TEST_CASE(uninitVar25); // ticket #4789
TEST_CASE(uninitVar26); TEST_CASE(uninitVar26);
TEST_CASE(uninitVar27); // ticket #5170 - rtl::math::setNan(&d)
TEST_CASE(uninitVarEnum); TEST_CASE(uninitVarEnum);
TEST_CASE(uninitVarStream); TEST_CASE(uninitVarStream);
TEST_CASE(uninitVarTypedef); TEST_CASE(uninitVarTypedef);
@ -1913,6 +1914,17 @@ private:
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
} }
void uninitVar27() {
check("class A {\n"
" double d;\n"
"public:\n"
" A() {\n"
" rtl::math::setNan(&d);\n"
" }\n"
"};");
ASSERT_EQUALS("", errout.str());
}
void uninitVarArray1() { void uninitVarArray1() {
check("class John\n" check("class John\n"
"{\n" "{\n"