astyle fix

This commit is contained in:
Reijo Tomperi 2010-04-05 20:57:54 +03:00
parent 218c18496d
commit 04b38e5428
3 changed files with 13 additions and 13 deletions

View File

@ -2563,18 +2563,18 @@ void CheckOther::checkMathFunctions()
{
mathfunctionCallError(tok);
}
// atan2 ( x , y): x and y can not be zero, because this is mathematically not defined
// atan2 ( x , y): x and y can not be zero, because this is mathematically not defined
else if (Token::Match(tok, "atan2 ( %num% , %num% )") &&
MathLib::isNullValue(tok->tokAt(2)->str()) &&
MathLib::isNullValue(tok->tokAt(4)->str()))
MathLib::isNullValue(tok->tokAt(4)->str()))
{
mathfunctionCallError(tok,2);
mathfunctionCallError(tok, 2);
}
// fmod ( x , y) If y is zero, then either a range error will occur or the function will return zero (implementation-defined).
// fmod ( x , y) If y is zero, then either a range error will occur or the function will return zero (implementation-defined).
else if (Token::Match(tok, "fmod ( %num% , %num% )") &&
MathLib::isNullValue(tok->tokAt(4)->str()))
MathLib::isNullValue(tok->tokAt(4)->str()))
{
mathfunctionCallError(tok,2);
mathfunctionCallError(tok, 2);
}
}
@ -2728,11 +2728,11 @@ void CheckOther::mathfunctionCallError(const Token *tok, const unsigned int numP
{
if (tok)
{
if(numParam == 1)
reportError(tok, Severity::error, "wrongmathcall", "Passing value " + tok->tokAt(2)->str() + " to " + tok->str() + "() leads to undefined result");
else if (numParam == 2)
reportError(tok, Severity::error, "wrongmathcall", "Passing value " + tok->tokAt(2)->str() + " and " + tok->tokAt(4)->str() + " to " + tok->str() + "() leads to undefined result");
}
if (numParam == 1)
reportError(tok, Severity::error, "wrongmathcall", "Passing value " + tok->tokAt(2)->str() + " to " + tok->str() + "() leads to undefined result");
else if (numParam == 2)
reportError(tok, Severity::error, "wrongmathcall", "Passing value " + tok->tokAt(2)->str() + " and " + tok->tokAt(4)->str() + " to " + tok->str() + "() leads to undefined result");
}
else
reportError(tok, Severity::error, "wrongmathcall", "Passing value " " to " "() leads to undefined result");
}

View File

@ -189,7 +189,7 @@ public:
void uninitdataError(const Token *tok, const std::string &varname);
void uninitvarError(const Token *tok, const std::string &varname);
void zerodivError(const Token *tok);
void mathfunctionCallError(const Token *tok, const unsigned int numParam=1);
void mathfunctionCallError(const Token *tok, const unsigned int numParam = 1);
void postIncrementError(const Token *tok, const std::string &var_name, const bool isIncrement);
void getErrorMessages()

View File

@ -300,7 +300,7 @@ bool MathLib::isGreater(const std::string &first, const std::string &second)
bool MathLib::isNullValue(const std::string &str)
{
return (str == "-0" || str == "-0.0"
|| str == "0"
|| str == "0"
|| str == "-0." || str == "-0E-00"
|| str == "-0E+00" || str == "+0E+00"
|| str == "+0E-00" || str == "+0"