#5748: Fixed FP (wrongmathcall) do not warn if an object calls a function foo.log(0).
This commit is contained in:
parent
fc24d491cc
commit
a6af8f5dcf
|
@ -2345,7 +2345,8 @@ void CheckOther::checkMathFunctions()
|
||||||
for (const Token* tok = scope->classStart->next(); tok != scope->classEnd; tok = tok->next()) {
|
for (const Token* tok = scope->classStart->next(); tok != scope->classEnd; tok = tok->next()) {
|
||||||
if (tok->varId())
|
if (tok->varId())
|
||||||
continue;
|
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 isNegative = MathLib::isNegative(tok->strAt(2));
|
||||||
bool isInt = MathLib::isInt(tok->strAt(2));
|
bool isInt = MathLib::isInt(tok->strAt(2));
|
||||||
bool isFloat = MathLib::isFloat(tok->strAt(2));
|
bool isFloat = MathLib::isFloat(tok->strAt(2));
|
||||||
|
|
|
@ -1651,6 +1651,10 @@ private:
|
||||||
// #3473 - no warning if "log" is a variable
|
// #3473 - no warning if "log" is a variable
|
||||||
check("Fred::Fred() : log(0) { }");
|
check("Fred::Fred() : log(0) { }");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
// #5748
|
||||||
|
check("void f() { foo.log(0); }");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void mathfunctionCall_acos() {
|
void mathfunctionCall_acos() {
|
||||||
|
|
Loading…
Reference in New Issue