diff --git a/lib/check.cpp b/lib/check.cpp index 0b78a4b9f..dc4385e4e 100644 --- a/lib/check.cpp +++ b/lib/check.cpp @@ -64,17 +64,11 @@ void Check::reportError(const ErrorPath &errorPath, Severity::SeverityType sever reportError(errmsg); } -bool Check::wrongData(const Token *tok, bool condition, const char *str) +bool Check::wrongData(const Token *tok, const char *str) { -#if defined(DACA2) || defined(UNSTABLE) - if (condition) { + if (mSettings->daca) reportError(tok, Severity::debug, "DacaWrongData", "Wrong data detected by condition " + std::string(str)); - } -#else - (void)tok; - (void)str; -#endif - return condition; + return true; } std::list &Check::instances() @@ -115,4 +109,4 @@ ErrorPath Check::getErrorPath(const Token* errtok, const ValueFlow::Value* value errorPath.emplace_back(errtok, bug); } return errorPath; -} \ No newline at end of file +} diff --git a/lib/check.h b/lib/check.h index 8e1d1c979..a5ebb3c90 100644 --- a/lib/check.h +++ b/lib/check.h @@ -46,7 +46,7 @@ class ErrorMessage; class Tokenizer; /** Use WRONG_DATA in checkers to mark conditions that check that data is correct */ -#define WRONG_DATA(COND, TOK) (wrongData((TOK), (COND), #COND)) +#define WRONG_DATA(COND, TOK) ((COND) && wrongData((TOK), #COND)) /// @addtogroup Core /// @{ @@ -158,7 +158,7 @@ protected: * Use WRONG_DATA in checkers when you check for wrong data. That * will call this method */ - bool wrongData(const Token *tok, bool condition, const char *str); + bool wrongData(const Token *tok, const char *str); /** disabled assignment operator and copy constructor */ void operator=(const Check &) = delete;