Fixed #2302 (Duplicate id 'unusedVariable')
This commit is contained in:
parent
d341b42b0c
commit
e6a1efa13b
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue