#5748: Fixed FP (wrongmathcall) do not warn if an object calls a function foo.log(0).

This commit is contained in:
orbitcowboy 2014-04-23 01:23:38 +02:00
parent fc24d491cc
commit a6af8f5dcf
2 changed files with 6 additions and 1 deletions

View File

@ -2345,7 +2345,8 @@ void CheckOther::checkMathFunctions()
for (const Token* tok = scope->classStart->next(); tok != scope->classEnd; tok = tok->next()) {
if (tok->varId())
continue;
if (Token::Match(tok, "log|logf|logl|log10|log10f|log10l ( %num% )")) {
if (!Token::Match(tok->previous(),".|->")
&& Token::Match(tok, "log|logf|logl|log10|log10f|log10l ( %num% )")) {
bool isNegative = MathLib::isNegative(tok->strAt(2));
bool isInt = MathLib::isInt(tok->strAt(2));
bool isFloat = MathLib::isFloat(tok->strAt(2));

View File

@ -1651,6 +1651,10 @@ private:
// #3473 - no warning if "log" is a variable
check("Fred::Fred() : log(0) { }");
ASSERT_EQUALS("", errout.str());
// #5748
check("void f() { foo.log(0); }");
ASSERT_EQUALS("", errout.str());
}
void mathfunctionCall_acos() {