From 5e8fe9d0a544c91fd9fc4282618145c47ae740d8 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 20 Oct 2025 13:04:01 +0200 Subject: [PATCH 1/7] Update checkstl.cpp --- lib/checkstl.cpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lib/checkstl.cpp b/lib/checkstl.cpp index a88591a904a..2efce9fe5f6 100644 --- a/lib/checkstl.cpp +++ b/lib/checkstl.cpp @@ -370,15 +370,6 @@ void CheckStl::iteratorsError(const Token* tok, const std::string& containerName "Same iterator is used with different containers '" + containerName1 + "' and '" + containerName2 + "'.", CWE664, Certainty::normal); } -void CheckStl::iteratorsError(const Token* tok, const Token* containerTok, const std::string& containerName1, const std::string& containerName2) -{ - std::list callstack = { tok, containerTok }; - reportError(callstack, Severity::error, "iterators2", - "$symbol:" + containerName1 + "\n" - "$symbol:" + containerName2 + "\n" - "Same iterator is used with different containers '" + containerName1 + "' and '" + containerName2 + "'.", CWE664, Certainty::normal); -} - void CheckStl::iteratorsError(const Token* tok, const Token* containerTok, const std::string& containerName) { std::list callstack = { tok, containerTok }; @@ -3453,7 +3444,6 @@ void CheckStl::getErrorMessages(ErrorLogger* errorLogger, const Settings* settin c.outOfBoundsError(nullptr, "container", nullptr, "x", nullptr); c.invalidIteratorError(nullptr, "iterator"); c.iteratorsError(nullptr, "container1", "container2"); - c.iteratorsError(nullptr, nullptr, "container0", "container1"); c.iteratorsError(nullptr, nullptr, "container"); c.invalidContainerLoopError(nullptr, nullptr, ErrorPath{}); c.invalidContainerError(nullptr, nullptr, nullptr, ErrorPath{}); From bcd5aa6143998ebc7082c9a38c7346c14dbf9e97 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 20 Oct 2025 13:04:43 +0200 Subject: [PATCH 2/7] Update checkstl.h --- lib/checkstl.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/checkstl.h b/lib/checkstl.h index 9e56ee1b1d3..60b9d4c7000 100644 --- a/lib/checkstl.h +++ b/lib/checkstl.h @@ -176,7 +176,6 @@ class CPPCHECKLIB CheckStl : public Check { void negativeIndexError(const Token* tok, const ValueFlow::Value& index); void invalidIteratorError(const Token* tok, const std::string& iteratorName); void iteratorsError(const Token* tok, const std::string& containerName1, const std::string& containerName2); - void iteratorsError(const Token* tok, const Token* containerTok, const std::string& containerName1, const std::string& containerName2); void iteratorsError(const Token* tok, const Token* containerTok, const std::string& containerName); void mismatchingContainerIteratorError(const Token* containerTok, const Token* iterTok, const Token* containerTok2); void mismatchingContainersError(const Token* tok1, const Token* tok2); From f1ce37c0cf6dddd7f2318e3d941d7da43acb859c Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 20 Oct 2025 13:06:00 +0200 Subject: [PATCH 3/7] Update checkinternal.cpp --- lib/checkinternal.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lib/checkinternal.cpp b/lib/checkinternal.cpp index d1130c90031..f289044b102 100644 --- a/lib/checkinternal.cpp +++ b/lib/checkinternal.cpp @@ -337,13 +337,6 @@ void CheckInternal::checkExtraWhitespace() } } -void CheckInternal::multiComparePatternError(const Token* tok, const std::string& pattern, const std::string &funcname) -{ - reportError(tok, Severity::error, "multiComparePatternError", - "Bad multicompare pattern (a %cmd% must be first unless it is %or%,%op%,%cop%,%name%,%oror%) inside Token::" + funcname + "() call: \"" + pattern + "\"" - ); -} - void CheckInternal::simplePatternError(const Token* tok, const std::string& pattern, const std::string &funcname) { reportError(tok, Severity::warning, "simplePatternError", @@ -409,7 +402,6 @@ void CheckInternal::runChecks(const Tokenizer &tokenizer, ErrorLogger *errorLogg void CheckInternal::getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { CheckInternal c(nullptr, settings, errorLogger); - c.multiComparePatternError(nullptr, ";|%type%", "Match"); c.simplePatternError(nullptr, "class {", "Match"); c.complexPatternError(nullptr, "%type% ( )", "Match"); c.missingPercentCharacterError(nullptr, "%num", "Match"); From 69f1d8fc52018f13bf0490c40eb7776a16934acf Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 20 Oct 2025 13:06:26 +0200 Subject: [PATCH 4/7] Update checkinternal.h --- lib/checkinternal.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/checkinternal.h b/lib/checkinternal.h index bb58f09ea93..1fc97bcb247 100644 --- a/lib/checkinternal.h +++ b/lib/checkinternal.h @@ -70,7 +70,6 @@ class CPPCHECKLIB CheckInternal : public Check { /** @brief %Check if there is a redundant check for none-nullness of parameter before Match functions, such as (tok && Token::Match(tok, "foo")) */ void checkRedundantTokCheck(); - void multiComparePatternError(const Token *tok, const std::string &pattern, const std::string &funcname); void simplePatternError(const Token *tok, const std::string &pattern, const std::string &funcname); void complexPatternError(const Token *tok, const std::string &pattern, const std::string &funcname); void missingPercentCharacterError(const Token *tok, const std::string &pattern, const std::string &funcname); From d51b6582ec8c6c00440587f2bccb0dcb25bfbe65 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 20 Oct 2025 13:07:12 +0200 Subject: [PATCH 5/7] Update tokenize.h --- lib/tokenize.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/tokenize.h b/lib/tokenize.h index bf6b3e8965b..272d28ce34c 100644 --- a/lib/tokenize.h +++ b/lib/tokenize.h @@ -390,7 +390,6 @@ class CPPCHECKLIB Tokenizer { /** Check configuration (unknown macros etc) */ void checkConfiguration() const; - void macroWithSemicolonError(const Token *tok, const std::string ¯oName) const; void invalidConstFunctionTypeError(const Token *tok) const; From 7976e2ebb381425ffbae85f63d29968047da11df Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 20 Oct 2025 13:11:02 +0200 Subject: [PATCH 6/7] Update tokenize.cpp --- lib/tokenize.cpp | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index d45a7f0f351..fd253a2f1ad 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -5631,8 +5631,6 @@ bool Tokenizer::simplifyTokenList1(const char FileName[]) findGarbageCode(); }); - checkConfiguration(); - // if (x) MACRO() .. for (const Token *tok = list.front(); tok; tok = tok->next()) { if (Token::simpleMatch(tok, "if (")) { @@ -8219,14 +8217,6 @@ void Tokenizer::unhandled_macro_class_x_y(const Token *tok, const std::string& t bracket + "' is not handled. You can use -I or --include to add handling of this code."); } -void Tokenizer::macroWithSemicolonError(const Token *tok, const std::string ¯oName) const -{ - reportError(tok, - Severity::information, - "macroWithSemicolon", - "Ensure that '" + macroName + "' is defined either using -I, --include or -D."); -} - void Tokenizer::invalidConstFunctionTypeError(const Token *tok) const { reportError(tok, @@ -8287,25 +8277,6 @@ bool Tokenizer::isOneNumber(const std::string &s) return isNumberOneOf(s, 1L, "1.0"); } // ------------------------------------------------------------------------ -void Tokenizer::checkConfiguration() const -{ - if (!mSettings.checkConfiguration) - return; - for (const Token *tok = tokens(); tok; tok = tok->next()) { - if (!Token::Match(tok, "%name% (")) - continue; - if (tok->isControlFlowKeyword()) - continue; - for (const Token *tok2 = tok->tokAt(2); tok2 && tok2->str() != ")"; tok2 = tok2->next()) { - if (tok2->str() == ";") { - macroWithSemicolonError(tok, tok->str()); - break; - } - if (Token::Match(tok2, "(|{")) - tok2 = tok2->link(); - } - } -} void Tokenizer::validateC() const { @@ -11033,6 +11004,5 @@ void Tokenizer::getErrorMessages(ErrorLogger& errorLogger, const Settings& setti tokenizer.invalidConstFunctionTypeError(nullptr); // checkLibraryNoReturn tokenizer.unhandled_macro_class_x_y(nullptr, "", "", "", ""); - tokenizer.macroWithSemicolonError(nullptr, ""); tokenizer.unhandledCharLiteral(nullptr, ""); } From e7171acfdc882036cf674cd5e516025a65d51422 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 20 Oct 2025 13:13:24 +0200 Subject: [PATCH 7/7] Update tokenize.h --- lib/tokenize.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/tokenize.h b/lib/tokenize.h index 272d28ce34c..4a248b8fb97 100644 --- a/lib/tokenize.h +++ b/lib/tokenize.h @@ -388,9 +388,6 @@ class CPPCHECKLIB Tokenizer { /** Report that there is an unhandled "class x y {" code */ void unhandled_macro_class_x_y(const Token *tok, const std::string& type, const std::string& x, const std::string& y, const std::string& bracket) const; - /** Check configuration (unknown macros etc) */ - void checkConfiguration() const; - void invalidConstFunctionTypeError(const Token *tok) const; /**