Removed unused function expressionsHasSideEffects()

This commit is contained in:
Daniel Marjamäki 2014-04-04 07:04:19 +02:00
parent 71fda0ea0c
commit 0788e64eb8
1 changed files with 0 additions and 25 deletions

View File

@ -2535,31 +2535,6 @@ void CheckOther::incorrectStringBooleanError(const Token *tok, const std::string
reportError(tok, Severity::warning, "incorrectStringBooleanError", "Conversion of string literal " + string + " to bool always evaluates to true.");
}
//-----------------------------------------------------------------------------
// check for duplicate expressions in if statements
// if (a) { } else if (a) { }
//-----------------------------------------------------------------------------
static bool expressionHasSideEffects(const Token *first, const Token *last)
{
for (const Token *tok = first; tok != last->next(); tok = tok->next()) {
// check for assignment
if (tok->isAssignmentOp())
return true;
// check for inc/dec
else if (tok->type() == Token::eIncDecOp)
return true;
// check for function call
else if (Token::Match(tok, "%var% (") &&
!(Token::Match(tok, "c_str|string") || tok->isStandardType()))
return true;
}
return false;
}
//-----------------------------------------------------------------------------
// check for duplicate code in if and else branches
// if (a) { b = true; } else { b = true; }