Fixed #2302 (Duplicate id 'unusedVariable')

This commit is contained in:
Daniel Marjamäki 2011-01-16 18:45:05 +01:00
parent d341b42b0c
commit e6a1efa13b
2 changed files with 13 additions and 1 deletions

View File

@ -1875,7 +1875,7 @@ void CheckOther::unusedVariableError(const Token *tok, const std::string &varnam
void CheckOther::allocatedButUnusedVariableError(const Token *tok, const std::string &varname)
{
reportError(tok, Severity::style, "unusedVariable", "Variable '" + varname + "' is allocated memory that is never used");
reportError(tok, Severity::style, "unusedAllocatedMemory", "Variable '" + varname + "' is allocated memory that is never used");
}
void CheckOther::unreadVariableError(const Token *tok, const std::string &varname)

View File

@ -77,6 +77,18 @@ private:
ASSERT(!errorLogger.id.empty());
// TODO: check if there are duplicate error ids in errorLogger.id
std::string duplicate;
for (std::list<std::string>::iterator it = errorLogger.id.begin();
it != errorLogger.id.end();
++it)
{
if (std::find(errorLogger.id.begin(), it, *it) != it)
{
duplicate = "Duplicate ID: " + *it;
break;
}
}
ASSERT_EQUALS("", duplicate);
}
};