Fix testrunner
This commit is contained in:
parent
49413b7d4c
commit
7c47283e6d
|
@ -3330,13 +3330,13 @@ private:
|
|||
checkConst("class Fred {\n"
|
||||
" const std::string foo() { return \"\"; }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (performance, inconclusive) Technically the member function 'Fred::foo' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:2]: (performance, inconclusive) Technically the member function 'Fred::foo' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("class Fred {\n"
|
||||
" std::string s;\n"
|
||||
" const std::string & foo() { return \"\"; }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::foo' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::foo' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
// constructors can't be const..
|
||||
checkConst("class Fred {\n"
|
||||
|
@ -3375,7 +3375,7 @@ private:
|
|||
" int x;\n"
|
||||
" void b() { a(); }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:4]: (performance, inconclusive) Technically the member function 'Fred::b' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:4]: (performance, inconclusive) Technically the member function 'Fred::b' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
// static functions can't be const..
|
||||
checkConst("class foo\n"
|
||||
|
@ -3389,7 +3389,7 @@ private:
|
|||
checkConst("class Fred {\n"
|
||||
" const std::string foo() const throw() { return \"\"; }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (performance, inconclusive) Technically the member function 'Fred::foo' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:2]: (performance, inconclusive) Technically the member function 'Fred::foo' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
}
|
||||
|
||||
void const2() {
|
||||
|
@ -3501,7 +3501,7 @@ private:
|
|||
" const std::string & foo();\n"
|
||||
"};\n"
|
||||
"const std::string & Fred::foo() { return \"\"; }");
|
||||
ASSERT_EQUALS("[test.cpp:5] -> [test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::foo' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:5] -> [test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::foo' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
// functions with a function call to a non-const member can't be const.. (#1305)
|
||||
checkConst("class Fred\n"
|
||||
|
@ -3637,7 +3637,7 @@ private:
|
|||
"void Fred::foo() { }"
|
||||
"void Fred::foo(std::string & a) { a = s; }"
|
||||
"void Fred::foo(const std::string & a) { s = a; }");
|
||||
ASSERT_EQUALS("[test.cpp:7] -> [test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::foo' can be static.\n"
|
||||
ASSERT_EQUALS("[test.cpp:7] -> [test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::foo' can be static (but you may consider moving to unnamed namespace).\n"
|
||||
"[test.cpp:7] -> [test.cpp:4]: (style, inconclusive) Technically the member function 'Fred::foo' can be const.\n", errout.str());
|
||||
|
||||
// check functions with different or missing parameter names
|
||||
|
@ -3654,11 +3654,11 @@ private:
|
|||
"void Fred::foo3(int a, int b) { }\n"
|
||||
"void Fred::foo4(int a, int b) { }\n"
|
||||
"void Fred::foo5(int, int) { }");
|
||||
ASSERT_EQUALS("[test.cpp:9] -> [test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::foo1' can be static.\n"
|
||||
"[test.cpp:10] -> [test.cpp:4]: (performance, inconclusive) Technically the member function 'Fred::foo2' can be static.\n"
|
||||
"[test.cpp:11] -> [test.cpp:5]: (performance, inconclusive) Technically the member function 'Fred::foo3' can be static.\n"
|
||||
"[test.cpp:12] -> [test.cpp:6]: (performance, inconclusive) Technically the member function 'Fred::foo4' can be static.\n"
|
||||
"[test.cpp:13] -> [test.cpp:7]: (performance, inconclusive) Technically the member function 'Fred::foo5' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:9] -> [test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::foo1' can be static (but you may consider moving to unnamed namespace).\n"
|
||||
"[test.cpp:10] -> [test.cpp:4]: (performance, inconclusive) Technically the member function 'Fred::foo2' can be static (but you may consider moving to unnamed namespace).\n"
|
||||
"[test.cpp:11] -> [test.cpp:5]: (performance, inconclusive) Technically the member function 'Fred::foo3' can be static (but you may consider moving to unnamed namespace).\n"
|
||||
"[test.cpp:12] -> [test.cpp:6]: (performance, inconclusive) Technically the member function 'Fred::foo4' can be static (but you may consider moving to unnamed namespace).\n"
|
||||
"[test.cpp:13] -> [test.cpp:7]: (performance, inconclusive) Technically the member function 'Fred::foo5' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
// check nested classes
|
||||
checkConst("class Fred {\n"
|
||||
|
@ -3889,7 +3889,7 @@ private:
|
|||
"public:\n"
|
||||
" void foo() { }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:4]: (performance, inconclusive) Technically the member function 'Fred::foo' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:4]: (performance, inconclusive) Technically the member function 'Fred::foo' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("struct fast_string\n"
|
||||
"{\n"
|
||||
|
@ -4326,7 +4326,7 @@ private:
|
|||
"public:\n"
|
||||
" void set(int i) { x = i; }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:4]: (performance, inconclusive) Technically the member function 'Fred::set' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:4]: (performance, inconclusive) Technically the member function 'Fred::set' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
}
|
||||
|
||||
void const19() {
|
||||
|
@ -4573,7 +4573,7 @@ private:
|
|||
" UnknownScope::x = x_;\n"
|
||||
" }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:4]: (performance, inconclusive) Technically the member function 'AA::vSetXPos' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:4]: (performance, inconclusive) Technically the member function 'AA::vSetXPos' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
}
|
||||
|
||||
|
@ -5001,7 +5001,7 @@ private:
|
|||
"{\n"
|
||||
"}");
|
||||
|
||||
ASSERT_EQUALS("[test.cpp:7] -> [test.cpp:5]: (performance, inconclusive) Technically the member function 'Fred::f' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:7] -> [test.cpp:5]: (performance, inconclusive) Technically the member function 'Fred::f' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("class Fred\n"
|
||||
"{\n"
|
||||
|
@ -5015,7 +5015,7 @@ private:
|
|||
"{\n"
|
||||
"}");
|
||||
|
||||
ASSERT_EQUALS("[test.cpp:9] -> [test.cpp:7]: (performance, inconclusive) Technically the member function 'Fred::f' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:9] -> [test.cpp:7]: (performance, inconclusive) Technically the member function 'Fred::f' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("namespace NS {\n"
|
||||
" class Fred\n"
|
||||
|
@ -5031,7 +5031,7 @@ private:
|
|||
" }\n"
|
||||
"}");
|
||||
|
||||
ASSERT_EQUALS("[test.cpp:10] -> [test.cpp:8]: (performance, inconclusive) Technically the member function 'NS::Fred::f' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:10] -> [test.cpp:8]: (performance, inconclusive) Technically the member function 'NS::Fred::f' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("namespace NS {\n"
|
||||
" class Fred\n"
|
||||
|
@ -5047,7 +5047,7 @@ private:
|
|||
"{\n"
|
||||
"}");
|
||||
|
||||
ASSERT_EQUALS("[test.cpp:11] -> [test.cpp:8]: (performance, inconclusive) Technically the member function 'NS::Fred::f' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:11] -> [test.cpp:8]: (performance, inconclusive) Technically the member function 'NS::Fred::f' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("class Foo {\n"
|
||||
" class Fred\n"
|
||||
|
@ -5063,7 +5063,7 @@ private:
|
|||
"{\n"
|
||||
"}");
|
||||
|
||||
ASSERT_EQUALS("[test.cpp:11] -> [test.cpp:8]: (performance, inconclusive) Technically the member function 'Foo::Fred::f' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:11] -> [test.cpp:8]: (performance, inconclusive) Technically the member function 'Foo::Fred::f' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
}
|
||||
|
||||
void const43() { // ticket 2377
|
||||
|
@ -5152,7 +5152,7 @@ private:
|
|||
" };\n"
|
||||
"}");
|
||||
|
||||
ASSERT_EQUALS("[test.cpp:8]: (performance, inconclusive) Technically the member function 'tools::WorkspaceControl::toGrid' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:8]: (performance, inconclusive) Technically the member function 'tools::WorkspaceControl::toGrid' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
}
|
||||
|
||||
void const46() { // ticket 2663
|
||||
|
@ -5167,8 +5167,8 @@ private:
|
|||
" }\n"
|
||||
"};");
|
||||
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Altren::fun1' can be static.\n"
|
||||
"[test.cpp:7]: (performance, inconclusive) Technically the member function 'Altren::fun2' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Altren::fun1' can be static (but you may consider moving to unnamed namespace).\n"
|
||||
"[test.cpp:7]: (performance, inconclusive) Technically the member function 'Altren::fun2' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
}
|
||||
|
||||
void const47() { // ticket 2670
|
||||
|
@ -5179,7 +5179,7 @@ private:
|
|||
" void bar() { foo(); }\n"
|
||||
"};");
|
||||
|
||||
ASSERT_EQUALS("[test.cpp:4]: (performance, inconclusive) Technically the member function 'Altren::foo' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:4]: (performance, inconclusive) Technically the member function 'Altren::foo' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("class Altren {\n"
|
||||
"public:\n"
|
||||
|
@ -5188,7 +5188,7 @@ private:
|
|||
" void bar() { foo(1); }\n"
|
||||
"};");
|
||||
|
||||
ASSERT_EQUALS("[test.cpp:4]: (performance, inconclusive) Technically the member function 'Altren::foo' can be static.\n"
|
||||
ASSERT_EQUALS("[test.cpp:4]: (performance, inconclusive) Technically the member function 'Altren::foo' can be static (but you may consider moving to unnamed namespace).\n"
|
||||
"[test.cpp:5]: (style, inconclusive) Technically the member function 'Altren::bar' can be const.\n", errout.str());
|
||||
}
|
||||
|
||||
|
@ -5279,7 +5279,7 @@ private:
|
|||
"private:\n"
|
||||
" int bar;\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (performance, inconclusive) Technically the member function 'foo::DoSomething' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:2]: (performance, inconclusive) Technically the member function 'foo::DoSomething' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
}
|
||||
|
||||
void const53() { // ticket 3049
|
||||
|
@ -5323,7 +5323,7 @@ private:
|
|||
" switch (x) { }\n"
|
||||
" }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'MyObject::foo' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'MyObject::foo' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("class A\n"
|
||||
"{\n"
|
||||
|
@ -5363,7 +5363,7 @@ private:
|
|||
"\n"
|
||||
" return RET_NOK;\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:9] -> [test.cpp:4]: (performance, inconclusive) Technically the member function 'A::f' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:9] -> [test.cpp:4]: (performance, inconclusive) Technically the member function 'A::f' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("class MyObject {\n"
|
||||
"public:\n"
|
||||
|
@ -5371,7 +5371,7 @@ private:
|
|||
" for (int i = 0; i < 5; i++) { }\n"
|
||||
" }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'MyObject::foo' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'MyObject::foo' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
}
|
||||
|
||||
void const57() { // tickets #2669 and #2477
|
||||
|
@ -5396,9 +5396,9 @@ private:
|
|||
"private:\n"
|
||||
" MyGUI::IntCoord mCoordValue;\n"
|
||||
"};");
|
||||
TODO_ASSERT_EQUALS("[test.cpp:7]: (performance, inconclusive) Technically the member function 'MyGUI::types::TCoord::size' can be static.\n"
|
||||
TODO_ASSERT_EQUALS("[test.cpp:7]: (performance, inconclusive) Technically the member function 'MyGUI::types::TCoord::size' can be static (but you may consider moving to unnamed namespace).\n"
|
||||
"[test.cpp:15]: (style, inconclusive) Technically the member function 'SelectorControl::getSize' can be const.\n",
|
||||
"[test.cpp:7]: (performance, inconclusive) Technically the member function 'MyGUI::types::TCoord::size' can be static.\n", errout.str());
|
||||
"[test.cpp:7]: (performance, inconclusive) Technically the member function 'MyGUI::types::TCoord::size' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("struct Foo {\n"
|
||||
" Bar b;\n"
|
||||
|
@ -5429,7 +5429,7 @@ private:
|
|||
" b.run();\n"
|
||||
" }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (performance, inconclusive) Technically the member function 'Bar::run' can be static.\n"
|
||||
ASSERT_EQUALS("[test.cpp:2]: (performance, inconclusive) Technically the member function 'Bar::run' can be static (but you may consider moving to unnamed namespace).\n"
|
||||
"[test.cpp:6]: (style, inconclusive) Technically the member function 'Foo::foo' can be const.\n", errout.str());
|
||||
}
|
||||
|
||||
|
@ -5439,14 +5439,14 @@ private:
|
|||
" f.clear();\n"
|
||||
" }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (performance, inconclusive) Technically the member function 'MyObject::foo' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:2]: (performance, inconclusive) Technically the member function 'MyObject::foo' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("struct MyObject {\n"
|
||||
" int foo(Foo f) {\n"
|
||||
" return f.length();\n"
|
||||
" }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (performance, inconclusive) Technically the member function 'MyObject::foo' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:2]: (performance, inconclusive) Technically the member function 'MyObject::foo' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("struct MyObject {\n"
|
||||
" Foo f;\n"
|
||||
|
@ -5662,8 +5662,8 @@ private:
|
|||
" return foo3();\n"
|
||||
" }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:11]: (performance, inconclusive) Technically the member function 'Foo::bar3' can be static.\n"
|
||||
"[test.cpp:14]: (performance, inconclusive) Technically the member function 'Foo::bar4' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:11]: (performance, inconclusive) Technically the member function 'Foo::bar3' can be static (but you may consider moving to unnamed namespace).\n"
|
||||
"[test.cpp:14]: (performance, inconclusive) Technically the member function 'Foo::bar4' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
}
|
||||
|
||||
void const_passThisToMemberOfOtherClass() {
|
||||
|
@ -5681,7 +5681,7 @@ private:
|
|||
" f.foo();\n"
|
||||
" }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (performance, inconclusive) Technically the member function 'Foo::foo' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:2]: (performance, inconclusive) Technically the member function 'Foo::foo' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("struct A;\n" // #5839 - operator()
|
||||
"struct B {\n"
|
||||
|
@ -5751,25 +5751,25 @@ private:
|
|||
"class Fred {\n"
|
||||
" void nextA() { return ++a; }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("int a;\n"
|
||||
"class Fred {\n"
|
||||
" void nextA() { return --a; }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("int a;\n"
|
||||
"class Fred {\n"
|
||||
" void nextA() { return a++; }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("int a;\n"
|
||||
"class Fred {\n"
|
||||
" void nextA() { return a--; }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
}
|
||||
|
||||
void constassign1() {
|
||||
|
@ -5807,31 +5807,31 @@ private:
|
|||
"class Fred {\n"
|
||||
" void nextA() { return a=1; }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("int a;\n"
|
||||
"class Fred {\n"
|
||||
" void nextA() { return a-=1; }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("int a;\n"
|
||||
"class Fred {\n"
|
||||
" void nextA() { return a+=1; }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("int a;\n"
|
||||
"class Fred {\n"
|
||||
" void nextA() { return a*=-1; }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("int a;\n"
|
||||
"class Fred {\n"
|
||||
" void nextA() { return a/=-2; }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
}
|
||||
|
||||
void constassign2() {
|
||||
|
@ -5863,31 +5863,31 @@ private:
|
|||
"class Fred {\n"
|
||||
" void nextA() { return s.a=1; }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("struct A { int a; } s;\n"
|
||||
"class Fred {\n"
|
||||
" void nextA() { return s.a-=1; }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("struct A { int a; } s;\n"
|
||||
"class Fred {\n"
|
||||
" void nextA() { return s.a+=1; }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("struct A { int a; } s;\n"
|
||||
"class Fred {\n"
|
||||
" void nextA() { return s.a*=-1; }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("struct A { int a; } s;\n"
|
||||
"class Fred {\n"
|
||||
" void nextA() { return s.a/=-2; }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("struct A { int a; };\n"
|
||||
"class Fred {\n"
|
||||
|
@ -5955,25 +5955,25 @@ private:
|
|||
"class Fred {\n"
|
||||
" void nextA() { return ++a[0]; }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("int a[2];\n"
|
||||
"class Fred {\n"
|
||||
" void nextA() { return --a[0]; }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("int a[2];\n"
|
||||
"class Fred {\n"
|
||||
" void nextA() { return a[0]++; }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("int a[2];\n"
|
||||
"class Fred {\n"
|
||||
" void nextA() { return a[0]--; }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
}
|
||||
|
||||
void constassignarray() {
|
||||
|
@ -6011,31 +6011,31 @@ private:
|
|||
"class Fred {\n"
|
||||
" void nextA() { return a[0]=1; }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("int a[2];\n"
|
||||
"class Fred {\n"
|
||||
" void nextA() { return a[0]-=1; }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("int a[2];\n"
|
||||
"class Fred {\n"
|
||||
" void nextA() { return a[0]+=1; }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("int a[2];\n"
|
||||
"class Fred {\n"
|
||||
" void nextA() { return a[0]*=-1; }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("int a[2];\n"
|
||||
"class Fred {\n"
|
||||
" void nextA() { return a[0]/=-2; }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
}
|
||||
|
||||
// return pointer/reference => not const
|
||||
|
@ -6078,7 +6078,7 @@ private:
|
|||
" void f() const { };\n"
|
||||
" void a() { f(); };\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (performance, inconclusive) Technically the member function 'Fred::f' can be static.\n"
|
||||
ASSERT_EQUALS("[test.cpp:2]: (performance, inconclusive) Technically the member function 'Fred::f' can be static (but you may consider moving to unnamed namespace).\n"
|
||||
"[test.cpp:3]: (style, inconclusive) Technically the member function 'Fred::a' can be const.\n", errout.str());
|
||||
|
||||
// ticket #1593
|
||||
|
@ -6339,7 +6339,7 @@ private:
|
|||
"};";
|
||||
|
||||
checkConst(code, &settings0, true);
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'foo::f' can be static.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'foo::f' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst(code, &settings0, false); // TODO: Set inconclusive to true (preprocess it)
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
|
Loading…
Reference in New Issue