CheckOther: Removed old zero division check

This commit is contained in:
Daniel Marjamäki 2014-01-20 06:31:13 +01:00
parent 7ff7bc1c2e
commit add84187cc
1 changed files with 3 additions and 7 deletions

View File

@ -2173,13 +2173,9 @@ void CheckOther::strPlusCharError(const Token *tok)
void CheckOther::checkZeroDivision() void CheckOther::checkZeroDivision()
{ {
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) { for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) {
if (Token::Match(tok, "[/%] %num%") && if (Token::Match(tok, "div|ldiv|lldiv|imaxdiv ( %num% , %num% )") &&
MathLib::isInt(tok->next()->str()) && MathLib::isInt(tok->strAt(4)) &&
MathLib::toLongNumber(tok->next()->str()) == 0L) { MathLib::toLongNumber(tok->strAt(4)) == 0L) {
zerodivError(tok);
} else if (Token::Match(tok, "div|ldiv|lldiv|imaxdiv ( %num% , %num% )") &&
MathLib::isInt(tok->strAt(4)) &&
MathLib::toLongNumber(tok->strAt(4)) == 0L) {
if (tok->str() == "div") { if (tok->str() == "div") {
if (tok->strAt(-1) == ".") if (tok->strAt(-1) == ".")
continue; continue;