diff --git a/lib/check.h b/lib/check.h index 00a360d1bf2..7adde886f7f 100644 --- a/lib/check.h +++ b/lib/check.h @@ -39,9 +39,6 @@ class Settings; class ErrorLogger; class Tokenizer; -/** Use WRONG_DATA in checkers to mark conditions that check that data is correct */ -#define WRONG_DATA(COND, TOK) ((COND) && wrongData((TOK), #COND)) - /// @addtogroup Core /// @{ diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index 51d5718159f..c1069670665 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -1248,7 +1248,7 @@ void CheckClassImpl::initializationListUsage() continue; if (var->isPointer() || var->isReference() || var->isEnumType()) continue; - if (!WRONG_DATA(!var->valueType(), tok) && var->valueType()->type > ValueType::Type::ITERATOR) + if (!var->valueType() || var->valueType()->type > ValueType::Type::ITERATOR) continue; // bailout: multi line lambda in rhs => do not warn diff --git a/lib/checkfunctions.cpp b/lib/checkfunctions.cpp index 23db248816d..e5a6202d492 100644 --- a/lib/checkfunctions.cpp +++ b/lib/checkfunctions.cpp @@ -536,9 +536,9 @@ void CheckFunctionsImpl::memsetZeroBytes() const SymbolDatabase *symbolDatabase = mTokenizer->getSymbolDatabase(); for (const Scope *scope : symbolDatabase->functionScopes) { for (const Token* tok = scope->bodyStart->next(); tok != scope->bodyEnd; tok = tok->next()) { - if (Token::Match(tok, "memset|wmemset (") && (numberOfArguments(tok)==3)) { + if (Token::Match(tok, "memset|wmemset (")) { const std::vector &arguments = getArguments(tok); - if (WRONG_DATA(arguments.size() != 3U, tok)) + if (arguments.size() != 3U) continue; const Token* lastParamTok = arguments[2]; if (MathLib::isNullValue(lastParamTok->str())) diff --git a/lib/checkimpl.cpp b/lib/checkimpl.cpp index fb1c71a66b3..99954315d26 100644 --- a/lib/checkimpl.cpp +++ b/lib/checkimpl.cpp @@ -40,13 +40,6 @@ void CheckImpl::reportError(ErrorPath errorPath, Severity severity, const char i mErrorLogger.reportErr(errmsg); } -bool CheckImpl::wrongData(const Token *tok, const char *str) -{ - if (mSettings.daca) - reportError(tok, Severity::debug, "DacaWrongData", "Wrong data detected by condition " + std::string(str)); - return true; -} - ErrorPath CheckImpl::getErrorPath(const Token* errtok, const ValueFlow::Value* value, std::string bug) const { ErrorPath errorPath; diff --git a/lib/checkimpl.h b/lib/checkimpl.h index 17f92da8553..aeff9bfca21 100644 --- a/lib/checkimpl.h +++ b/lib/checkimpl.h @@ -72,12 +72,6 @@ class CPPCHECKLIB CheckImpl ErrorPath getErrorPath(const Token* errtok, const ValueFlow::Value* value, std::string bug) const; - /** - * Use WRONG_DATA in checkers when you check for wrong data. That - * will call this method - */ - bool wrongData(const Token *tok, const char *str); - public: // TODO: should be protected void logChecker(const char id[]); };