diff --git a/lib/checkassignif.cpp b/lib/checkassignif.cpp index 31fe1635a..edfd06969 100644 --- a/lib/checkassignif.cpp +++ b/lib/checkassignif.cpp @@ -191,5 +191,5 @@ void CheckAssignIf::multiConditionError(const Token *tok, unsigned int line1) errmsg << "'else if' condition matches previous condition at line " << line1; - reportError(tok, Severity::information, "multiCondition", errmsg.str()); + reportError(tok, Severity::style, "multiCondition", errmsg.str()); } diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index d294a6f95..4ca8585cf 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -1762,7 +1762,7 @@ bool CheckClass::isVirtualFunc(const Scope *scope, const Token *functionToken) c void CheckClass::checkConstError(const Token *tok, const std::string &classname, const std::string &funcname) { - reportError(tok, Severity::information, "functionConst", + reportError(tok, Severity::style, "functionConst", "Technically the member function '" + classname + "::" + funcname + "' can be const.\n" "The member function '" + classname + "::" + funcname + "' can be made a const " "function. Making this function const function should not cause compiler errors. " @@ -1776,7 +1776,7 @@ void CheckClass::checkConstError2(const Token *tok1, const Token *tok2, const st std::list toks; toks.push_back(tok1); toks.push_back(tok2); - reportError(toks, Severity::information, "functionConst", + reportError(toks, Severity::style, "functionConst", "Technically the member function '" + classname + "::" + funcname + "' can be const.\n" "The member function '" + classname + "::" + funcname + "' can be made a const " "function. Making this function const function should not cause compiler errors. " diff --git a/lib/checkobsoletefunctions.cpp b/lib/checkobsoletefunctions.cpp index d324d58b3..94e4aeee1 100644 --- a/lib/checkobsoletefunctions.cpp +++ b/lib/checkobsoletefunctions.cpp @@ -60,7 +60,7 @@ void CheckObsoleteFunctions::obsoleteFunctions() { // If checking an old code base it might be uninteresting to update obsolete functions. // Therefore this is "information" - reportError(tok->tokAt(1), Severity::information, "obsoleteFunctions"+it->first, it->second); + reportError(tok->tokAt(1), Severity::style, "obsoleteFunctions"+it->first, it->second); break; } else if (_settings->posix) @@ -70,7 +70,7 @@ void CheckObsoleteFunctions::obsoleteFunctions() { // If checking an old code base it might be uninteresting to update obsolete functions. // Therefore this is "information" - reportError(tok->tokAt(1), Severity::information, "obsoleteFunctions"+it->first, it->second); + reportError(tok->tokAt(1), Severity::style, "obsoleteFunctions"+it->first, it->second); break; } } diff --git a/lib/checkother.cpp b/lib/checkother.cpp index cdcbf2c0d..c7ca4c8e3 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -1558,7 +1558,7 @@ void CheckOther::lookupVar(const Token *tok1, const std::string &varname) void CheckOther::variableScopeError(const Token *tok, const std::string &varname) { reportError(tok, - Severity::information, + Severity::style, "variableScope", "The scope of the variable '" + varname + "' can be reduced\n" "The scope of the variable '" + varname + "' can be reduced. Warning: It can be unsafe " diff --git a/test/testassignif.cpp b/test/testassignif.cpp index f7f8f730f..6d483275c 100644 --- a/test/testassignif.cpp +++ b/test/testassignif.cpp @@ -121,14 +121,14 @@ private: " if (x & 7);\n" " else if (x == 1);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (information) 'else if' condition matches previous condition at line 3\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) 'else if' condition matches previous condition at line 3\n", errout.str()); check("void foo(int x)\n" "{\n" " if (x & 7);\n" " else if (x & 1);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (information) 'else if' condition matches previous condition at line 3\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) 'else if' condition matches previous condition at line 3\n", errout.str()); } }; diff --git a/test/testclass.cpp b/test/testclass.cpp index fd3554da4..50d12cdcc 100644 --- a/test/testclass.cpp +++ b/test/testclass.cpp @@ -3637,18 +3637,18 @@ private: " int a;\n" " int getA() { return a; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::getA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::getA' can be const.\n", errout.str()); checkConst("class Fred {\n" " const std::string foo() { return ""; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:2]: (information) Technically the member function 'Fred::foo' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:2]: (style) Technically the member function 'Fred::foo' can be const.\n", errout.str()); checkConst("class Fred {\n" " std::string s;\n" " const std::string & foo() { return ""; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::foo' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::foo' can be const.\n", errout.str()); // constructors can't be const.. checkConst("class Fred {\n" @@ -3704,7 +3704,7 @@ private: " std::string s;\n" " void foo(std::string & a) { a = s; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::foo' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::foo' can be const.\n", errout.str()); // assignment to variable can't be const checkConst("class Fred {\n" @@ -3718,7 +3718,7 @@ private: " std::string s;\n" " void foo(std::string & a, std::string & b) { a = s; b = s; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::foo' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::foo' can be const.\n", errout.str()); // assignment to variable, can't be const checkConst("class Fred {\n" @@ -3749,7 +3749,7 @@ private: " int s;\n" " void foo(int * a) { *a = s; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::foo' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::foo' can be const.\n", errout.str()); // assignment to variable, can't be const checkConst("class Fred {\n" @@ -3763,7 +3763,7 @@ private: " std::string s;\n" " void foo(std::string * a, std::string * b) { *a = s; *b = s; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::foo' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::foo' can be const.\n", errout.str()); // assignment to variable, can't be const checkConst("class Fred {\n" @@ -3794,20 +3794,20 @@ private: " int getA();\n" "};\n" "int Fred::getA() { return a; }"); - ASSERT_EQUALS("[test.cpp:5] -> [test.cpp:3]: (information) Technically the member function 'Fred::getA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5] -> [test.cpp:3]: (style) Technically the member function 'Fred::getA' can be const.\n", errout.str()); checkConst("class Fred {\n" " const std::string foo();\n" "};\n" "const std::string Fred::foo() { return ""; }"); - ASSERT_EQUALS("[test.cpp:4] -> [test.cpp:2]: (information) Technically the member function 'Fred::foo' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4] -> [test.cpp:2]: (style) Technically the member function 'Fred::foo' can be const.\n", errout.str()); checkConst("class Fred {\n" " std::string s;\n" " const std::string & foo();\n" "};\n" "const std::string & Fred::foo() { return ""; }"); - ASSERT_EQUALS("[test.cpp:5] -> [test.cpp:3]: (information) Technically the member function 'Fred::foo' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5] -> [test.cpp:3]: (style) Technically the member function 'Fred::foo' can be const.\n", errout.str()); // constructors can't be const.. checkConst("class Fred {\n" @@ -3859,7 +3859,7 @@ private: " void foo(std::string & a);\n" "};\n" "void Fred::foo(std::string & a) { a = s; }"); - ASSERT_EQUALS("[test.cpp:5] -> [test.cpp:3]: (information) Technically the member function 'Fred::foo' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5] -> [test.cpp:3]: (style) Technically the member function 'Fred::foo' can be const.\n", errout.str()); // assignment to variable can't be const checkConst("class Fred {\n" @@ -3875,7 +3875,7 @@ private: " void foo(std::string & a, std::string & b);\n" "};\n" "void Fred::foo(std::string & a, std::string & b) { a = s; b = s; }"); - ASSERT_EQUALS("[test.cpp:5] -> [test.cpp:3]: (information) Technically the member function 'Fred::foo' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5] -> [test.cpp:3]: (style) Technically the member function 'Fred::foo' can be const.\n", errout.str()); // assignment to variable, can't be const checkConst("class Fred {\n" @@ -3907,7 +3907,7 @@ private: " void foo(int * a);\n" "};\n" "void Fred::foo(int * a) { *a = s; }"); - ASSERT_EQUALS("[test.cpp:5] -> [test.cpp:3]: (information) Technically the member function 'Fred::foo' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5] -> [test.cpp:3]: (style) Technically the member function 'Fred::foo' can be const.\n", errout.str()); // assignment to variable, can't be const checkConst("class Fred {\n" @@ -3923,7 +3923,7 @@ private: " void foo(std::string * a, std::string * b);\n" "};\n" "void Fred::foo(std::string * a, std::string * b) { *a = s; *b = s; }"); - ASSERT_EQUALS("[test.cpp:5] -> [test.cpp:3]: (information) Technically the member function 'Fred::foo' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5] -> [test.cpp:3]: (style) Technically the member function 'Fred::foo' can be const.\n", errout.str()); // assignment to variable, can't be const checkConst("class Fred {\n" @@ -3959,8 +3959,8 @@ 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]: (information) Technically the member function 'Fred::foo' can be const.\n" - "[test.cpp:7] -> [test.cpp:4]: (information) Technically the member function 'Fred::foo' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:7] -> [test.cpp:3]: (style) Technically the member function 'Fred::foo' can be const.\n" + "[test.cpp:7] -> [test.cpp:4]: (style) Technically the member function 'Fred::foo' can be const.\n", errout.str()); // check functions with different or missing parameter names checkConst("class Fred {\n" @@ -3976,11 +3976,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]: (information) Technically the member function 'Fred::foo1' can be const.\n" - "[test.cpp:10] -> [test.cpp:4]: (information) Technically the member function 'Fred::foo2' can be const.\n" - "[test.cpp:11] -> [test.cpp:5]: (information) Technically the member function 'Fred::foo3' can be const.\n" - "[test.cpp:12] -> [test.cpp:6]: (information) Technically the member function 'Fred::foo4' can be const.\n" - "[test.cpp:13] -> [test.cpp:7]: (information) Technically the member function 'Fred::foo5' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:9] -> [test.cpp:3]: (style) Technically the member function 'Fred::foo1' can be const.\n" + "[test.cpp:10] -> [test.cpp:4]: (style) Technically the member function 'Fred::foo2' can be const.\n" + "[test.cpp:11] -> [test.cpp:5]: (style) Technically the member function 'Fred::foo3' can be const.\n" + "[test.cpp:12] -> [test.cpp:6]: (style) Technically the member function 'Fred::foo4' can be const.\n" + "[test.cpp:13] -> [test.cpp:7]: (style) Technically the member function 'Fred::foo5' can be const.\n", errout.str()); // check nested classes checkConst("class Fred {\n" @@ -3989,7 +3989,7 @@ private: " int getA() { return a; }\n" " };\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'Fred::A::getA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'Fred::A::getA' can be const.\n", errout.str()); checkConst("class Fred {\n" " class A {\n" @@ -3998,7 +3998,7 @@ private: " };\n" " int A::getA() { return a; }\n" "};"); - ASSERT_EQUALS("[test.cpp:6] -> [test.cpp:4]: (information) Technically the member function 'Fred::A::getA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:6] -> [test.cpp:4]: (style) Technically the member function 'Fred::A::getA' can be const.\n", errout.str()); checkConst("class Fred {\n" " class A {\n" @@ -4007,7 +4007,7 @@ private: " };\n" "};\n" "int Fred::A::getA() { return a; }"); - ASSERT_EQUALS("[test.cpp:7] -> [test.cpp:4]: (information) Technically the member function 'Fred::A::getA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:7] -> [test.cpp:4]: (style) Technically the member function 'Fred::A::getA' can be const.\n", errout.str()); // check deeply nested classes checkConst("class Fred {\n" @@ -4020,8 +4020,8 @@ private: " };\n" " };\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'Fred::B::getB' can be const.\n" - "[test.cpp:7]: (information) Technically the member function 'Fred::B::A::getA' can be const.\n" + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'Fred::B::getB' can be const.\n" + "[test.cpp:7]: (style) Technically the member function 'Fred::B::A::getA' can be const.\n" , errout.str()); checkConst("class Fred {\n" @@ -4036,8 +4036,8 @@ private: " };\n" " int B::getB() { return b; }\n" "};"); - ASSERT_EQUALS("[test.cpp:11] -> [test.cpp:4]: (information) Technically the member function 'Fred::B::getB' can be const.\n" - "[test.cpp:9] -> [test.cpp:7]: (information) Technically the member function 'Fred::B::A::getA' can be const.\n" , errout.str()); + ASSERT_EQUALS("[test.cpp:11] -> [test.cpp:4]: (style) Technically the member function 'Fred::B::getB' can be const.\n" + "[test.cpp:9] -> [test.cpp:7]: (style) Technically the member function 'Fred::B::A::getA' can be const.\n" , errout.str()); checkConst("class Fred {\n" " class B {\n" @@ -4051,8 +4051,8 @@ private: " int B::A::getA() { return a; }\n" " int B::getB() { return b; }\n" "};"); - ASSERT_EQUALS("[test.cpp:11] -> [test.cpp:4]: (information) Technically the member function 'Fred::B::getB' can be const.\n" - "[test.cpp:10] -> [test.cpp:7]: (information) Technically the member function 'Fred::B::A::getA' can be const.\n" , errout.str()); + ASSERT_EQUALS("[test.cpp:11] -> [test.cpp:4]: (style) Technically the member function 'Fred::B::getB' can be const.\n" + "[test.cpp:10] -> [test.cpp:7]: (style) Technically the member function 'Fred::B::A::getA' can be const.\n" , errout.str()); checkConst("class Fred {\n" " class B {\n" @@ -4066,8 +4066,8 @@ private: "};\n" "int Fred::B::A::getA() { return a; }\n" "int Fred::B::getB() { return b; }\n"); - ASSERT_EQUALS("[test.cpp:12] -> [test.cpp:4]: (information) Technically the member function 'Fred::B::getB' can be const.\n" - "[test.cpp:11] -> [test.cpp:7]: (information) Technically the member function 'Fred::B::A::getA' can be const.\n" , errout.str()); + ASSERT_EQUALS("[test.cpp:12] -> [test.cpp:4]: (style) Technically the member function 'Fred::B::getB' can be const.\n" + "[test.cpp:11] -> [test.cpp:7]: (style) Technically the member function 'Fred::B::A::getA' can be const.\n" , errout.str()); } // operator< can often be const @@ -4077,7 +4077,7 @@ private: " int a;\n" " bool operator<(const Fred &f) { return (a < f.a); }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::operator<' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::operator<' can be const.\n", errout.str()); } // operator<< @@ -4109,7 +4109,7 @@ private: " int array[10];\n" " int const & operator [] (unsigned int index) { return array[index]; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::operator[]' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::operator[]' can be const.\n", errout.str()); } void constoperator4() @@ -4119,7 +4119,7 @@ private: " typedef int* (Fred::*UnspecifiedBoolType);\n" " operator UnspecifiedBoolType() { };\n" "};\n"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'Fred::operatorint**' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'Fred::operatorint**' can be const.\n", errout.str()); checkConst("struct Fred {\n" " int array[10];\n" @@ -4141,7 +4141,7 @@ private: " return same;\n" " }\n" "};"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'A::foo' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'A::foo' can be const.\n", errout.str()); } void const6() @@ -4158,7 +4158,7 @@ private: "public:\n" " void foo() { }\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'Fred::foo' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'Fred::foo' can be const.\n", errout.str()); checkConst("struct fast_string\n" "{\n" @@ -4197,7 +4197,7 @@ private: "private:\n" " std::string m_strValue;\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::strGetString' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::strGetString' can be const.\n", errout.str()); } void const9() @@ -4261,7 +4261,7 @@ private: "private:\n" " mutable int x;\n" "};"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'A::foo' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'A::foo' can be const.\n", errout.str()); } void const13() @@ -4276,8 +4276,8 @@ private: " std::vector m_vec;\n" " std::pair m_pair;\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::GetVec' can be const.\n" - "[test.cpp:5]: (information) Technically the member function 'A::GetPair' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::GetVec' can be const.\n" + "[test.cpp:5]: (style) Technically the member function 'A::GetPair' can be const.\n", errout.str()); checkConst("class A {\n" "public:\n" @@ -4288,8 +4288,8 @@ private: " std::vector m_vec;\n" " std::pair m_pair;\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::GetVec' can be const.\n" - "[test.cpp:5]: (information) Technically the member function 'A::GetPair' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::GetVec' can be const.\n" + "[test.cpp:5]: (style) Technically the member function 'A::GetPair' can be const.\n", errout.str()); } void const14() @@ -4302,7 +4302,7 @@ private: "private:\n" " std::pair,double> m_pair;\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::GetPair' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::GetPair' can be const.\n", errout.str()); checkConst("class A {\n" "public:\n" @@ -4311,7 +4311,7 @@ private: "private:\n" " std::pair,double> m_pair;\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::GetPair' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::GetPair' can be const.\n", errout.str()); checkConst("class A {\n" "public:\n" @@ -4331,7 +4331,7 @@ private: "private:\n" " pair m_pair;\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::GetPair' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::GetPair' can be const.\n", errout.str()); checkConst("using namespace std;" "class A {\n" @@ -4341,7 +4341,7 @@ private: "private:\n" " pair m_pair;\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::GetPair' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::GetPair' can be const.\n", errout.str()); checkConst("using namespace std;" "class A {\n" @@ -4361,7 +4361,7 @@ private: "private:\n" " std::pair< int,std::vector > m_pair;\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::GetPair' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::GetPair' can be const.\n", errout.str()); checkConst("class A {\n" "public:\n" @@ -4370,7 +4370,7 @@ private: "private:\n" " std::pair< int,std::vector > m_pair;\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::GetPair' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::GetPair' can be const.\n", errout.str()); checkConst("class A {\n" "public:\n" @@ -4390,7 +4390,7 @@ private: "private:\n" " pair< int,vector > m_pair;\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::GetPair' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::GetPair' can be const.\n", errout.str()); checkConst("using namespace std;" "class A {\n" @@ -4400,7 +4400,7 @@ private: "private:\n" " pair< int,vector > m_pair;\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::GetPair' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::GetPair' can be const.\n", errout.str()); checkConst("using namespace std;" "class A {\n" @@ -4421,7 +4421,7 @@ private: "private:\n" " pair< vector, int > m_pair;\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::GetPair' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::GetPair' can be const.\n", errout.str()); checkConst("using namespace std;" "class A {\n" @@ -4431,7 +4431,7 @@ private: "private:\n" " pair< vector, int > m_pair;\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::GetPair' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::GetPair' can be const.\n", errout.str()); checkConst("using namespace std;" "class A {\n" @@ -4450,7 +4450,7 @@ private: "private:\n" " std::pair< std::vector,std::vector > m_pair;\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::GetPair' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::GetPair' can be const.\n", errout.str()); checkConst("class A {\n" "public:\n" @@ -4459,7 +4459,7 @@ private: "private:\n" " std::pair< std::vector,std::vector > m_pair;\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::GetPair' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::GetPair' can be const.\n", errout.str()); checkConst("class A {\n" "public:\n" @@ -4479,7 +4479,7 @@ private: "private:\n" " pair< vector, vector > m_pair;\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::GetPair' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::GetPair' can be const.\n", errout.str()); checkConst("using namespace std;" "class A {\n" @@ -4489,7 +4489,7 @@ private: "private:\n" " pair< vector, vector > m_pair;\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::GetPair' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::GetPair' can be const.\n", errout.str()); checkConst("using namespace std;" "class A {\n" @@ -4510,7 +4510,7 @@ private: "private:\n" " std::pair< std::pair < int, char > , int > m_pair;\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::GetPair' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::GetPair' can be const.\n", errout.str()); checkConst("class A {\n" "public:\n" @@ -4519,7 +4519,7 @@ private: "private:\n" " std::pair< std::pair < int, char > , int > m_pair;\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::GetPair' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::GetPair' can be const.\n", errout.str()); checkConst("class A {\n" "public:\n" @@ -4538,7 +4538,7 @@ private: "private:\n" " pair< pair < int, char > , int > m_pair;\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::GetPair' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::GetPair' can be const.\n", errout.str()); checkConst("using namespace std;" "class A {\n" @@ -4548,7 +4548,7 @@ private: "private:\n" " pair< pair < int, char > , int > m_pair;\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::GetPair' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::GetPair' can be const.\n", errout.str()); checkConst("using namespace std;" "class A {\n" @@ -4569,7 +4569,7 @@ private: "private:\n" " pair< int , pair < int, char > > m_pair;\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::GetPair' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::GetPair' can be const.\n", errout.str()); checkConst("using namespace std;" "class A {\n" @@ -4579,7 +4579,7 @@ private: "private:\n" " pair< int , pair < int, char > > m_pair;\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::GetPair' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::GetPair' can be const.\n", errout.str()); checkConst("using namespace std;" @@ -4599,7 +4599,7 @@ private: "private:\n" " std::pair< int , std::pair < int, char > > m_pair;\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::GetPair' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::GetPair' can be const.\n", errout.str()); checkConst("class A {\n" "public:\n" @@ -4608,7 +4608,7 @@ private: "private:\n" " std::pair< int , std::pair < int, char > > m_pair;\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::GetPair' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::GetPair' can be const.\n", errout.str()); checkConst("class A {\n" "public:\n" @@ -4628,7 +4628,7 @@ private: "private:\n" " vector m_Vec;\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::GetVec' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::GetVec' can be const.\n", errout.str()); checkConst("using namespace std;" "class A {\n" @@ -4638,7 +4638,7 @@ private: "private:\n" " vector m_Vec;\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::GetVec' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::GetVec' can be const.\n", errout.str()); checkConst("using namespace std;" "class A {\n" @@ -4665,7 +4665,7 @@ private: "private:\n" " const int * x;\n" "};"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'A::foo' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'A::foo' can be const.\n", errout.str()); checkConst("class A {\n" "public:\n" @@ -4673,7 +4673,7 @@ private: "private:\n" " const int * x;\n" "};"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'A::foo' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'A::foo' can be const.\n", errout.str()); } void const15() @@ -4682,7 +4682,7 @@ private: " unsigned long long int a;\n" " unsigned long long int getA() { return a; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::getA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::getA' can be const.\n", errout.str()); // constructors can't be const.. checkConst("class Fred {\n" @@ -4786,7 +4786,7 @@ private: "public:\n" " list get() { return x; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'Fred::get' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'Fred::get' can be const.\n", errout.str()); checkConst("class Fred {\n" " std::list x;\n" @@ -4800,7 +4800,7 @@ private: "public:\n" " std::list get() { return x; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'Fred::get' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'Fred::get' can be const.\n", errout.str()); } void const21() @@ -4893,7 +4893,7 @@ private: "std::string m_strVal;\n" "};\n" ); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::strGetString' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::strGetString' can be const.\n", errout.str()); checkConst("class A{\n" "public:\n" @@ -4904,7 +4904,7 @@ private: "std::string m_strVal;\n" "};\n" ); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::strGetString1' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::strGetString1' can be const.\n", errout.str()); checkConst("class A{\n" "public:\n" @@ -4915,7 +4915,7 @@ private: "std::vector m_strVec;\n" "};\n" ); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::strGetSize' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::strGetSize' can be const.\n", errout.str()); checkConst("class A{\n" "public:\n" @@ -4926,7 +4926,7 @@ private: "std::vector m_strVec;\n" "};\n" ); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::strGetEmpty' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'A::strGetEmpty' can be const.\n", errout.str()); } void const26() // ticket #1847 @@ -4959,7 +4959,7 @@ private: " return dRet;\n" "};\n" ); - ASSERT_EQUALS("[test.cpp:9] -> [test.cpp:4]: (information) Technically the member function 'A::dGetValue' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:9] -> [test.cpp:4]: (style) Technically the member function 'A::dGetValue' can be const.\n", errout.str()); } void const28() // ticket #1883 @@ -4998,7 +4998,7 @@ private: " UnknownScope::x = x_;\n" " }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'AA::vSetXPos' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Technically the member function 'AA::vSetXPos' can be const.\n", errout.str()); } @@ -5040,7 +5040,7 @@ private: " return a;\n" " }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:7]: (information) Technically the member function 'Derived::get' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:7]: (style) Technically the member function 'Derived::get' can be const.\n", errout.str()); checkConst("class Base1 {\n" "public:\n" @@ -5059,8 +5059,8 @@ private: " return b;\n" " }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:11]: (information) Technically the member function 'Derived::getA' can be const.\n" - "[test.cpp:14]: (information) Technically the member function 'Derived::getB' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:11]: (style) Technically the member function 'Derived::getA' can be const.\n" + "[test.cpp:14]: (style) Technically the member function 'Derived::getB' can be const.\n", errout.str()); checkConst("class Base {\n" "public:\n" @@ -5073,7 +5073,7 @@ private: " return a;\n" " }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:8]: (information) Technically the member function 'Derived2::get' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:8]: (style) Technically the member function 'Derived2::get' can be const.\n", errout.str()); checkConst("class Base {\n" "public:\n" @@ -5088,7 +5088,7 @@ private: " return a;\n" " }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:10]: (information) Technically the member function 'Derived4::get' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:10]: (style) Technically the member function 'Derived4::get' can be const.\n", errout.str()); // check for false positives checkConst("class Base {\n" @@ -5159,7 +5159,7 @@ private: " int a;\n" " int get() { return a; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:5]: (information) Technically the member function 'Fred::get' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (style) Technically the member function 'Fred::get' can be const.\n", errout.str()); } void const32() @@ -5208,7 +5208,7 @@ private: " int var;\n" " };\n" "}\n"); - ASSERT_EQUALS("[test.cpp:12]: (information) Technically the member function 'N::Derived::getResourceName' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:12]: (style) Technically the member function 'N::Derived::getResourceName' can be const.\n", errout.str()); checkConst("namespace N\n" "{\n" @@ -5220,7 +5220,7 @@ private: " };\n" "}\n" "int N::Base::getResourceName() { return var; }\n"); - ASSERT_EQUALS("[test.cpp:10] -> [test.cpp:6]: (information) Technically the member function 'N::Base::getResourceName' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:10] -> [test.cpp:6]: (style) Technically the member function 'N::Base::getResourceName' can be const.\n", errout.str()); checkConst("namespace N\n" "{\n" @@ -5235,7 +5235,7 @@ private: "{\n" " int Base::getResourceName() { return var; }\n" "}\n"); - ASSERT_EQUALS("[test.cpp:12] -> [test.cpp:6]: (information) Technically the member function 'N::Base::getResourceName' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:12] -> [test.cpp:6]: (style) Technically the member function 'N::Base::getResourceName' can be const.\n", errout.str()); checkConst("namespace N\n" "{\n" @@ -5248,7 +5248,7 @@ private: "}\n" "using namespace N;\n" "int Base::getResourceName() { return var; }\n"); - TODO_ASSERT_EQUALS("[test.cpp:11] -> [test.cpp:6]: (information) Technically the member function 'N::Base::getResourceName' can be const.\n", + TODO_ASSERT_EQUALS("[test.cpp:11] -> [test.cpp:6]: (style) Technically the member function 'N::Base::getResourceName' can be const.\n", "", errout.str()); } @@ -5278,7 +5278,7 @@ private: "private:\n" " std::string m_str;\n" "};\n"); - ASSERT_EQUALS("[test.cpp:5]: (information) Technically the member function 'A::operator+' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (style) Technically the member function 'A::operator+' can be const.\n", errout.str()); checkConst("class Fred\n" "{\n" @@ -5292,7 +5292,7 @@ private: " return bool(x == 0x11224488);\n" " }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:9]: (information) Technically the member function 'Fred::isValid' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:9]: (style) Technically the member function 'Fred::isValid' can be const.\n", errout.str()); } void const38() // ticket #2135 @@ -5441,7 +5441,7 @@ private: "{\n" "}\n"); - ASSERT_EQUALS("[test.cpp:7] -> [test.cpp:5]: (information) Technically the member function 'Fred::f' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:7] -> [test.cpp:5]: (style) Technically the member function 'Fred::f' can be const.\n", errout.str()); checkConst("class Fred\n" "{\n" @@ -5455,7 +5455,7 @@ private: "{\n" "}\n"); - ASSERT_EQUALS("[test.cpp:9] -> [test.cpp:7]: (information) Technically the member function 'Fred::f' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:9] -> [test.cpp:7]: (style) Technically the member function 'Fred::f' can be const.\n", errout.str()); checkConst("namespace NS {\n" " class Fred\n" @@ -5471,7 +5471,7 @@ private: " }\n" "}\n"); - ASSERT_EQUALS("[test.cpp:10] -> [test.cpp:8]: (information) Technically the member function 'NS::Fred::f' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:10] -> [test.cpp:8]: (style) Technically the member function 'NS::Fred::f' can be const.\n", errout.str()); checkConst("namespace NS {\n" " class Fred\n" @@ -5487,7 +5487,7 @@ private: "{\n" "}\n"); - ASSERT_EQUALS("[test.cpp:11] -> [test.cpp:8]: (information) Technically the member function 'NS::Fred::f' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:11] -> [test.cpp:8]: (style) Technically the member function 'NS::Fred::f' can be const.\n", errout.str()); checkConst("class Foo {\n" " class Fred\n" @@ -5503,7 +5503,7 @@ private: "{\n" "}\n"); - ASSERT_EQUALS("[test.cpp:11] -> [test.cpp:8]: (information) Technically the member function 'Foo::Fred::f' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:11] -> [test.cpp:8]: (style) Technically the member function 'Foo::Fred::f' can be const.\n", errout.str()); } void const43() // ticket 2377 @@ -5595,7 +5595,7 @@ private: " };\n" "}\n"); - ASSERT_EQUALS("[test.cpp:8]: (information) Technically the member function 'tools::WorkspaceControl::toGrid' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:8]: (style) Technically the member function 'tools::WorkspaceControl::toGrid' can be const.\n", errout.str()); } void const46() // ticket 2663 @@ -5611,8 +5611,8 @@ private: " }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Altren::fun1' can be const.\n" - "[test.cpp:7]: (information) Technically the member function 'Altren::fun2' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Altren::fun1' can be const.\n" + "[test.cpp:7]: (style) Technically the member function 'Altren::fun2' can be const.\n", errout.str()); } void const47() // ticket 2670 @@ -5633,7 +5633,7 @@ private: " void bar() { foo(1); }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:5]: (information) Technically the member function 'Altren::bar' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (style) Technically the member function 'Altren::bar' can be const.\n", errout.str()); } void const48() // ticket 2672 @@ -5765,7 +5765,7 @@ private: " switch (x) { }\n" " }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'MyObject::foo' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'MyObject::foo' can be const.\n", errout.str()); checkConst("class A\n" "{\n" @@ -5808,7 +5808,7 @@ private: "\n" " return RET_NOK;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:9] -> [test.cpp:4]: (information) Technically the member function 'A::f' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:9] -> [test.cpp:4]: (style) Technically the member function 'A::f' can be const.\n", errout.str()); checkConst("class MyObject {\n" "public:\n" @@ -5816,7 +5816,7 @@ private: " for (int i = 0; i < 5; i++) { }\n" " }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'MyObject::foo' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'MyObject::foo' can be const.\n", errout.str()); } void assigningPointerToPointerIsNotAConstOperation() @@ -5878,25 +5878,25 @@ private: "class Fred {\n" " void nextA() { return ++a; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); checkConst("int a;\n" "class Fred {\n" " void nextA() { return --a; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); checkConst("int a;\n" "class Fred {\n" " void nextA() { return a++; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); checkConst("int a;\n" "class Fred {\n" " void nextA() { return a--; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); } void constassign1() @@ -5935,31 +5935,31 @@ private: "class Fred {\n" " void nextA() { return a=1; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); checkConst("int a;\n" "class Fred {\n" " void nextA() { return a-=1; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); checkConst("int a;\n" "class Fred {\n" " void nextA() { return a+=1; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); checkConst("int a;\n" "class Fred {\n" " void nextA() { return a*=-1; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); checkConst("int a;\n" "class Fred {\n" " void nextA() { return a/=-2; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); } void constassign2() @@ -5992,31 +5992,31 @@ private: "class Fred {\n" " void nextA() { return s.a=1; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); checkConst("struct A { int a; } s;\n" "class Fred {\n" " void nextA() { return s.a-=1; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); checkConst("struct A { int a; } s;\n" "class Fred {\n" " void nextA() { return s.a+=1; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); checkConst("struct A { int a; } s;\n" "class Fred {\n" " void nextA() { return s.a*=-1; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); checkConst("struct A { int a; } s;\n" "class Fred {\n" " void nextA() { return s.a/=-2; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); checkConst("struct A { int a; };\n" "class Fred {\n" @@ -6085,25 +6085,25 @@ private: "class Fred {\n" " void nextA() { return ++a[0]; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); checkConst("int a[2];\n" "class Fred {\n" " void nextA() { return --a[0]; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); checkConst("int a[2];\n" "class Fred {\n" " void nextA() { return a[0]++; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); checkConst("int a[2];\n" "class Fred {\n" " void nextA() { return a[0]--; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); } void constassignarray() @@ -6142,31 +6142,31 @@ private: "class Fred {\n" " void nextA() { return a[0]=1; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); checkConst("int a[2];\n" "class Fred {\n" " void nextA() { return a[0]-=1; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); checkConst("int a[2];\n" "class Fred {\n" " void nextA() { return a[0]+=1; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); checkConst("int a[2];\n" "class Fred {\n" " void nextA() { return a[0]*=-1; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); checkConst("int a[2];\n" "class Fred {\n" " void nextA() { return a[0]/=-2; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::nextA' can be const.\n", errout.str()); } // return pointer/reference => not const @@ -6212,7 +6212,7 @@ private: " void f() const { };\n" " void a() { f(); };\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Technically the member function 'Fred::a' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Technically the member function 'Fred::a' can be const.\n", errout.str()); // ticket #1593 checkConst("#include \n" @@ -6223,7 +6223,7 @@ private: " A(){}\n" " unsigned int GetVecSize() {return m_v.size();}\n" "};"); - ASSERT_EQUALS("[test.cpp:7]: (information) Technically the member function 'A::GetVecSize' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:7]: (style) Technically the member function 'A::GetVecSize' can be const.\n", errout.str()); checkConst("#include \n" "class A\n" @@ -6233,7 +6233,7 @@ private: " A(){}\n" " bool GetVecEmpty() {return m_v.empty();}\n" "};"); - ASSERT_EQUALS("[test.cpp:7]: (information) Technically the member function 'A::GetVecEmpty' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:7]: (style) Technically the member function 'A::GetVecEmpty' can be const.\n", errout.str()); } void constVirtualFunc() @@ -6246,7 +6246,7 @@ private: " B() : b(0) { }\n" " int func() { return b; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:6]: (information) Technically the member function 'B::func' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:6]: (style) Technically the member function 'B::func' can be const.\n", errout.str()); checkConst("class A { };\n" "class B : public A {\n" @@ -6256,7 +6256,7 @@ private: " int func();\n" "};\n" "int B::func() { return b; }\n"); - ASSERT_EQUALS("[test.cpp:8] -> [test.cpp:6]: (information) Technically the member function 'B::func' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:8] -> [test.cpp:6]: (style) Technically the member function 'B::func' can be const.\n", errout.str()); // base class has no virtual function checkConst("class A {\n" @@ -6269,7 +6269,7 @@ private: " B() : b(0) { }\n" " int func() { return b; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:9]: (information) Technically the member function 'B::func' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:9]: (style) Technically the member function 'B::func' can be const.\n", errout.str()); checkConst("class A {\n" "public:\n" @@ -6282,7 +6282,7 @@ private: " int func();\n" "};\n" "int B::func() { return b; }\n"); - ASSERT_EQUALS("[test.cpp:11] -> [test.cpp:9]: (information) Technically the member function 'B::func' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:11] -> [test.cpp:9]: (style) Technically the member function 'B::func' can be const.\n", errout.str()); // base class has virtual function checkConst("class A {\n" @@ -6342,9 +6342,9 @@ private: " C() : c(0) { }\n" " int func() { return c; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:5]: (information) Technically the member function 'A::func' can be const.\n" - "[test.cpp:11]: (information) Technically the member function 'B::func' can be const.\n" - "[test.cpp:17]: (information) Technically the member function 'C::func' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (style) Technically the member function 'A::func' can be const.\n" + "[test.cpp:11]: (style) Technically the member function 'B::func' can be const.\n" + "[test.cpp:17]: (style) Technically the member function 'C::func' can be const.\n", errout.str()); checkConst("class A {\n" " int a;\n" @@ -6367,9 +6367,9 @@ private: " int func();\n" "};\n" "int C::func() { return c; }\n"); - ASSERT_EQUALS("[test.cpp:7] -> [test.cpp:5]: (information) Technically the member function 'A::func' can be const.\n" - "[test.cpp:14] -> [test.cpp:12]: (information) Technically the member function 'B::func' can be const.\n" - "[test.cpp:21] -> [test.cpp:19]: (information) Technically the member function 'C::func' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:7] -> [test.cpp:5]: (style) Technically the member function 'A::func' can be const.\n" + "[test.cpp:14] -> [test.cpp:12]: (style) Technically the member function 'B::func' can be const.\n" + "[test.cpp:21] -> [test.cpp:19]: (style) Technically the member function 'C::func' can be const.\n", errout.str()); // base class has virtual function checkConst("class A {\n" @@ -6434,9 +6434,9 @@ private: " Z(int x, int y, int z) : Y(x, y), z(z) { }\n" " int getZ() { return z; }\n" "};\n"); - ASSERT_EQUALS("[test.cpp:5]: (information) Technically the member function 'X::getX' can be const.\n" - "[test.cpp:11]: (information) Technically the member function 'Y::getY' can be const.\n" - "[test.cpp:17]: (information) Technically the member function 'Z::getZ' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (style) Technically the member function 'X::getX' can be const.\n" + "[test.cpp:11]: (style) Technically the member function 'Y::getY' can be const.\n" + "[test.cpp:17]: (style) Technically the member function 'Z::getZ' can be const.\n", errout.str()); checkConst("class X {\n" " int x;\n" @@ -6459,9 +6459,9 @@ private: " int getZ();\n" "};\n" "int Z::getZ() { return z; }\n"); - ASSERT_EQUALS("[test.cpp:7] -> [test.cpp:5]: (information) Technically the member function 'X::getX' can be const.\n" - "[test.cpp:14] -> [test.cpp:12]: (information) Technically the member function 'Y::getY' can be const.\n" - "[test.cpp:21] -> [test.cpp:19]: (information) Technically the member function 'Z::getZ' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:7] -> [test.cpp:5]: (style) Technically the member function 'X::getX' can be const.\n" + "[test.cpp:14] -> [test.cpp:12]: (style) Technically the member function 'Y::getY' can be const.\n" + "[test.cpp:21] -> [test.cpp:19]: (style) Technically the member function 'Z::getZ' can be const.\n", errout.str()); } void constIfCfg() @@ -6475,7 +6475,7 @@ private: settings.ifcfg = false; checkConst(code, &settings); - ASSERT_EQUALS("[test.cpp:2]: (information) Technically the member function 'foo::f' can be const.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:2]: (style) Technically the member function 'foo::f' can be const.\n", errout.str()); settings.ifcfg = true; checkConst(code, &settings); diff --git a/test/testobsoletefunctions.cpp b/test/testobsoletefunctions.cpp index 94de7d2a4..12cbf27ce 100644 --- a/test/testobsoletefunctions.cpp +++ b/test/testobsoletefunctions.cpp @@ -85,7 +85,7 @@ private: "{\n" " bsd_signal(SIGABRT, SIG_IGN);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Found obsolete function 'bsd_signal'. It is recommended that new applications use the 'sigaction' function\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Found obsolete function 'bsd_signal'. It is recommended that new applications use the 'sigaction' function\n", errout.str()); check("int f()\n" "{\n" @@ -105,7 +105,7 @@ private: " exit(1);\n" " }\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (information) Found obsolete function 'gethostbyname'. It is recommended that new applications use the 'getaddrinfo' function\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Found obsolete function 'gethostbyname'. It is recommended that new applications use the 'getaddrinfo' function\n", errout.str()); } void testgethostbyaddr() @@ -118,7 +118,7 @@ private: " exit(1);\n" " }\n" "}\n"); - ASSERT_EQUALS("[test.cpp:5]: (information) Found obsolete function 'gethostbyaddr'. It is recommended that new applications use the 'getnameinfo' function\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (style) Found obsolete function 'gethostbyaddr'. It is recommended that new applications use the 'getnameinfo' function\n", errout.str()); } void testusleep() @@ -127,7 +127,7 @@ private: "{\n" " usleep( 1000 );\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Found obsolete function 'usleep'. It is recommended that new applications use the 'nanosleep' or 'setitimer' function\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Found obsolete function 'usleep'. It is recommended that new applications use the 'nanosleep' or 'setitimer' function\n", errout.str()); } void testindex() @@ -168,7 +168,7 @@ private: " const char i = index(var, 0);\n" " return i;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (information) Found obsolete function 'index'. It is recommended to use the function 'strchr' instead\n", + ASSERT_EQUALS("[test.cpp:4]: (style) Found obsolete function 'index'. It is recommended to use the function 'strchr' instead\n", errout.str()); } @@ -177,7 +177,7 @@ private: check("void TDataModel::forceRowRefresh(int row) {\n" " emit dataChanged(index(row, 0), index(row, columnCount() - 1));\n" "}\n"); - ASSERT_EQUALS("[test.cpp:2]: (information) Found obsolete function 'index'. It is recommended to use the function 'strchr' instead\n", errout.str()); + ASSERT_EQUALS("[test.cpp:2]: (style) Found obsolete function 'index'. It is recommended to use the function 'strchr' instead\n", errout.str()); } void testrindex() @@ -193,7 +193,7 @@ private: " const char var[7] = 'rindex';\n" " print(rindex(var, 0));\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (information) Found obsolete function 'rindex'. It is recommended to use the function 'strrchr' instead\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Found obsolete function 'rindex'. It is recommended to use the function 'strrchr' instead\n", errout.str()); } @@ -213,7 +213,7 @@ private: "{\n" " char *x = gets();\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) Found obsolete function 'gets'. It is recommended to use the function 'fgets' instead\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Found obsolete function 'gets'. It is recommended to use the function 'fgets' instead\n", errout.str()); } // ticket #3121 diff --git a/test/testother.cpp b/test/testother.cpp index 237ef2a6b..db00142e7 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -604,7 +604,7 @@ private: " for ( ; i < 10; ++i) ;\n" " }\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) The scope of the variable 'i' can be reduced\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) The scope of the variable 'i' can be reduced\n", errout.str()); varScope("void f(int x)\n" "{\n" @@ -614,7 +614,7 @@ private: " for ( ; i < 10; ++i) ;\n" " }\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (information) The scope of the variable 'i' can be reduced\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) The scope of the variable 'i' can be reduced\n", errout.str()); } void varScope6() @@ -680,7 +680,7 @@ private: " edgeResistance = (edge+1) / 2.0;\n" " }\n" "}\n"); - ASSERT_EQUALS("[test.cpp:2]: (information) The scope of the variable 'edgeResistance' can be reduced\n", errout.str()); + ASSERT_EQUALS("[test.cpp:2]: (style) The scope of the variable 'edgeResistance' can be reduced\n", errout.str()); } void varScope9()