parent
725c431ecc
commit
3281fc91db
|
@ -41,22 +41,22 @@ void CheckStatistics::addItem(const QString &tool, ShowTypes::ShowType type)
|
||||||
const QString lower = tool.toLower();
|
const QString lower = tool.toLower();
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ShowTypes::ShowStyle:
|
case ShowTypes::ShowStyle:
|
||||||
::addItem(mStyle, tool);
|
::addItem(mStyle, lower);
|
||||||
break;
|
break;
|
||||||
case ShowTypes::ShowWarnings:
|
case ShowTypes::ShowWarnings:
|
||||||
::addItem(mWarning, tool);
|
::addItem(mWarning, lower);
|
||||||
break;
|
break;
|
||||||
case ShowTypes::ShowPerformance:
|
case ShowTypes::ShowPerformance:
|
||||||
::addItem(mPerformance, tool);
|
::addItem(mPerformance, lower);
|
||||||
break;
|
break;
|
||||||
case ShowTypes::ShowPortability:
|
case ShowTypes::ShowPortability:
|
||||||
::addItem(mPortability, tool);
|
::addItem(mPortability, lower);
|
||||||
break;
|
break;
|
||||||
case ShowTypes::ShowErrors:
|
case ShowTypes::ShowErrors:
|
||||||
::addItem(mError, tool);
|
::addItem(mError, lower);
|
||||||
break;
|
break;
|
||||||
case ShowTypes::ShowInformation:
|
case ShowTypes::ShowInformation:
|
||||||
::addItem(mInformation, tool);
|
::addItem(mInformation, lower);
|
||||||
break;
|
break;
|
||||||
case ShowTypes::ShowNone:
|
case ShowTypes::ShowNone:
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -1361,7 +1361,7 @@ void CheckUnusedVar::checkFunctionVariableUsage()
|
||||||
else if (!usage._var->isMaybeUnused() && !usage._modified && !usage._read && var) {
|
else if (!usage._var->isMaybeUnused() && !usage._modified && !usage._read && var) {
|
||||||
const Token* vnt = var->nameToken();
|
const Token* vnt = var->nameToken();
|
||||||
bool error = false;
|
bool error = false;
|
||||||
if (vnt->next()->isSplittedVarDeclEq()) {
|
if (vnt->next()->isSplittedVarDeclEq() || (!var->isReference() && vnt->next()->str() == "=")) {
|
||||||
const Token* nextStmt = vnt->tokAt(2);
|
const Token* nextStmt = vnt->tokAt(2);
|
||||||
if (nextStmt->isExpandedMacro()) {
|
if (nextStmt->isExpandedMacro()) {
|
||||||
const Token* parent = nextStmt;
|
const Token* parent = nextStmt;
|
||||||
|
|
|
@ -5689,9 +5689,8 @@ private:
|
||||||
"{\n"
|
"{\n"
|
||||||
" static int i = 0;\n"
|
" static int i = 0;\n"
|
||||||
"}");
|
"}");
|
||||||
TODO_ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used.\n",
|
ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'i' is assigned a value that is never used.\n",
|
||||||
"",
|
errout.str());
|
||||||
errout.str());
|
|
||||||
|
|
||||||
functionVariableUsage("void foo()\n"
|
functionVariableUsage("void foo()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
@ -6305,6 +6304,15 @@ private:
|
||||||
" const ::std::lock_guard g(m);\n"
|
" const ::std::lock_guard g(m);\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
functionVariableUsage("void f(const std::string& str, int i) {\n" // #11879
|
||||||
|
" const std::string s = str;\n"
|
||||||
|
" switch (i) {\n"
|
||||||
|
" default:\n"
|
||||||
|
" break;\n"
|
||||||
|
" }\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("[test.cpp:2]: (style) Variable 's' is assigned a value that is never used.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void localVarClass() {
|
void localVarClass() {
|
||||||
|
|
Loading…
Reference in New Issue