don't print warning message if --enable=warning is not given.
message was of type: (warning) Passing value 0 to foo() leads to implementation-defined result.
This commit is contained in:
parent
592177200a
commit
988acf11b4
|
@ -1872,6 +1872,7 @@ void CheckOther::nanInArithmeticExpressionError(const Token *tok)
|
|||
void CheckOther::checkMathFunctions()
|
||||
{
|
||||
bool styleC99 = _settings->isEnabled("style") && _settings->standards.c != Standards::C89 && _settings->standards.cpp != Standards::CPP03;
|
||||
bool printWarnings = _settings->isEnabled("warning");
|
||||
|
||||
const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
|
||||
const std::size_t functions = symbolDatabase->functionScopes.size();
|
||||
|
@ -1880,6 +1881,7 @@ void CheckOther::checkMathFunctions()
|
|||
for (const Token* tok = scope->classStart->next(); tok != scope->classEnd; tok = tok->next()) {
|
||||
if (tok->varId())
|
||||
continue;
|
||||
if (printWarnings) {
|
||||
if (tok->strAt(-1) != "."
|
||||
&& Token::Match(tok, "log|logf|logl|log10|log10f|log10l ( %num% )")) {
|
||||
const std::string& number = tok->strAt(2);
|
||||
|
@ -1923,6 +1925,7 @@ void CheckOther::checkMathFunctions()
|
|||
if (MathLib::isNullValue(tok->strAt(2)) && MathLib::isNegative(tok->strAt(4)))
|
||||
mathfunctionCallWarning(tok, 2);
|
||||
}
|
||||
}
|
||||
|
||||
if (styleC99) {
|
||||
if (Token::Match(tok, "%num% - erf (") && Tokenizer::isOneNumber(tok->str()) && tok->next()->astOperand2() == tok->tokAt(3)) {
|
||||
|
|
Loading…
Reference in New Issue