zero division: it's an error

This commit is contained in:
Daniel Marjamäki 2009-03-29 18:47:05 +02:00
parent e45bb20f92
commit d7aee72fcd
3 changed files with 6 additions and 6 deletions

View File

@ -967,7 +967,7 @@ 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::simpleMatch(tok, "/ 0")) if (Token::simpleMatch(tok, "/ 0"))
zerodivWarning(tok); zerodivError(tok);
} }
} }
@ -1064,7 +1064,7 @@ void CheckOther::nullPointerError(const Token *tok)
reportError(tok, "error", "nullPointer", "Possible null pointer dereference"); reportError(tok, "error", "nullPointer", "Possible null pointer dereference");
} }
void CheckOther::zerodivWarning(const Token *tok) void CheckOther::zerodivError(const Token *tok)
{ {
reportError(tok, "style", "zerodivWarning", "Warning: Division with zero"); reportError(tok, "error", "zerodiv", "Division with zero");
} }

View File

@ -144,7 +144,7 @@ private:
void strPlusChar(const Token *tok); void strPlusChar(const Token *tok);
void returnLocalVariable(const Token *tok); void returnLocalVariable(const Token *tok);
void nullPointerError(const Token *tok); void nullPointerError(const Token *tok);
void zerodivWarning(const Token *tok); void zerodivError(const Token *tok);
void getErrorMessages() void getErrorMessages()
{ {
@ -166,7 +166,7 @@ private:
strPlusChar(0); strPlusChar(0);
returnLocalVariable(0); returnLocalVariable(0);
nullPointerError(0); nullPointerError(0);
zerodivWarning(0); zerodivError(0);
} }
}; };

View File

@ -93,7 +93,7 @@ private:
"}"); "}");
ASSERT_EQUALS(std::string("[test.cpp:5]: (style) Warning: Division with zero\n"), errout.str()); ASSERT_EQUALS(std::string("[test.cpp:5]: (error) Division with zero\n"), errout.str());
} }
void zeroDiv2() void zeroDiv2()