From 24b98feadb9ddfc319b86a8d9e78d985f9d4b50b Mon Sep 17 00:00:00 2001 From: PKEuS Date: Thu, 1 Nov 2012 18:40:20 +0100 Subject: [PATCH] Message refactorization: checkuninitvar.cpp, checkunusedfunctions.cpp, checkunusedvar.cpp --- lib/checkuninitvar.cpp | 4 +- lib/checkunusedfunctions.cpp | 2 +- lib/checkunusedvar.cpp | 8 +- test/testuninitvar.cpp | 24 +-- test/testunusedfunctions.cpp | 16 +- test/testunusedvar.cpp | 318 +++++++++++++++++------------------ 6 files changed, 186 insertions(+), 186 deletions(-) diff --git a/lib/checkuninitvar.cpp b/lib/checkuninitvar.cpp index 5c9badb86..cba05f230 100644 --- a/lib/checkuninitvar.cpp +++ b/lib/checkuninitvar.cpp @@ -1337,12 +1337,12 @@ bool CheckUninitVar::isVariableUsage(const Token *vartok, bool pointer) const void CheckUninitVar::uninitstringError(const Token *tok, const std::string &varname, bool strncpy_) { - reportError(tok, Severity::error, "uninitstring", "Dangerous usage of '" + varname + "'" + (strncpy_ ? " (strncpy doesn't always 0-terminate it)" : " (not 0-terminated)")); + reportError(tok, Severity::error, "uninitstring", "Dangerous usage of '" + varname + "'" + (strncpy_ ? " (strncpy doesn't always 0-terminate it)." : " (not 0-terminated).")); } void CheckUninitVar::uninitdataError(const Token *tok, const std::string &varname) { - reportError(tok, Severity::error, "uninitdata", "Data is allocated but not initialized: " + varname); + reportError(tok, Severity::error, "uninitdata", "Memory is allocated but not initialized: " + varname); } void CheckUninitVar::uninitvarError(const Token *tok, const std::string &varname) diff --git a/lib/checkunusedfunctions.cpp b/lib/checkunusedfunctions.cpp index cb3e92073..946f86dc3 100644 --- a/lib/checkunusedfunctions.cpp +++ b/lib/checkunusedfunctions.cpp @@ -177,7 +177,7 @@ void CheckUnusedFunctions::unusedFunctionError(ErrorLogger * const errorLogger, locationList.push_back(fileLoc); } - const ErrorLogger::ErrorMessage errmsg(locationList, Severity::style, "The function '" + funcname + "' is never used", "unusedFunction", false); + const ErrorLogger::ErrorMessage errmsg(locationList, Severity::style, "The function '" + funcname + "' is never used.", "unusedFunction", false); if (errorLogger) errorLogger->reportErr(errmsg); else diff --git a/lib/checkunusedvar.cpp b/lib/checkunusedvar.cpp index 31baf351e..68ad423fb 100644 --- a/lib/checkunusedvar.cpp +++ b/lib/checkunusedvar.cpp @@ -1026,17 +1026,17 @@ void CheckUnusedVar::unusedVariableError(const Token *tok, const std::string &va void CheckUnusedVar::allocatedButUnusedVariableError(const Token *tok, const std::string &varname) { - reportError(tok, Severity::style, "unusedAllocatedMemory", "Variable '" + varname + "' is allocated memory that is never used"); + reportError(tok, Severity::style, "unusedAllocatedMemory", "Variable '" + varname + "' is allocated memory that is never used."); } void CheckUnusedVar::unreadVariableError(const Token *tok, const std::string &varname) { - reportError(tok, Severity::style, "unreadVariable", "Variable '" + varname + "' is assigned a value that is never used"); + reportError(tok, Severity::style, "unreadVariable", "Variable '" + varname + "' is assigned a value that is never used."); } void CheckUnusedVar::unassignedVariableError(const Token *tok, const std::string &varname) { - reportError(tok, Severity::style, "unassignedVariable", "Variable '" + varname + "' is not assigned a value"); + reportError(tok, Severity::style, "unassignedVariable", "Variable '" + varname + "' is not assigned a value."); } //--------------------------------------------------------------------------- @@ -1129,5 +1129,5 @@ void CheckUnusedVar::checkStructMemberUsage() void CheckUnusedVar::unusedStructMemberError(const Token *tok, const std::string &structname, const std::string &varname) { - reportError(tok, Severity::style, "unusedStructMember", "struct or union member '" + structname + "::" + varname + "' is never used"); + reportError(tok, Severity::style, "unusedStructMember", "struct or union member '" + structname + "::" + varname + "' is never used."); } diff --git a/test/testuninitvar.cpp b/test/testuninitvar.cpp index 9b6f85d51..4c5c4fc8a 100644 --- a/test/testuninitvar.cpp +++ b/test/testuninitvar.cpp @@ -483,7 +483,7 @@ private: " char *s = malloc(100);\n" " *s += 10;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (error) Data is allocated but not initialized: s\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (error) Memory is allocated but not initialized: s\n", errout.str()); checkUninitVar("void f()\n" "{\n" @@ -1257,7 +1257,7 @@ private: " strcpy(strMsg,buffer);\n" " free(buffer);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (error) Data is allocated but not initialized: buffer\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (error) Memory is allocated but not initialized: buffer\n", errout.str()); // #3845 checkUninitVar("int foo() {\n" @@ -1292,42 +1292,42 @@ private: " char *s = malloc(100);\n" " strcat(s, \"abc\");\n" "};\n"); - ASSERT_EQUALS("[test.cpp:4]: (error) Data is allocated but not initialized: s\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (error) Memory is allocated but not initialized: s\n", errout.str()); checkUninitVar("void f()\n" "{\n" " char *s = malloc(100);\n" " perror(s);\n" "};"); - ASSERT_EQUALS("[test.cpp:4]: (error) Data is allocated but not initialized: s\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (error) Memory is allocated but not initialized: s\n", errout.str()); checkUninitVar("void f()\n" "{\n" " char *s1 = new char[10];\n" " char *s2 = new char[strlen(s1)];\n" "};\n"); - ASSERT_EQUALS("[test.cpp:4]: (error) Data is allocated but not initialized: s1\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (error) Memory is allocated but not initialized: s1\n", errout.str()); checkUninitVar("void f()\n" "{\n" " char *p = malloc(64);\n" " int x = p[0];\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (error) Data is allocated but not initialized: p\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (error) Memory is allocated but not initialized: p\n", errout.str()); checkUninitVar("void f()\n" "{\n" " char *p = malloc(64);\n" " if (p[0]) { }\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (error) Data is allocated but not initialized: p\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (error) Memory is allocated but not initialized: p\n", errout.str()); checkUninitVar("void f()\n" "{\n" " char *p = malloc(64);\n" " return p[0];\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (error) Data is allocated but not initialized: p\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (error) Memory is allocated but not initialized: p\n", errout.str()); checkUninitVar("void f()\n" "{\n" @@ -1407,7 +1407,7 @@ private: " return;\n" " char c = *s;\n" "};\n"); - ASSERT_EQUALS("[test.cpp:6]: (error) Data is allocated but not initialized: s\n", errout.str()); + ASSERT_EQUALS("[test.cpp:6]: (error) Memory is allocated but not initialized: s\n", errout.str()); // #3708 - false positive when using ptr typedef checkUninitVar("void f() {\n" @@ -1572,7 +1572,7 @@ private: " strncpy(a, s, 20);\n" " strncat(a, s, 20);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:5]: (error) Dangerous usage of 'a' (strncpy doesn't always 0-terminate it)\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (error) Dangerous usage of 'a' (strncpy doesn't always 0-terminate it).\n", errout.str()); checkUninitVar("void f()\n" "{\n" @@ -1580,7 +1580,7 @@ private: " strncpy(a, \"hello\", 3);\n" " strncat(a, \"world\", 20);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:5]: (error) Dangerous usage of 'a' (strncpy doesn't always 0-terminate it)\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (error) Dangerous usage of 'a' (strncpy doesn't always 0-terminate it).\n", errout.str()); checkUninitVar("void f()\n" "{\n" @@ -1623,7 +1623,7 @@ private: " memset(a, 'a', 20);\n" " strcat(a, s);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (error) Dangerous usage of 'a' (not 0-terminated)\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (error) Dangerous usage of 'a' (not 0-terminated).\n", errout.str()); } std::string analyseFunctions(const char code[]) { diff --git a/test/testunusedfunctions.cpp b/test/testunusedfunctions.cpp index b810ac8da..4c88890e0 100644 --- a/test/testunusedfunctions.cpp +++ b/test/testunusedfunctions.cpp @@ -177,19 +177,19 @@ private: void unusedError() { check("void foo() {}\n" "int main()\n"); - ASSERT_EQUALS("[test.cpp:1]: (style) The function 'foo' is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:1]: (style) The function 'foo' is never used.\n", errout.str()); check("void foo() const {}\n" "int main()\n"); - ASSERT_EQUALS("[test.cpp:1]: (style) The function 'foo' is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:1]: (style) The function 'foo' is never used.\n", errout.str()); check("void foo() const throw() {}\n" "int main()\n"); - ASSERT_EQUALS("[test.cpp:1]: (style) The function 'foo' is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:1]: (style) The function 'foo' is never used.\n", errout.str()); check("void foo() throw() {}\n" "int main()\n"); - ASSERT_EQUALS("[test.cpp:1]: (style) The function 'foo' is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:1]: (style) The function 'foo' is never used.\n", errout.str()); } void unusedMain() { @@ -217,7 +217,7 @@ private: void returnRef() { check("int& foo() {return x;}"); - ASSERT_EQUALS("[test.cpp:1]: (style) The function 'foo' is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:1]: (style) The function 'foo' is never used.\n", errout.str()); } void multipleFiles() { @@ -247,15 +247,15 @@ private: // Check for unused functions.. c.check(this); - ASSERT_EQUALS("[test1.cpp:1]: (style) The function 'f' is never used\n",errout.str()); + ASSERT_EQUALS("[test1.cpp:1]: (style) The function 'f' is never used.\n", errout.str()); } void lineNumber() { check("void foo() {}\n" "void bar() {}\n" "int main()\n"); - ASSERT_EQUALS("[test.cpp:2]: (style) The function 'bar' is never used\n" - "[test.cpp:1]: (style) The function 'foo' is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:2]: (style) The function 'bar' is never used.\n" + "[test.cpp:1]: (style) The function 'foo' is never used.\n", errout.str()); } }; diff --git a/test/testunusedvar.cpp b/test/testunusedvar.cpp index c895c719e..6ce2a7fcc 100644 --- a/test/testunusedvar.cpp +++ b/test/testunusedvar.cpp @@ -173,9 +173,9 @@ private: " int b;\n" " int c;\n" "};\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) struct or union member 'abc::a' is never used\n" - "[test.cpp:4]: (style) struct or union member 'abc::b' is never used\n" - "[test.cpp:5]: (style) struct or union member 'abc::c' is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) struct or union member 'abc::a' is never used.\n" + "[test.cpp:4]: (style) struct or union member 'abc::b' is never used.\n" + "[test.cpp:5]: (style) struct or union member 'abc::c' is never used.\n", errout.str()); } void structmember2() { @@ -371,7 +371,7 @@ private: "{\n" " ab.b = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) struct or union member 'AB::a' is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) struct or union member 'AB::a' is never used.\n", errout.str()); } void functionVariableUsage(const char code[], const char filename[]="test.cpp") { @@ -397,13 +397,13 @@ private: "{\n" " int i = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " int i(0);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); // if a is undefined then Cppcheck can't determine if "int i(a)" is a // * variable declaration @@ -412,14 +412,14 @@ private: "{\n" " int i(a);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " int j = 0;\n" " int i(j);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -443,7 +443,7 @@ private: " int & i(j);\n" " x(j);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -451,40 +451,40 @@ private: " const int & i(j);\n" " x(j);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " int * j = 0;\n" " int * i(j);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " int * j = 0;\n" " const int * i(j);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " bool i = false;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " bool i = true;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " char *i;\n" " i = fgets();\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); // undefined variables are not reported because they may be classes with constructors functionVariableUsage("undefined foo()\n" @@ -498,98 +498,98 @@ private: " undefined i = 0;\n" "}\n", "test.c"); - ASSERT_EQUALS("[test.c:3]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.c:3]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " int i = undefined;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " int * i = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " void * i = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " const void * i = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " struct S * i = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " const struct S * i = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " struct S & i = j;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " const struct S & i = j;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " undefined * i = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " int i = 0;\n" " int j = i;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'j' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'j' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " int i[10] = { 0 };\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo(int n)\n" "{\n" " int i[n] = { 0 };\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " char i[10] = \"123456789\";\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " char *i = \"123456789\";\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " int i = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -607,10 +607,10 @@ private: " for(i = 0; i < 10; i++) {\n" " std::cout<ySize / 8;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'x' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'x' is assigned a value that is never used.\n", errout.str()); } void localvar14() { @@ -1271,7 +1271,7 @@ private: " char *ptr = buf;\n" " *(ptr++) = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'buf' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'buf' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("int foo()\n" "{\n" @@ -1279,7 +1279,7 @@ private: " char *ptr = buf - 1;\n" " *(++ptr) = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'buf' is not assigned a value\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'buf' is not assigned a value.\n", errout.str()); // #3910 functionVariableUsage("int foo() {\n" @@ -1314,7 +1314,7 @@ private: " data->info = k;\n" " line_start = ptr;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:10]: (style) Variable 'line_start' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:10]: (style) Variable 'line_start' is assigned a value that is never used.\n", errout.str()); } void localvar18() { // ticket #1723 @@ -1331,8 +1331,8 @@ private: " int c;\n" " c = *(a);\n" "}"); - ASSERT_EQUALS("[test.cpp:2]: (style) Variable 'a' is not assigned a value\n" - "[test.cpp:4]: (style) Variable 'c' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:2]: (style) Variable 'a' is not assigned a value.\n" + "[test.cpp:4]: (style) Variable 'c' is assigned a value that is never used.\n", errout.str()); } void localvar20() { // ticket #1799 @@ -1373,7 +1373,7 @@ private: " a = b[c] = 0;\n" " return a;\n" "}"); - ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'b' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'b' is assigned a value that is never used.\n", errout.str()); } void localvar24() { // ticket #1803 @@ -1623,7 +1623,7 @@ private: " int *b = &a;\n" "}\n"); ASSERT_EQUALS("[test.cpp:3]: (style) Unused variable: a\n" - "[test.cpp:4]: (style) Variable 'b' is assigned a value that is never used\n", errout.str()); + "[test.cpp:4]: (style) Variable 'b' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -1631,7 +1631,7 @@ private: " int *b = a;\n" "}\n"); ASSERT_EQUALS("[test.cpp:3]: (style) Unused variable: a\n" - "[test.cpp:4]: (style) Variable 'b' is assigned a value that is never used\n", errout.str()); + "[test.cpp:4]: (style) Variable 'b' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -1639,7 +1639,7 @@ private: " int *b = &a;\n" " *b = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -1647,7 +1647,7 @@ private: " char *b = (char *)&a;\n" " *b = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -1655,7 +1655,7 @@ private: " char *b = (char *)(&a);\n" " *b = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -1663,7 +1663,7 @@ private: " const char *b = (const char *)&a;\n" " *b = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -1671,7 +1671,7 @@ private: " const char *b = (const char *)(&a);\n" " *b = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -1679,7 +1679,7 @@ private: " char *b = static_cast(&a);\n" " *b = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -1687,7 +1687,7 @@ private: " const char *b = static_cast(&a);\n" " *b = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used.\n", errout.str()); // a is not a local variable and b is aliased to it functionVariableUsage("int a;\n" @@ -1695,14 +1695,14 @@ private: "{\n" " int *b = &a;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'b' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'b' is assigned a value that is never used.\n", errout.str()); // a is not a local variable and b is aliased to it functionVariableUsage("void foo(int a)\n" "{\n" " int *b = &a;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'b' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'b' is assigned a value that is never used.\n", errout.str()); // a is not a local variable and b is aliased to it functionVariableUsage("class A\n" @@ -1713,7 +1713,7 @@ private: " int *b = &a;\n" " }\n" "}\n"); - ASSERT_EQUALS("[test.cpp:6]: (style) Variable 'b' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:6]: (style) Variable 'b' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("int a;\n" "void foo()\n" @@ -1747,7 +1747,7 @@ private: " int *b = a;\n" " *b = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -1755,7 +1755,7 @@ private: " char *b = (char *)a;\n" " *b = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -1763,7 +1763,7 @@ private: " char *b = (char *)(a);\n" " *b = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -1771,7 +1771,7 @@ private: " const char *b = (const char *)a;\n" " *b = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -1779,7 +1779,7 @@ private: " const char *b = (const char *)(a);\n" " *b = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -1787,7 +1787,7 @@ private: " char *b = static_cast(a);\n" " *b = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -1795,7 +1795,7 @@ private: " const char *b = static_cast(a);\n" " *b = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("int a[10];\n" "void foo()\n" @@ -1836,7 +1836,7 @@ private: " int *c;\n" " *c = b[0];\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'c' is not assigned a value\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'c' is not assigned a value.\n", errout.str()); functionVariableUsage("int a[10];\n" "void foo()\n" @@ -1902,7 +1902,7 @@ private: " int *c = b;\n" " *c = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:6]: (style) Variable 'a' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:6]: (style) Variable 'a' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -1913,8 +1913,8 @@ private: " *d = 0;\n" "}\n"); ASSERT_EQUALS("[test.cpp:3]: (style) Unused variable: a\n" - "[test.cpp:7]: (style) Variable 'b' is assigned a value that is never used\n" - "[test.cpp:5]: (style) Variable 'c' is assigned a value that is never used\n", errout.str()); + "[test.cpp:7]: (style) Variable 'b' is assigned a value that is never used.\n" + "[test.cpp:5]: (style) Variable 'c' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -1925,7 +1925,7 @@ private: " *c = 0;\n" "}\n"); ASSERT_EQUALS("[test.cpp:3]: (style) Unused variable: a\n" - "[test.cpp:7]: (style) Variable 'b' is assigned a value that is never used\n", errout.str()); + "[test.cpp:7]: (style) Variable 'b' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -1937,15 +1937,15 @@ private: " c = a;\n" " *c = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:9]: (style) Variable 'a' is assigned a value that is never used\n" - "[test.cpp:7]: (style) Variable 'b' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:9]: (style) Variable 'a' is assigned a value that is never used.\n" + "[test.cpp:7]: (style) Variable 'b' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " int a[10], * b = a + 10;\n" " b[-10] = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'a' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'a' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -1953,8 +1953,8 @@ private: " b[-10] = 0;\n" " int * c = b - 10;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'a' is assigned a value that is never used\n" - "[test.cpp:5]: (style) Variable 'c' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'a' is assigned a value that is never used.\n" + "[test.cpp:5]: (style) Variable 'c' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -1962,7 +1962,7 @@ private: " int * c = b - 10;\n" " x = c[0];\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'a' is not assigned a value\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'a' is not assigned a value.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -1970,7 +1970,7 @@ private: " int * c = b - 10;\n" " c[1] = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -1987,7 +1987,7 @@ private: " int d = c[0];\n" " f(d);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'a' is not assigned a value\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'a' is not assigned a value.\n", errout.str()); functionVariableUsage("struct S { char c[100]; };\n" "void foo()\n" @@ -2005,7 +2005,7 @@ private: " struct S * s = (struct S *)a;\n" "}\n"); ASSERT_EQUALS("[test.cpp:4]: (style) Unused variable: a\n" - "[test.cpp:5]: (style) Variable 's' is assigned a value that is never used\n", errout.str()); + "[test.cpp:5]: (style) Variable 's' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("struct S { char c[100]; };\n" "void foo()\n" @@ -2014,7 +2014,7 @@ private: " const struct S * s = (const struct S *)a;\n" "}\n"); ASSERT_EQUALS("[test.cpp:4]: (style) Unused variable: a\n" - "[test.cpp:5]: (style) Variable 's' is assigned a value that is never used\n", errout.str()); + "[test.cpp:5]: (style) Variable 's' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("struct S { char c[100]; };\n" "void foo()\n" @@ -2023,7 +2023,7 @@ private: " struct S * s = static_cast(a);\n" "}\n"); ASSERT_EQUALS("[test.cpp:4]: (style) Unused variable: a\n" - "[test.cpp:5]: (style) Variable 's' is assigned a value that is never used\n", errout.str()); + "[test.cpp:5]: (style) Variable 's' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("struct S { char c[100]; };\n" "void foo()\n" @@ -2032,7 +2032,7 @@ private: " const struct S * s = static_cast(a);\n" "}\n"); ASSERT_EQUALS("[test.cpp:4]: (style) Unused variable: a\n" - "[test.cpp:5]: (style) Variable 's' is assigned a value that is never used\n", errout.str()); + "[test.cpp:5]: (style) Variable 's' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("int a[10];\n" "void foo()\n" @@ -2046,7 +2046,7 @@ private: " *d = 0;\n" "}\n"); ASSERT_EQUALS("[test.cpp:4]: (style) Unused variable: b\n" - "[test.cpp:10]: (style) Variable 'c' is assigned a value that is never used\n", errout.str()); + "[test.cpp:10]: (style) Variable 'c' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("int a[10];\n" "void foo()\n" @@ -2058,8 +2058,8 @@ private: " d = a; *d = 0;\n" " d = c; *d = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:7]: (style) Variable 'b' is assigned a value that is never used\n" - "[test.cpp:9]: (style) Variable 'c' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:7]: (style) Variable 'b' is assigned a value that is never used.\n" + "[test.cpp:9]: (style) Variable 'c' is assigned a value that is never used.\n", errout.str()); } void localvaralias2() { // ticket 1637 @@ -2088,7 +2088,7 @@ private: "{\n" " int * a = &ab.a;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'a' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'a' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("struct AB { int a; int b; } ab;\n" "void foo()\n" @@ -2104,8 +2104,8 @@ private: " struct AB ab;\n" " int * a = &ab.a;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'ab' is not assigned a value\n" - "[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'ab' is not assigned a value.\n" + "[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("struct AB { int a; int b; };\n" "void foo()\n" @@ -2181,7 +2181,7 @@ private: " }\n" " b(srcdata);\n" "}"); - ASSERT_EQUALS("[test.cpp:6]: (style) Variable 'buf' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:6]: (style) Variable 'buf' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -2194,7 +2194,7 @@ private: " srcdata = vdata;\n" " b(srcdata);\n" "}"); - ASSERT_EQUALS("[test.cpp:6]: (style) Variable 'buf' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:6]: (style) Variable 'buf' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -2247,7 +2247,7 @@ private: " }\n" " b(srcdata);\n" "}"); - ASSERT_EQUALS("[test.cpp:7]: (style) Variable 'buf' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:7]: (style) Variable 'buf' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -2261,7 +2261,7 @@ private: " srcdata = vdata;\n" " b(srcdata);\n" "}"); - ASSERT_EQUALS("[test.cpp:7]: (style) Variable 'buf' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:7]: (style) Variable 'buf' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -2502,7 +2502,7 @@ private: " ref[0] = 123;\n" "}", "test.c"); - ASSERT_EQUALS("[test.c:5]: (style) Variable 'foo' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.c:5]: (style) Variable 'foo' is assigned a value that is never used.\n", errout.str()); } void localvaralias10() { // ticket 2004 @@ -2549,7 +2549,7 @@ private: " struct ABC { int a, b, c; };\n" " struct ABC abc = { 1, 2, 3 };\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'abc' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'abc' is assigned a value that is never used.\n", errout.str()); } void localvarStruct3() { @@ -2627,14 +2627,14 @@ private: " A a = { 0 };\n" " return 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'a' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'a' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("class A { int i; };\n" "int foo() {\n" " A a = { 0 };\n" " return 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'a' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'a' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("class A { int i; public: A(); { } };\n" "int foo() {\n" @@ -2704,7 +2704,7 @@ private: " struct X x[10];\n" " x[0].a = 0;\n" "}"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'x' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'x' is assigned a value that is never used.\n", errout.str()); } void localvarOp() { @@ -2758,7 +2758,7 @@ private: " int b = 2;\n" " a |= b;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo() {\n" " int a = 1;\n" @@ -2872,26 +2872,26 @@ private: "{\n" " static int i;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " static int i = 0;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " static int i(0);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " static int j = 0;\n" " static int i(j);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'i' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'i' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("int * foo(int x)\n" "{\n" @@ -2901,7 +2901,7 @@ private: " b[1] = 1;\n" " return x ? a : c;\n" "}"); - ASSERT_EQUALS("[test.cpp:6]: (style) Variable 'b' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:6]: (style) Variable 'b' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -2926,28 +2926,28 @@ private: " void* ptr = malloc(16);\n" " free(ptr);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'ptr' is allocated memory that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'ptr' is allocated memory that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " void* ptr = g_malloc(16);\n" " g_free(ptr);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'ptr' is allocated memory that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'ptr' is allocated memory that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " void* ptr = kmalloc(16, GFP_KERNEL);\n" " kfree(ptr);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'ptr' is allocated memory that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'ptr' is allocated memory that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " void* ptr = vmalloc(16, GFP_KERNEL);\n" " vfree(ptr);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'ptr' is allocated memory that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'ptr' is allocated memory that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" @@ -2955,28 +2955,28 @@ private: " char* ptr = new char[16];\n" " delete[] ptr;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'ptr' is allocated memory that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'ptr' is allocated memory that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " char* ptr = new ( nothrow ) char[16];\n" " delete[] ptr;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'ptr' is allocated memory that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'ptr' is allocated memory that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " char* ptr = new ( std::nothrow ) char[16];\n" " delete[] ptr;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'ptr' is allocated memory that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'ptr' is allocated memory that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" " char* ptr = new char;\n" " delete ptr;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'ptr' is allocated memory that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'ptr' is allocated memory that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" "{\n" @@ -3009,7 +3009,7 @@ private: " std::cout << \"test\" << std::endl;\n" " delete fred;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'fred' is allocated memory that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'fred' is allocated memory that is never used.\n", errout.str()); functionVariableUsage("struct Fred { int a; Fred() : a(0) {} };\n" "void foo()\n" @@ -3026,7 +3026,7 @@ private: " std::cout << \"test\" << std::endl;\n" " free(fred);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'fred' is allocated memory that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'fred' is allocated memory that is never used.\n", errout.str()); functionVariableUsage("void foo()\n" @@ -3044,7 +3044,7 @@ private: " Fred* ptr = malloc(sizeof(Fred));\n" " free(ptr);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'ptr' is allocated memory that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'ptr' is allocated memory that is never used.\n", errout.str()); functionVariableUsage("struct Fred { int i; };\n" "void foo()\n" @@ -3061,7 +3061,7 @@ private: " struct Fred* ptr = malloc(sizeof(Fred));\n" " free(ptr);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'ptr' is allocated memory that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'ptr' is allocated memory that is never used.\n", errout.str()); functionVariableUsage("struct Fred { int i; };\n" "void foo()\n" @@ -3078,7 +3078,7 @@ private: " Fred* ptr = new Fred();\n" " delete ptr;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'ptr' is allocated memory that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'ptr' is allocated memory that is never used.\n", errout.str()); functionVariableUsage("struct Fred { int i; };\n" "void foo()\n" @@ -3086,7 +3086,7 @@ private: " Fred* ptr = new (nothrow ) Fred();\n" " delete ptr;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'ptr' is allocated memory that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'ptr' is allocated memory that is never used.\n", errout.str()); functionVariableUsage("struct Fred { int i; };\n" "void foo()\n" @@ -3094,7 +3094,7 @@ private: " Fred* ptr = new (std::nothrow) Fred();\n" " delete ptr;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'ptr' is allocated memory that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'ptr' is allocated memory that is never used.\n", errout.str()); functionVariableUsage("struct Fred { int i; };\n" "void foo()\n" @@ -3111,7 +3111,7 @@ private: " struct Fred* ptr = new Fred();\n" " free(ptr);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'ptr' is allocated memory that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'ptr' is allocated memory that is never used.\n", errout.str()); functionVariableUsage("struct Fred { int i; };\n" "void foo()\n" @@ -3128,7 +3128,7 @@ private: " Fred* ptr = malloc(sizeof(Fred));\n" " free(ptr);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'ptr' is allocated memory that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'ptr' is allocated memory that is never used.\n", errout.str()); functionVariableUsage("class Fred { public: int i; };\n" "void foo()\n" @@ -3145,7 +3145,7 @@ private: " Fred* ptr = new Fred();\n" " delete ptr;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'ptr' is allocated memory that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'ptr' is allocated memory that is never used.\n", errout.str()); functionVariableUsage("class Fred { public: int i; };\n" "void foo()\n" @@ -3204,12 +3204,12 @@ private: " std::string s;\n" " s = \"foo\";\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Variable 's' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Variable 's' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void foo() {\n" " std::string s = \"foo\";\n" "}\n"); - ASSERT_EQUALS("[test.cpp:2]: (style) Variable 's' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:2]: (style) Variable 's' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("std::string foo() {\n" " std::string s;\n" // Class instances are initialized. Assignement is not necessary @@ -3237,7 +3237,7 @@ private: functionVariableUsage("void foo() {\n" " const bool b = true;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:2]: (style) Variable 'b' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:2]: (style) Variable 'b' is assigned a value that is never used.\n", errout.str()); } void localvarconst2() { @@ -3260,7 +3260,7 @@ private: functionVariableUsage("void f() {\n" " std::string x = foo();\n" "}"); - ASSERT_EQUALS("[test.cpp:2]: (style) Variable 'x' is assigned a value that is never used\n", errout.str()); + ASSERT_EQUALS("[test.cpp:2]: (style) Variable 'x' is assigned a value that is never used.\n", errout.str()); functionVariableUsage("void f() {\n" " std::vector x;\n" @@ -3270,7 +3270,7 @@ private: functionVariableUsage("void f() {\n" " std::vector x(100);\n" "}"); - TODO_ASSERT_EQUALS("[test.cpp:2]: (style) Variable 'x' is assigned a value that is never used\n", "", errout.str()); + TODO_ASSERT_EQUALS("[test.cpp:2]: (style) Variable 'x' is assigned a value that is never used.\n", "", errout.str()); functionVariableUsage("void f() {\n" " std::vector x;\n"