Removed unused function expressionsHasSideEffects()
This commit is contained in:
parent
71fda0ea0c
commit
0788e64eb8
|
@ -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.");
|
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
|
// check for duplicate code in if and else branches
|
||||||
// if (a) { b = true; } else { b = true; }
|
// if (a) { b = true; } else { b = true; }
|
||||||
|
|
Loading…
Reference in New Issue