Fixed #2389 (mistakable warning from 'CheckClass::uninitVarError')
This commit is contained in:
parent
d2714fefda
commit
e459ed1de3
|
@ -173,7 +173,7 @@ void CheckClass::noConstructorError(const Token *tok, const std::string &classna
|
||||||
|
|
||||||
void CheckClass::uninitVarError(const Token *tok, const std::string &classname, const std::string &varname)
|
void CheckClass::uninitVarError(const Token *tok, const std::string &classname, const std::string &varname)
|
||||||
{
|
{
|
||||||
reportError(tok, Severity::warning, "uninitVar", "Member variable not initialized in the constructor '" + classname + "::" + varname + "'");
|
reportError(tok, Severity::warning, "uninitVar", "Member variable '" + classname + "::" + varname + "' is not initialised in the constructor.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckClass::operatorEqVarError(const Token *tok, const std::string &classname, const std::string &varname)
|
void CheckClass::operatorEqVarError(const Token *tok, const std::string &classname, const std::string &varname)
|
||||||
|
|
|
@ -1537,7 +1537,7 @@ private:
|
||||||
" ECODES _code;\n"
|
" ECODES _code;\n"
|
||||||
"};\n");
|
"};\n");
|
||||||
|
|
||||||
ASSERT_EQUALS("[test.cpp:10]: (warning) Member variable not initialized in the constructor 'Fred::_code'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:10]: (warning) Member variable 'Fred::_code' is not initialised in the constructor.\n", errout.str());
|
||||||
|
|
||||||
|
|
||||||
checkUninitVar("class A{};\n"
|
checkUninitVar("class A{};\n"
|
||||||
|
@ -1549,7 +1549,7 @@ private:
|
||||||
"private:\n"
|
"private:\n"
|
||||||
" float f;\n"
|
" float f;\n"
|
||||||
"};\n");
|
"};\n");
|
||||||
ASSERT_EQUALS("[test.cpp:6]: (warning) Member variable not initialized in the constructor 'B::f'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:6]: (warning) Member variable 'B::f' is not initialised in the constructor.\n", errout.str());
|
||||||
|
|
||||||
checkUninitVar("class C\n"
|
checkUninitVar("class C\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
@ -1603,7 +1603,7 @@ private:
|
||||||
" };\n"
|
" };\n"
|
||||||
" Bar bars[2];\n"
|
" Bar bars[2];\n"
|
||||||
"};\n");
|
"};\n");
|
||||||
ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable not initialized in the constructor 'Foo::bars'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'Foo::bars' is not initialised in the constructor.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void uninitVar4()
|
void uninitVar4()
|
||||||
|
@ -1698,7 +1698,7 @@ private:
|
||||||
"{\n"
|
"{\n"
|
||||||
" SetMinSize( wxSize( 48,48 ) );\n"
|
" SetMinSize( wxSize( 48,48 ) );\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable not initialized in the constructor 'Prefs::xasd'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable 'Prefs::xasd' is not initialised in the constructor.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void uninitVar10() // ticket #1993
|
void uninitVar10() // ticket #1993
|
||||||
|
@ -1711,7 +1711,7 @@ private:
|
||||||
" int var2;\n"
|
" int var2;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"A::A() : var1(0) { }\n");
|
"A::A() : var1(0) { }\n");
|
||||||
ASSERT_EQUALS("[test.cpp:8]: (warning) Member variable not initialized in the constructor 'A::var2'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:8]: (warning) Member variable 'A::var2' is not initialised in the constructor.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void uninitVar11()
|
void uninitVar11()
|
||||||
|
@ -1723,7 +1723,7 @@ private:
|
||||||
" int var;\n"
|
" int var;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"A::A(int a) { }\n");
|
"A::A(int a) { }\n");
|
||||||
ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable not initialized in the constructor 'A::var'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable 'A::var' is not initialised in the constructor.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void uninitVar12() // ticket #2078
|
void uninitVar12() // ticket #2078
|
||||||
|
@ -1740,8 +1740,8 @@ private:
|
||||||
" {}\n"
|
" {}\n"
|
||||||
" int x, y;\n"
|
" int x, y;\n"
|
||||||
"};\n");
|
"};\n");
|
||||||
ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable not initialized in the constructor 'Point::x'\n"
|
ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'Point::x' is not initialised in the constructor.\n"
|
||||||
"[test.cpp:4]: (warning) Member variable not initialized in the constructor 'Point::y'\n", errout.str());
|
"[test.cpp:4]: (warning) Member variable 'Point::y' is not initialised in the constructor.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void uninitVar13() // ticket #1195
|
void uninitVar13() // ticket #1195
|
||||||
|
@ -1753,7 +1753,7 @@ private:
|
||||||
" A()\n"
|
" A()\n"
|
||||||
" {}\n"
|
" {}\n"
|
||||||
"};\n");
|
"};\n");
|
||||||
ASSERT_EQUALS("[test.cpp:5]: (warning) Member variable not initialized in the constructor 'A::ints'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:5]: (warning) Member variable 'A::ints' is not initialised in the constructor.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void uninitVar14() // ticket #2149
|
void uninitVar14() // ticket #2149
|
||||||
|
@ -1769,7 +1769,7 @@ private:
|
||||||
"Foo::Foo()\n"
|
"Foo::Foo()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("[test.cpp:8]: (warning) Member variable not initialized in the constructor 'Foo::mMember'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:8]: (warning) Member variable 'Foo::mMember' is not initialised in the constructor.\n", errout.str());
|
||||||
|
|
||||||
// single namespace
|
// single namespace
|
||||||
checkUninitVar("namespace Output\n"
|
checkUninitVar("namespace Output\n"
|
||||||
|
@ -1785,7 +1785,7 @@ private:
|
||||||
" {\n"
|
" {\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("[test.cpp:10]: (warning) Member variable not initialized in the constructor 'Foo::mMember'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:10]: (warning) Member variable 'Foo::mMember' is not initialised in the constructor.\n", errout.str());
|
||||||
|
|
||||||
// constructor outside namespace
|
// constructor outside namespace
|
||||||
checkUninitVar("namespace Output\n"
|
checkUninitVar("namespace Output\n"
|
||||||
|
@ -1817,7 +1817,7 @@ private:
|
||||||
"Output::Foo::Foo()\n"
|
"Output::Foo::Foo()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("[test.cpp:11]: (warning) Member variable not initialized in the constructor 'Foo::mMember'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:11]: (warning) Member variable 'Foo::mMember' is not initialised in the constructor.\n", errout.str());
|
||||||
|
|
||||||
// constructor in separate namespace
|
// constructor in separate namespace
|
||||||
checkUninitVar("namespace Output\n"
|
checkUninitVar("namespace Output\n"
|
||||||
|
@ -1836,7 +1836,7 @@ private:
|
||||||
" {\n"
|
" {\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("[test.cpp:13]: (warning) Member variable not initialized in the constructor 'Foo::mMember'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:13]: (warning) Member variable 'Foo::mMember' is not initialised in the constructor.\n", errout.str());
|
||||||
|
|
||||||
// constructor in different separate namespace
|
// constructor in different separate namespace
|
||||||
checkUninitVar("namespace Output\n"
|
checkUninitVar("namespace Output\n"
|
||||||
|
@ -1896,7 +1896,7 @@ private:
|
||||||
" }\n"
|
" }\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("[test.cpp:15]: (warning) Member variable not initialized in the constructor 'Foo::mMember'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:15]: (warning) Member variable 'Foo::mMember' is not initialised in the constructor.\n", errout.str());
|
||||||
|
|
||||||
// constructor in nested different separate namespace
|
// constructor in nested different separate namespace
|
||||||
checkUninitVar("namespace A\n"
|
checkUninitVar("namespace A\n"
|
||||||
|
@ -1989,7 +1989,7 @@ private:
|
||||||
" {\n"
|
" {\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"};\n");
|
"};\n");
|
||||||
ASSERT_EQUALS("[test.cpp:10]: (warning) Member variable not initialized in the constructor 'Bar::foo'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:10]: (warning) Member variable 'Bar::foo' is not initialised in the constructor.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void uninitVar17()
|
void uninitVar17()
|
||||||
|
@ -2021,7 +2021,7 @@ private:
|
||||||
" {\n"
|
" {\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"};\n");
|
"};\n");
|
||||||
ASSERT_EQUALS("[test.cpp:9]: (warning) Member variable not initialized in the constructor 'Bar::foo'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:9]: (warning) Member variable 'Bar::foo' is not initialised in the constructor.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void uninitVarArray1()
|
void uninitVarArray1()
|
||||||
|
@ -2034,7 +2034,7 @@ private:
|
||||||
"private:\n"
|
"private:\n"
|
||||||
" char name[255];\n"
|
" char name[255];\n"
|
||||||
"};\n");
|
"};\n");
|
||||||
ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable not initialized in the constructor 'John::name'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'John::name' is not initialised in the constructor.\n", errout.str());
|
||||||
|
|
||||||
checkUninitVar("class John\n"
|
checkUninitVar("class John\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
@ -2081,7 +2081,7 @@ private:
|
||||||
" John() { }\n"
|
" John() { }\n"
|
||||||
" A *a[5];\n"
|
" A *a[5];\n"
|
||||||
"};\n");
|
"};\n");
|
||||||
ASSERT_EQUALS("[test.cpp:5]: (warning) Member variable not initialized in the constructor 'John::a'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:5]: (warning) Member variable 'John::a' is not initialised in the constructor.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void uninitVarArray2()
|
void uninitVarArray2()
|
||||||
|
@ -2200,7 +2200,7 @@ private:
|
||||||
" A() {\n"
|
" A() {\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"};\n");
|
"};\n");
|
||||||
ASSERT_EQUALS("[test.cpp:10]: (warning) Member variable not initialized in the constructor 'A::b'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:10]: (warning) Member variable 'A::b' is not initialised in the constructor.\n", errout.str());
|
||||||
|
|
||||||
checkUninitVar("class A\n"
|
checkUninitVar("class A\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
@ -2233,7 +2233,7 @@ private:
|
||||||
" Fred()\n"
|
" Fred()\n"
|
||||||
" { }\n"
|
" { }\n"
|
||||||
"};\n");
|
"};\n");
|
||||||
ASSERT_EQUALS("[test.cpp:11]: (warning) Member variable not initialized in the constructor 'Fred::p'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:11]: (warning) Member variable 'Fred::p' is not initialised in the constructor.\n", errout.str());
|
||||||
|
|
||||||
checkUninitVar("struct POINT\n"
|
checkUninitVar("struct POINT\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
@ -2300,7 +2300,7 @@ private:
|
||||||
"private:\n"
|
"private:\n"
|
||||||
" int i;\n"
|
" int i;\n"
|
||||||
"};\n");
|
"};\n");
|
||||||
ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable not initialized in the constructor 'Fred::i'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'Fred::i' is not initialised in the constructor.\n", errout.str());
|
||||||
|
|
||||||
// Unknown non-member function
|
// Unknown non-member function
|
||||||
checkUninitVar("class Fred\n"
|
checkUninitVar("class Fred\n"
|
||||||
|
@ -2310,7 +2310,7 @@ private:
|
||||||
"private:\n"
|
"private:\n"
|
||||||
" int i;\n"
|
" int i;\n"
|
||||||
"};\n");
|
"};\n");
|
||||||
ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable not initialized in the constructor 'Fred::i'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'Fred::i' is not initialised in the constructor.\n", errout.str());
|
||||||
|
|
||||||
// Unknown non-member function
|
// Unknown non-member function
|
||||||
checkUninitVar("class ABC { };\n"
|
checkUninitVar("class ABC { };\n"
|
||||||
|
@ -2321,7 +2321,7 @@ private:
|
||||||
"private:\n"
|
"private:\n"
|
||||||
" int i;\n"
|
" int i;\n"
|
||||||
"};\n");
|
"};\n");
|
||||||
ASSERT_EQUALS("[test.cpp:5]: (warning) Member variable not initialized in the constructor 'Fred::i'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:5]: (warning) Member variable 'Fred::i' is not initialised in the constructor.\n", errout.str());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2336,7 +2336,7 @@ private:
|
||||||
" unsigned int i;\n"
|
" unsigned int i;\n"
|
||||||
"};\n");
|
"};\n");
|
||||||
|
|
||||||
ASSERT_EQUALS("[test.cpp:5]: (warning) Member variable not initialized in the constructor 'Fred::i'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:5]: (warning) Member variable 'Fred::i' is not initialised in the constructor.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void uninitVarStream()
|
void uninitVarStream()
|
||||||
|
@ -2402,7 +2402,7 @@ private:
|
||||||
" Foo(int _i) { }\n"
|
" Foo(int _i) { }\n"
|
||||||
"};\n");
|
"};\n");
|
||||||
|
|
||||||
ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable not initialized in the constructor 'Foo::foo'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable 'Foo::foo' is not initialised in the constructor.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2453,7 +2453,7 @@ private:
|
||||||
" Fred() { }\n"
|
" Fred() { }\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"#endfile\n");
|
"#endfile\n");
|
||||||
ASSERT_EQUALS("[fred.h:6]: (warning) Member variable not initialized in the constructor 'Fred::i'\n", errout.str());
|
ASSERT_EQUALS("[fred.h:6]: (warning) Member variable 'Fred::i' is not initialised in the constructor.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void uninitVarHeader3()
|
void uninitVarHeader3()
|
||||||
|
@ -2467,7 +2467,7 @@ private:
|
||||||
" Fred() { }\n"
|
" Fred() { }\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"#endfile\n");
|
"#endfile\n");
|
||||||
ASSERT_EQUALS("[fred.h:6]: (warning) Member variable not initialized in the constructor 'Fred::i'\n", errout.str());
|
ASSERT_EQUALS("[fred.h:6]: (warning) Member variable 'Fred::i' is not initialised in the constructor.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Borland C++: No FP for published pointers - they are automatically initialized
|
// Borland C++: No FP for published pointers - they are automatically initialized
|
||||||
|
@ -2588,8 +2588,8 @@ private:
|
||||||
"A::B::B()\n"
|
"A::B::B()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("[test.cpp:18]: (warning) Member variable not initialized in the constructor 'B::j'\n"
|
ASSERT_EQUALS("[test.cpp:18]: (warning) Member variable 'B::j' is not initialised in the constructor.\n"
|
||||||
"[test.cpp:22]: (warning) Member variable not initialized in the constructor 'B::i'\n", errout.str());
|
"[test.cpp:22]: (warning) Member variable 'B::i' is not initialised in the constructor.\n", errout.str());
|
||||||
|
|
||||||
// Ticket #1700
|
// Ticket #1700
|
||||||
checkUninitVar("namespace n1\n"
|
checkUninitVar("namespace n1\n"
|
||||||
|
@ -2631,7 +2631,7 @@ private:
|
||||||
" Foo() { }\n"
|
" Foo() { }\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("[test.cpp:11]: (warning) Member variable not initialized in the constructor 'Foo::i'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:11]: (warning) Member variable 'Foo::i' is not initialised in the constructor.\n", errout.str());
|
||||||
|
|
||||||
checkUninitVar("namespace n1\n"
|
checkUninitVar("namespace n1\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
|
|
@ -138,7 +138,7 @@ private:
|
||||||
" Fred() { }\n"
|
" Fred() { }\n"
|
||||||
" int i;\n"
|
" int i;\n"
|
||||||
"};\n");
|
"};\n");
|
||||||
ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable not initialized in the constructor 'Fred::i'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'Fred::i' is not initialised in the constructor.\n", errout.str());
|
||||||
|
|
||||||
check("struct Fred\n"
|
check("struct Fred\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
@ -159,7 +159,7 @@ private:
|
||||||
" Fred() { }\n"
|
" Fred() { }\n"
|
||||||
" int i;\n"
|
" int i;\n"
|
||||||
"};\n");
|
"};\n");
|
||||||
ASSERT_EQUALS("[test.cpp:3]: (warning) Member variable not initialized in the constructor 'Fred::i'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:3]: (warning) Member variable 'Fred::i' is not initialised in the constructor.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ private:
|
||||||
"};\n"
|
"};\n"
|
||||||
"Fred::Fred()\n"
|
"Fred::Fred()\n"
|
||||||
"{ }\n");
|
"{ }\n");
|
||||||
ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable not initialized in the constructor 'Fred::i'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable 'Fred::i' is not initialised in the constructor.\n", errout.str());
|
||||||
|
|
||||||
check("struct Fred\n"
|
check("struct Fred\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
@ -220,7 +220,7 @@ private:
|
||||||
"};\n"
|
"};\n"
|
||||||
"Fred::Fred()\n"
|
"Fred::Fred()\n"
|
||||||
"{ }\n");
|
"{ }\n");
|
||||||
ASSERT_EQUALS("[test.cpp:6]: (warning) Member variable not initialized in the constructor 'Fred::i'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:6]: (warning) Member variable 'Fred::i' is not initialised in the constructor.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ private:
|
||||||
"{\n"
|
"{\n"
|
||||||
" i = _i;\n"
|
" i = _i;\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("[test.cpp:8]: (warning) Member variable not initialized in the constructor 'Fred::i'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:8]: (warning) Member variable 'Fred::i' is not initialised in the constructor.\n", errout.str());
|
||||||
|
|
||||||
check("struct Fred\n"
|
check("struct Fred\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
@ -253,7 +253,7 @@ private:
|
||||||
"{\n"
|
"{\n"
|
||||||
" i = _i;\n"
|
" i = _i;\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable not initialized in the constructor 'Fred::i'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable 'Fred::i' is not initialised in the constructor.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -598,8 +598,8 @@ private:
|
||||||
" }\n"
|
" }\n"
|
||||||
"};\n");
|
"};\n");
|
||||||
|
|
||||||
ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable not initialized in the constructor 'Fred::a'\n"
|
ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable 'Fred::a' is not initialised in the constructor.\n"
|
||||||
"[test.cpp:16]: (warning) Member variable not initialized in the constructor 'Fred::b'\n", errout.str());
|
"[test.cpp:16]: (warning) Member variable 'Fred::b' is not initialised in the constructor.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void initvar_chained_assign()
|
void initvar_chained_assign()
|
||||||
|
@ -732,7 +732,7 @@ private:
|
||||||
"};\n"
|
"};\n"
|
||||||
"Fred::Fred()\n"
|
"Fred::Fred()\n"
|
||||||
"{ }");
|
"{ }");
|
||||||
ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable not initialized in the constructor 'Fred::s'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable 'Fred::s' is not initialised in the constructor.\n", errout.str());
|
||||||
|
|
||||||
check("struct Fred\n"
|
check("struct Fred\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
@ -759,7 +759,7 @@ private:
|
||||||
"};\n"
|
"};\n"
|
||||||
"Fred::Fred()\n"
|
"Fred::Fred()\n"
|
||||||
"{ }");
|
"{ }");
|
||||||
ASSERT_EQUALS("[test.cpp:6]: (warning) Member variable not initialized in the constructor 'Fred::s'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:6]: (warning) Member variable 'Fred::s' is not initialised in the constructor.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -799,7 +799,7 @@ private:
|
||||||
" Fred() { };\n"
|
" Fred() { };\n"
|
||||||
" Fred(const Fred &) { };\n"
|
" Fred(const Fred &) { };\n"
|
||||||
"};");
|
"};");
|
||||||
ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable not initialized in the constructor 'Fred::var'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable 'Fred::var' is not initialised in the constructor.\n", errout.str());
|
||||||
|
|
||||||
check("class Fred\n"
|
check("class Fred\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
@ -811,7 +811,7 @@ private:
|
||||||
"};\n"
|
"};\n"
|
||||||
"Fred::Fred() { };\n"
|
"Fred::Fred() { };\n"
|
||||||
"Fred::Fred(const Fred &) { };\n");
|
"Fred::Fred(const Fred &) { };\n");
|
||||||
ASSERT_EQUALS("[test.cpp:10]: (warning) Member variable not initialized in the constructor 'Fred::var'\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:10]: (warning) Member variable 'Fred::var' is not initialised in the constructor.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void initvar_nested_constructor() // ticket #1375
|
void initvar_nested_constructor() // ticket #1375
|
||||||
|
@ -839,11 +839,11 @@ private:
|
||||||
"A::B::B(int x){}\n"
|
"A::B::B(int x){}\n"
|
||||||
"A::B::C::C(int y){}\n"
|
"A::B::C::C(int y){}\n"
|
||||||
"A::B::C::D::D(int z){}\n");
|
"A::B::C::D::D(int z){}\n");
|
||||||
ASSERT_EQUALS("[test.cpp:20]: (warning) Member variable not initialized in the constructor 'A::a'\n"
|
ASSERT_EQUALS("[test.cpp:20]: (warning) Member variable 'A::a' is not initialised in the constructor.\n"
|
||||||
"[test.cpp:20]: (warning) Member variable not initialized in the constructor 'A::b'\n"
|
"[test.cpp:20]: (warning) Member variable 'A::b' is not initialised in the constructor.\n"
|
||||||
"[test.cpp:21]: (warning) Member variable not initialized in the constructor 'B::b'\n"
|
"[test.cpp:21]: (warning) Member variable 'B::b' is not initialised in the constructor.\n"
|
||||||
"[test.cpp:22]: (warning) Member variable not initialized in the constructor 'C::c'\n"
|
"[test.cpp:22]: (warning) Member variable 'C::c' is not initialised in the constructor.\n"
|
||||||
"[test.cpp:23]: (warning) Member variable not initialized in the constructor 'D::d'\n", errout.str());
|
"[test.cpp:23]: (warning) Member variable 'D::d' is not initialised in the constructor.\n", errout.str());
|
||||||
|
|
||||||
check("class A {\n"
|
check("class A {\n"
|
||||||
"public:\n"
|
"public:\n"
|
||||||
|
@ -868,11 +868,11 @@ private:
|
||||||
"A::B::B(int x){}\n"
|
"A::B::B(int x){}\n"
|
||||||
"A::B::C::C(int y){}\n"
|
"A::B::C::C(int y){}\n"
|
||||||
"A::B::C::D::D(const A::B::C::D & d){}\n");
|
"A::B::C::D::D(const A::B::C::D & d){}\n");
|
||||||
ASSERT_EQUALS("[test.cpp:20]: (warning) Member variable not initialized in the constructor 'A::a'\n"
|
ASSERT_EQUALS("[test.cpp:20]: (warning) Member variable 'A::a' is not initialised in the constructor.\n"
|
||||||
"[test.cpp:20]: (warning) Member variable not initialized in the constructor 'A::b'\n"
|
"[test.cpp:20]: (warning) Member variable 'A::b' is not initialised in the constructor.\n"
|
||||||
"[test.cpp:21]: (warning) Member variable not initialized in the constructor 'B::b'\n"
|
"[test.cpp:21]: (warning) Member variable 'B::b' is not initialised in the constructor.\n"
|
||||||
"[test.cpp:22]: (warning) Member variable not initialized in the constructor 'C::c'\n"
|
"[test.cpp:22]: (warning) Member variable 'C::c' is not initialised in the constructor.\n"
|
||||||
"[test.cpp:23]: (warning) Member variable not initialized in the constructor 'D::d'\n", errout.str());
|
"[test.cpp:23]: (warning) Member variable 'D::d' is not initialised in the constructor.\n", errout.str());
|
||||||
|
|
||||||
check("class A {\n"
|
check("class A {\n"
|
||||||
"public:\n"
|
"public:\n"
|
||||||
|
@ -898,11 +898,11 @@ private:
|
||||||
"A::B::B(int x){}\n"
|
"A::B::B(int x){}\n"
|
||||||
"A::B::C::C(int y){}\n"
|
"A::B::C::C(int y){}\n"
|
||||||
"A::B::C::D::D(const A::B::C::D::E & e){}\n");
|
"A::B::C::D::D(const A::B::C::D::E & e){}\n");
|
||||||
ASSERT_EQUALS("[test.cpp:21]: (warning) Member variable not initialized in the constructor 'A::a'\n"
|
ASSERT_EQUALS("[test.cpp:21]: (warning) Member variable 'A::a' is not initialised in the constructor.\n"
|
||||||
"[test.cpp:21]: (warning) Member variable not initialized in the constructor 'A::b'\n"
|
"[test.cpp:21]: (warning) Member variable 'A::b' is not initialised in the constructor.\n"
|
||||||
"[test.cpp:22]: (warning) Member variable not initialized in the constructor 'B::b'\n"
|
"[test.cpp:22]: (warning) Member variable 'B::b' is not initialised in the constructor.\n"
|
||||||
"[test.cpp:23]: (warning) Member variable not initialized in the constructor 'C::c'\n"
|
"[test.cpp:23]: (warning) Member variable 'C::c' is not initialised in the constructor.\n"
|
||||||
"[test.cpp:24]: (warning) Member variable not initialized in the constructor 'D::d'\n", errout.str());
|
"[test.cpp:24]: (warning) Member variable 'D::d' is not initialised in the constructor.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void initvar_destructor()
|
void initvar_destructor()
|
||||||
|
|
Loading…
Reference in New Issue