Merge branch '2390b' of https://github.com/elfring/cppcheck into elfring-2390b

This commit is contained in:
Daniel Marjamäki 2011-03-12 11:58:24 +01:00
commit 29ab409af5
2 changed files with 5 additions and 5 deletions

View File

@ -3073,8 +3073,8 @@ void CheckOther::variableScopeError(const Token *tok, const std::string &varname
reportError(tok,
Severity::information,
"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 "
"The scope of the variable '" + varname + "' can be reduced\n"
"The scope of the variable '" + varname + "' can be reduced. Warning: It can be unsafe "
"to fix this message. Be careful. Especially when there are inner loops. Here is an "
"example where cppcheck will write that the scope for 'i' can be reduced:\n"
"void f(int x)\n"

View File

@ -547,7 +547,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]: (information) The scope of the variable 'i' can be reduced\n", errout.str());
varScope("void f(int x)\n"
"{\n"
@ -557,7 +557,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]: (information) The scope of the variable 'i' can be reduced\n", errout.str());
}
void varScope6()
@ -623,7 +623,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]: (information) The scope of the variable 'edgeResistance' can be reduced\n", errout.str());
}
void varScope9()