fix spelling of initialized in checkclass messages

This commit is contained in:
Robert Reif 2011-04-26 20:37:16 -04:00
parent 29c73e0571
commit 6abf29bd22
3 changed files with 69 additions and 69 deletions

View File

@ -551,7 +551,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 '" + classname + "::" + varname + "' is not initialised in the constructor."); reportError(tok, Severity::warning, "uninitVar", "Member variable '" + classname + "::" + varname + "' is not initialized 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)

View File

@ -1683,7 +1683,7 @@ private:
" ECODES _code;\n" " ECODES _code;\n"
"};\n"); "};\n");
ASSERT_EQUALS("[test.cpp:10]: (warning) Member variable 'Fred::_code' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:10]: (warning) Member variable 'Fred::_code' is not initialized in the constructor.\n", errout.str());
checkUninitVar("class A{};\n" checkUninitVar("class A{};\n"
@ -1695,7 +1695,7 @@ private:
"private:\n" "private:\n"
" float f;\n" " float f;\n"
"};\n"); "};\n");
ASSERT_EQUALS("[test.cpp:6]: (warning) Member variable 'B::f' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:6]: (warning) Member variable 'B::f' is not initialized in the constructor.\n", errout.str());
checkUninitVar("class C\n" checkUninitVar("class C\n"
"{\n" "{\n"
@ -1749,7 +1749,7 @@ private:
" };\n" " };\n"
" Bar bars[2];\n" " Bar bars[2];\n"
"};\n"); "};\n");
ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'Foo::bars' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'Foo::bars' is not initialized in the constructor.\n", errout.str());
} }
void uninitVar4() void uninitVar4()
@ -1844,7 +1844,7 @@ private:
"{\n" "{\n"
" SetMinSize( wxSize( 48,48 ) );\n" " SetMinSize( wxSize( 48,48 ) );\n"
"}\n"); "}\n");
ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable 'Prefs::xasd' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable 'Prefs::xasd' is not initialized in the constructor.\n", errout.str());
} }
void uninitVar10() // ticket #1993 void uninitVar10() // ticket #1993
@ -1857,7 +1857,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 'A::var2' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:8]: (warning) Member variable 'A::var2' is not initialized in the constructor.\n", errout.str());
} }
void uninitVar11() void uninitVar11()
@ -1869,7 +1869,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 'A::var' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable 'A::var' is not initialized in the constructor.\n", errout.str());
} }
void uninitVar12() // ticket #2078 void uninitVar12() // ticket #2078
@ -1886,8 +1886,8 @@ private:
" {}\n" " {}\n"
" int x, y;\n" " int x, y;\n"
"};\n"); "};\n");
ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'Point::x' is not initialised in the constructor.\n" ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'Point::x' is not initialized in the constructor.\n"
"[test.cpp:4]: (warning) Member variable 'Point::y' is not initialised in the constructor.\n", errout.str()); "[test.cpp:4]: (warning) Member variable 'Point::y' is not initialized in the constructor.\n", errout.str());
} }
void uninitVar13() // ticket #1195 void uninitVar13() // ticket #1195
@ -1899,7 +1899,7 @@ private:
" A()\n" " A()\n"
" {}\n" " {}\n"
"};\n"); "};\n");
ASSERT_EQUALS("[test.cpp:5]: (warning) Member variable 'A::ints' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:5]: (warning) Member variable 'A::ints' is not initialized in the constructor.\n", errout.str());
} }
void uninitVar14() // ticket #2149 void uninitVar14() // ticket #2149
@ -1915,7 +1915,7 @@ private:
"Foo::Foo()\n" "Foo::Foo()\n"
"{\n" "{\n"
"}\n"); "}\n");
ASSERT_EQUALS("[test.cpp:8]: (warning) Member variable 'Foo::mMember' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:8]: (warning) Member variable 'Foo::mMember' is not initialized in the constructor.\n", errout.str());
// single namespace // single namespace
checkUninitVar("namespace Output\n" checkUninitVar("namespace Output\n"
@ -1931,7 +1931,7 @@ private:
" {\n" " {\n"
" }\n" " }\n"
"}\n"); "}\n");
ASSERT_EQUALS("[test.cpp:10]: (warning) Member variable 'Foo::mMember' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:10]: (warning) Member variable 'Foo::mMember' is not initialized in the constructor.\n", errout.str());
// constructor outside namespace // constructor outside namespace
checkUninitVar("namespace Output\n" checkUninitVar("namespace Output\n"
@ -1963,7 +1963,7 @@ private:
"Output::Foo::Foo()\n" "Output::Foo::Foo()\n"
"{\n" "{\n"
"}\n"); "}\n");
ASSERT_EQUALS("[test.cpp:11]: (warning) Member variable 'Foo::mMember' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:11]: (warning) Member variable 'Foo::mMember' is not initialized in the constructor.\n", errout.str());
// constructor in separate namespace // constructor in separate namespace
checkUninitVar("namespace Output\n" checkUninitVar("namespace Output\n"
@ -1982,7 +1982,7 @@ private:
" {\n" " {\n"
" }\n" " }\n"
"}\n"); "}\n");
ASSERT_EQUALS("[test.cpp:13]: (warning) Member variable 'Foo::mMember' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:13]: (warning) Member variable 'Foo::mMember' is not initialized in the constructor.\n", errout.str());
// constructor in different separate namespace // constructor in different separate namespace
checkUninitVar("namespace Output\n" checkUninitVar("namespace Output\n"
@ -2042,7 +2042,7 @@ private:
" }\n" " }\n"
" }\n" " }\n"
"}\n"); "}\n");
ASSERT_EQUALS("[test.cpp:15]: (warning) Member variable 'Foo::mMember' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:15]: (warning) Member variable 'Foo::mMember' is not initialized 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"
@ -2135,7 +2135,7 @@ private:
" {\n" " {\n"
" }\n" " }\n"
"};\n"); "};\n");
ASSERT_EQUALS("[test.cpp:10]: (warning) Member variable 'Bar::foo' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:10]: (warning) Member variable 'Bar::foo' is not initialized in the constructor.\n", errout.str());
} }
void uninitVar17() void uninitVar17()
@ -2167,7 +2167,7 @@ private:
" {\n" " {\n"
" }\n" " }\n"
"};\n"); "};\n");
ASSERT_EQUALS("[test.cpp:9]: (warning) Member variable 'Bar::foo' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:9]: (warning) Member variable 'Bar::foo' is not initialized in the constructor.\n", errout.str());
} }
void uninitVar18() // ticket #2465 void uninitVar18() // ticket #2465
@ -2198,7 +2198,7 @@ private:
"private:\n" "private:\n"
" Altren value;\n" " Altren value;\n"
"};\n"); "};\n");
ASSERT_EQUALS("[test.cpp:9]: (warning) Member variable 'A::value' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:9]: (warning) Member variable 'A::value' is not initialized in the constructor.\n", errout.str());
} }
void uninitVarArray1() void uninitVarArray1()
@ -2211,7 +2211,7 @@ private:
"private:\n" "private:\n"
" char name[255];\n" " char name[255];\n"
"};\n"); "};\n");
ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'John::name' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'John::name' is not initialized in the constructor.\n", errout.str());
checkUninitVar("class John\n" checkUninitVar("class John\n"
"{\n" "{\n"
@ -2258,7 +2258,7 @@ private:
" John() { }\n" " John() { }\n"
" A *a[5];\n" " A *a[5];\n"
"};\n"); "};\n");
ASSERT_EQUALS("[test.cpp:5]: (warning) Member variable 'John::a' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:5]: (warning) Member variable 'John::a' is not initialized in the constructor.\n", errout.str());
} }
void uninitVarArray2() void uninitVarArray2()
@ -2377,7 +2377,7 @@ private:
" A() {\n" " A() {\n"
" }\n" " }\n"
"};\n"); "};\n");
ASSERT_EQUALS("[test.cpp:10]: (warning) Member variable 'A::b' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:10]: (warning) Member variable 'A::b' is not initialized in the constructor.\n", errout.str());
checkUninitVar("class A\n" checkUninitVar("class A\n"
"{\n" "{\n"
@ -2410,7 +2410,7 @@ private:
" Fred()\n" " Fred()\n"
" { }\n" " { }\n"
"};\n"); "};\n");
ASSERT_EQUALS("[test.cpp:11]: (warning) Member variable 'Fred::p' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:11]: (warning) Member variable 'Fred::p' is not initialized in the constructor.\n", errout.str());
checkUninitVar("struct POINT\n" checkUninitVar("struct POINT\n"
"{\n" "{\n"
@ -2477,7 +2477,7 @@ private:
"private:\n" "private:\n"
" int i;\n" " int i;\n"
"};\n"); "};\n");
ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'Fred::i' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'Fred::i' is not initialized in the constructor.\n", errout.str());
// Unknown non-member function // Unknown non-member function
checkUninitVar("class Fred\n" checkUninitVar("class Fred\n"
@ -2487,7 +2487,7 @@ private:
"private:\n" "private:\n"
" int i;\n" " int i;\n"
"};\n"); "};\n");
ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'Fred::i' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'Fred::i' is not initialized in the constructor.\n", errout.str());
// Unknown non-member function // Unknown non-member function
checkUninitVar("class ABC { };\n" checkUninitVar("class ABC { };\n"
@ -2498,7 +2498,7 @@ private:
"private:\n" "private:\n"
" int i;\n" " int i;\n"
"};\n"); "};\n");
ASSERT_EQUALS("[test.cpp:5]: (warning) Member variable 'Fred::i' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:5]: (warning) Member variable 'Fred::i' is not initialized in the constructor.\n", errout.str());
} }
@ -2513,7 +2513,7 @@ private:
" unsigned int i;\n" " unsigned int i;\n"
"};\n"); "};\n");
ASSERT_EQUALS("[test.cpp:5]: (warning) Member variable 'Fred::i' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:5]: (warning) Member variable 'Fred::i' is not initialized in the constructor.\n", errout.str());
} }
void uninitVarStream() void uninitVarStream()
@ -2579,7 +2579,7 @@ private:
" Foo(int _i) { }\n" " Foo(int _i) { }\n"
"};\n"); "};\n");
ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable 'Foo::foo' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable 'Foo::foo' is not initialized in the constructor.\n", errout.str());
} }
@ -2630,7 +2630,7 @@ private:
" Fred() { }\n" " Fred() { }\n"
"};\n" "};\n"
"#endfile\n"); "#endfile\n");
ASSERT_EQUALS("[fred.h:6]: (warning) Member variable 'Fred::i' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[fred.h:6]: (warning) Member variable 'Fred::i' is not initialized in the constructor.\n", errout.str());
} }
void uninitVarHeader3() void uninitVarHeader3()
@ -2644,7 +2644,7 @@ private:
" Fred() { }\n" " Fred() { }\n"
"};\n" "};\n"
"#endfile\n"); "#endfile\n");
ASSERT_EQUALS("[fred.h:6]: (warning) Member variable 'Fred::i' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[fred.h:6]: (warning) Member variable 'Fred::i' is not initialized 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
@ -2695,7 +2695,7 @@ private:
"\n" "\n"
" double d;\n" " double d;\n"
"};\n"); "};\n");
TODO_ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'Fred::d' is not initialised in the constructor.\n", "", errout.str()); TODO_ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'Fred::d' is not initialized in the constructor.\n", "", errout.str());
} }
void uninitFunction2() void uninitFunction2()
@ -2722,7 +2722,7 @@ private:
"\n" "\n"
" double d;\n" " double d;\n"
"};\n"); "};\n");
TODO_ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'Fred::d' is not initialised in the constructor.\n", "", errout.str()); TODO_ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'Fred::d' is not initialized in the constructor.\n", "", errout.str());
} }
void uninitFunction3() void uninitFunction3()
@ -2749,7 +2749,7 @@ private:
"\n" "\n"
" double d;\n" " double d;\n"
"};\n"); "};\n");
ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'Fred::d' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'Fred::d' is not initialized in the constructor.\n", errout.str());
} }
void uninitFunction4() void uninitFunction4()
@ -2776,7 +2776,7 @@ private:
"\n" "\n"
" double d;\n" " double d;\n"
"};\n"); "};\n");
TODO_ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'Fred::d' is not initialised in the constructor.\n", "", errout.str()); TODO_ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'Fred::d' is not initialized in the constructor.\n", "", errout.str());
} }
void uninitSameClassName() void uninitSameClassName()
@ -2828,8 +2828,8 @@ private:
"A::B::B()\n" "A::B::B()\n"
"{\n" "{\n"
"}\n"); "}\n");
ASSERT_EQUALS("[test.cpp:18]: (warning) Member variable 'B::j' is not initialised in the constructor.\n" ASSERT_EQUALS("[test.cpp:18]: (warning) Member variable 'B::j' is not initialized in the constructor.\n"
"[test.cpp:22]: (warning) Member variable 'B::i' is not initialised in the constructor.\n", errout.str()); "[test.cpp:22]: (warning) Member variable 'B::i' is not initialized in the constructor.\n", errout.str());
// Ticket #1700 // Ticket #1700
checkUninitVar("namespace n1\n" checkUninitVar("namespace n1\n"
@ -2871,7 +2871,7 @@ private:
" Foo() { }\n" " Foo() { }\n"
"};\n" "};\n"
"}\n"); "}\n");
ASSERT_EQUALS("[test.cpp:11]: (warning) Member variable 'Foo::i' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:11]: (warning) Member variable 'Foo::i' is not initialized in the constructor.\n", errout.str());
checkUninitVar("namespace n1\n" checkUninitVar("namespace n1\n"
"{\n" "{\n"
@ -2933,7 +2933,7 @@ private:
" void init(int value)\n" " void init(int value)\n"
" { }\n" " { }\n"
"};"); "};");
TODO_ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable 'A::i' is not initialised in the constructor.\n", "", errout.str()); TODO_ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable 'A::i' is not initialized in the constructor.\n", "", errout.str());
} }
void checkUninitVarJava(const char code[]) void checkUninitVarJava(const char code[])
@ -2992,7 +2992,7 @@ private:
" return *this;\n" " return *this;\n"
" }\n" " }\n"
"};"); "};");
ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'A::a' is not initialised in the constructor.\n" ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'A::a' is not initialized in the constructor.\n"
"[test.cpp:5]: (warning) Member variable 'A::a' is not assigned a value in 'A::operator='\n", errout.str()); "[test.cpp:5]: (warning) Member variable 'A::a' is not assigned a value in 'A::operator='\n", errout.str());
} }

View File

@ -142,7 +142,7 @@ private:
" Fred() { }\n" " Fred() { }\n"
" int i;\n" " int i;\n"
"};\n"); "};\n");
ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'Fred::i' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'Fred::i' is not initialized in the constructor.\n", errout.str());
check("struct Fred\n" check("struct Fred\n"
"{\n" "{\n"
@ -163,7 +163,7 @@ private:
" Fred() { }\n" " Fred() { }\n"
" int i;\n" " int i;\n"
"};\n"); "};\n");
ASSERT_EQUALS("[test.cpp:3]: (warning) Member variable 'Fred::i' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:3]: (warning) Member variable 'Fred::i' is not initialized in the constructor.\n", errout.str());
} }
@ -197,7 +197,7 @@ private:
"};\n" "};\n"
"Fred::Fred()\n" "Fred::Fred()\n"
"{ }\n"); "{ }\n");
ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable 'Fred::i' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable 'Fred::i' is not initialized in the constructor.\n", errout.str());
check("struct Fred\n" check("struct Fred\n"
"{\n" "{\n"
@ -224,7 +224,7 @@ private:
"};\n" "};\n"
"Fred::Fred()\n" "Fred::Fred()\n"
"{ }\n"); "{ }\n");
ASSERT_EQUALS("[test.cpp:6]: (warning) Member variable 'Fred::i' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:6]: (warning) Member variable 'Fred::i' is not initialized in the constructor.\n", errout.str());
} }
@ -243,7 +243,7 @@ private:
"{\n" "{\n"
" i = _i;\n" " i = _i;\n"
"}\n"); "}\n");
ASSERT_EQUALS("[test.cpp:8]: (warning) Member variable 'Fred::i' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:8]: (warning) Member variable 'Fred::i' is not initialized in the constructor.\n", errout.str());
check("struct Fred\n" check("struct Fred\n"
"{\n" "{\n"
@ -257,7 +257,7 @@ private:
"{\n" "{\n"
" i = _i;\n" " i = _i;\n"
"}\n"); "}\n");
ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable 'Fred::i' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable 'Fred::i' is not initialized in the constructor.\n", errout.str());
} }
void simple5() // ticket #2560 void simple5() // ticket #2560
@ -619,8 +619,8 @@ private:
" }\n" " }\n"
"};\n"); "};\n");
ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable 'Fred::a' is not initialised in the constructor.\n" ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable 'Fred::a' is not initialized in the constructor.\n"
"[test.cpp:16]: (warning) Member variable 'Fred::b' is not initialised in the constructor.\n", errout.str()); "[test.cpp:16]: (warning) Member variable 'Fred::b' is not initialized in the constructor.\n", errout.str());
} }
void initvar_chained_assign() void initvar_chained_assign()
@ -753,7 +753,7 @@ private:
"};\n" "};\n"
"Fred::Fred()\n" "Fred::Fred()\n"
"{ }"); "{ }");
ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable 'Fred::s' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable 'Fred::s' is not initialized in the constructor.\n", errout.str());
check("struct Fred\n" check("struct Fred\n"
"{\n" "{\n"
@ -780,7 +780,7 @@ private:
"};\n" "};\n"
"Fred::Fred()\n" "Fred::Fred()\n"
"{ }"); "{ }");
ASSERT_EQUALS("[test.cpp:6]: (warning) Member variable 'Fred::s' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:6]: (warning) Member variable 'Fred::s' is not initialized in the constructor.\n", errout.str());
} }
@ -825,7 +825,7 @@ private:
" {\n" " {\n"
" }\n" " }\n"
"};\n"); "};\n");
ASSERT_EQUALS("[test.cpp:9]: (warning) Member variable 'Fred::U' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:9]: (warning) Member variable 'Fred::U' is not initialized in the constructor.\n", errout.str());
} }
@ -852,7 +852,7 @@ private:
" Fred() { };\n" " Fred() { };\n"
" Fred(const Fred &) { };\n" " Fred(const Fred &) { };\n"
"};"); "};");
ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable 'Fred::var' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable 'Fred::var' is not initialized in the constructor.\n", errout.str());
check("class Fred\n" check("class Fred\n"
"{\n" "{\n"
@ -864,7 +864,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 'Fred::var' is not initialised in the constructor.\n", errout.str()); ASSERT_EQUALS("[test.cpp:10]: (warning) Member variable 'Fred::var' is not initialized in the constructor.\n", errout.str());
} }
void initvar_nested_constructor() // ticket #1375 void initvar_nested_constructor() // ticket #1375
@ -892,11 +892,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 'A::a' is not initialised in the constructor.\n" ASSERT_EQUALS("[test.cpp:20]: (warning) Member variable 'A::a' is not initialized in the constructor.\n"
"[test.cpp:20]: (warning) Member variable 'A::b' is not initialised in the constructor.\n" "[test.cpp:20]: (warning) Member variable 'A::b' is not initialized in the constructor.\n"
"[test.cpp:21]: (warning) Member variable 'B::b' is not initialised in the constructor.\n" "[test.cpp:21]: (warning) Member variable 'B::b' is not initialized in the constructor.\n"
"[test.cpp:22]: (warning) Member variable 'C::c' is not initialised in the constructor.\n" "[test.cpp:22]: (warning) Member variable 'C::c' is not initialized in the constructor.\n"
"[test.cpp:23]: (warning) Member variable 'D::d' is not initialised in the constructor.\n", errout.str()); "[test.cpp:23]: (warning) Member variable 'D::d' is not initialized in the constructor.\n", errout.str());
check("class A {\n" check("class A {\n"
"public:\n" "public:\n"
@ -921,11 +921,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 'A::a' is not initialised in the constructor.\n" ASSERT_EQUALS("[test.cpp:20]: (warning) Member variable 'A::a' is not initialized in the constructor.\n"
"[test.cpp:20]: (warning) Member variable 'A::b' is not initialised in the constructor.\n" "[test.cpp:20]: (warning) Member variable 'A::b' is not initialized in the constructor.\n"
"[test.cpp:21]: (warning) Member variable 'B::b' is not initialised in the constructor.\n" "[test.cpp:21]: (warning) Member variable 'B::b' is not initialized in the constructor.\n"
"[test.cpp:22]: (warning) Member variable 'C::c' is not initialised in the constructor.\n" "[test.cpp:22]: (warning) Member variable 'C::c' is not initialized in the constructor.\n"
"[test.cpp:23]: (warning) Member variable 'D::d' is not initialised in the constructor.\n", errout.str()); "[test.cpp:23]: (warning) Member variable 'D::d' is not initialized in the constructor.\n", errout.str());
check("class A {\n" check("class A {\n"
"public:\n" "public:\n"
@ -951,11 +951,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 'A::a' is not initialised in the constructor.\n" ASSERT_EQUALS("[test.cpp:21]: (warning) Member variable 'A::a' is not initialized in the constructor.\n"
"[test.cpp:21]: (warning) Member variable 'A::b' is not initialised in the constructor.\n" "[test.cpp:21]: (warning) Member variable 'A::b' is not initialized in the constructor.\n"
"[test.cpp:22]: (warning) Member variable 'B::b' is not initialised in the constructor.\n" "[test.cpp:22]: (warning) Member variable 'B::b' is not initialized in the constructor.\n"
"[test.cpp:23]: (warning) Member variable 'C::c' is not initialised in the constructor.\n" "[test.cpp:23]: (warning) Member variable 'C::c' is not initialized in the constructor.\n"
"[test.cpp:24]: (warning) Member variable 'D::d' is not initialised in the constructor.\n", errout.str()); "[test.cpp:24]: (warning) Member variable 'D::d' is not initialized in the constructor.\n", errout.str());
} }
void initvar_nocopy1() // ticket #2474 void initvar_nocopy1() // ticket #2474
@ -989,7 +989,7 @@ private:
" A(const A&){}\n" " A(const A&){}\n"
" const A& operator=(const A&){return *this;}\n" " const A& operator=(const A&){return *this;}\n"
"};\n"); "};\n");
ASSERT_EQUALS("[test.cpp:12]: (warning) Member variable 'A::m_SemVar' is not initialised in the constructor.\n" ASSERT_EQUALS("[test.cpp:12]: (warning) Member variable 'A::m_SemVar' is not initialized in the constructor.\n"
"[test.cpp:13]: (warning) Member variable 'A::m_SemVar' is not assigned a value in 'A::operator='\n", errout.str()); "[test.cpp:13]: (warning) Member variable 'A::m_SemVar' is not assigned a value in 'A::operator='\n", errout.str());
check("class A\n" check("class A\n"
@ -1000,7 +1000,7 @@ private:
" A(const A&){}\n" " A(const A&){}\n"
" const A& operator=(const A&){return *this;}\n" " const A& operator=(const A&){return *this;}\n"
"};\n"); "};\n");
ASSERT_EQUALS("[test.cpp:6]: (warning) Member variable 'A::m_SemVar' is not initialised in the constructor.\n" ASSERT_EQUALS("[test.cpp:6]: (warning) Member variable 'A::m_SemVar' is not initialized in the constructor.\n"
"[test.cpp:7]: (warning) Member variable 'A::m_SemVar' is not assigned a value in 'A::operator='\n", errout.str()); "[test.cpp:7]: (warning) Member variable 'A::m_SemVar' is not assigned a value in 'A::operator='\n", errout.str());
} }
@ -1035,7 +1035,7 @@ private:
" A(const A&){}\n" " A(const A&){}\n"
" const A& operator=(const A&){return *this;}\n" " const A& operator=(const A&){return *this;}\n"
"};\n"); "};\n");
ASSERT_EQUALS("[test.cpp:12]: (warning) Member variable 'A::m_SemVar' is not initialised in the constructor.\n" ASSERT_EQUALS("[test.cpp:12]: (warning) Member variable 'A::m_SemVar' is not initialized in the constructor.\n"
"[test.cpp:13]: (warning) Member variable 'A::m_SemVar' is not assigned a value in 'A::operator='\n", errout.str()); "[test.cpp:13]: (warning) Member variable 'A::m_SemVar' is not assigned a value in 'A::operator='\n", errout.str());
} }