diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 10ea2d913..0ef1aa445 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -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; }