Skip to content

Commit 0ff234b

Browse files
Fix #11604 Debug: DacaWrongData (#8752)
Co-authored-by: chrchr-github <noreply@github.com>
1 parent 0630d8a commit 0ff234b

5 files changed

Lines changed: 3 additions & 19 deletions

File tree

lib/check.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ class Settings;
3939
class ErrorLogger;
4040
class Tokenizer;
4141

42-
/** Use WRONG_DATA in checkers to mark conditions that check that data is correct */
43-
#define WRONG_DATA(COND, TOK) ((COND) && wrongData((TOK), #COND))
44-
4542
/// @addtogroup Core
4643
/// @{
4744

lib/checkclass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,7 @@ void CheckClassImpl::initializationListUsage()
12511251
continue;
12521252
if (var->isPointer() || var->isReference() || var->isEnumType())
12531253
continue;
1254-
if (!WRONG_DATA(!var->valueType(), tok) && var->valueType()->type > ValueType::Type::ITERATOR)
1254+
if (!var->valueType() || var->valueType()->type > ValueType::Type::ITERATOR)
12551255
continue;
12561256

12571257
// bailout: multi line lambda in rhs => do not warn

lib/checkfunctions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,9 +543,9 @@ void CheckFunctionsImpl::memsetZeroBytes()
543543
const SymbolDatabase *symbolDatabase = mTokenizer->getSymbolDatabase();
544544
for (const Scope *scope : symbolDatabase->functionScopes) {
545545
for (const Token* tok = scope->bodyStart->next(); tok != scope->bodyEnd; tok = tok->next()) {
546-
if (Token::Match(tok, "memset|wmemset (") && (numberOfArguments(tok)==3)) {
546+
if (Token::Match(tok, "memset|wmemset (")) {
547547
const std::vector<const Token *> &arguments = getArguments(tok);
548-
if (WRONG_DATA(arguments.size() != 3U, tok))
548+
if (arguments.size() != 3U)
549549
continue;
550550
const Token* lastParamTok = arguments[2];
551551
if (MathLib::isNullValue(lastParamTok->str()))

lib/checkimpl.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@ void CheckImpl::reportError(ErrorPath errorPath, Severity severity, const char i
4040
mErrorLogger.reportErr(errmsg);
4141
}
4242

43-
bool CheckImpl::wrongData(const Token *tok, const char *str)
44-
{
45-
if (mSettings.daca)
46-
reportError(tok, Severity::debug, "DacaWrongData", "Wrong data detected by condition " + std::string(str));
47-
return true;
48-
}
49-
5043
ErrorPath CheckImpl::getErrorPath(const Token* errtok, const ValueFlow::Value* value, std::string bug) const
5144
{
5245
ErrorPath errorPath;

lib/checkimpl.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,6 @@ class CPPCHECKLIB CheckImpl
7272

7373
ErrorPath getErrorPath(const Token* errtok, const ValueFlow::Value* value, std::string bug) const;
7474

75-
/**
76-
* Use WRONG_DATA in checkers when you check for wrong data. That
77-
* will call this method
78-
*/
79-
bool wrongData(const Token *tok, const char *str);
80-
8175
public: // TODO: should be protected
8276
void logChecker(const char id[]);
8377
};

0 commit comments

Comments
 (0)