Skip to content

Commit a53c164

Browse files
Fix #13729, #13856, #13860 Remove unused error IDs (#7900)
1 parent ec11793 commit a53c164

File tree

6 files changed

+0
-54
lines changed

6 files changed

+0
-54
lines changed

lib/checkinternal.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -337,13 +337,6 @@ void CheckInternal::checkExtraWhitespace()
337337
}
338338
}
339339

340-
void CheckInternal::multiComparePatternError(const Token* tok, const std::string& pattern, const std::string &funcname)
341-
{
342-
reportError(tok, Severity::error, "multiComparePatternError",
343-
"Bad multicompare pattern (a %cmd% must be first unless it is %or%,%op%,%cop%,%name%,%oror%) inside Token::" + funcname + "() call: \"" + pattern + "\""
344-
);
345-
}
346-
347340
void CheckInternal::simplePatternError(const Token* tok, const std::string& pattern, const std::string &funcname)
348341
{
349342
reportError(tok, Severity::warning, "simplePatternError",
@@ -409,7 +402,6 @@ void CheckInternal::runChecks(const Tokenizer &tokenizer, ErrorLogger *errorLogg
409402
void CheckInternal::getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const
410403
{
411404
CheckInternal c(nullptr, settings, errorLogger);
412-
c.multiComparePatternError(nullptr, ";|%type%", "Match");
413405
c.simplePatternError(nullptr, "class {", "Match");
414406
c.complexPatternError(nullptr, "%type% ( )", "Match");
415407
c.missingPercentCharacterError(nullptr, "%num", "Match");

lib/checkinternal.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ class CPPCHECKLIB CheckInternal : public Check {
7070
/** @brief %Check if there is a redundant check for none-nullness of parameter before Match functions, such as (tok && Token::Match(tok, "foo")) */
7171
void checkRedundantTokCheck();
7272

73-
void multiComparePatternError(const Token *tok, const std::string &pattern, const std::string &funcname);
7473
void simplePatternError(const Token *tok, const std::string &pattern, const std::string &funcname);
7574
void complexPatternError(const Token *tok, const std::string &pattern, const std::string &funcname);
7675
void missingPercentCharacterError(const Token *tok, const std::string &pattern, const std::string &funcname);

lib/checkstl.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -370,15 +370,6 @@ void CheckStl::iteratorsError(const Token* tok, const std::string& containerName
370370
"Same iterator is used with different containers '" + containerName1 + "' and '" + containerName2 + "'.", CWE664, Certainty::normal);
371371
}
372372

373-
void CheckStl::iteratorsError(const Token* tok, const Token* containerTok, const std::string& containerName1, const std::string& containerName2)
374-
{
375-
std::list<const Token*> callstack = { tok, containerTok };
376-
reportError(callstack, Severity::error, "iterators2",
377-
"$symbol:" + containerName1 + "\n"
378-
"$symbol:" + containerName2 + "\n"
379-
"Same iterator is used with different containers '" + containerName1 + "' and '" + containerName2 + "'.", CWE664, Certainty::normal);
380-
}
381-
382373
void CheckStl::iteratorsError(const Token* tok, const Token* containerTok, const std::string& containerName)
383374
{
384375
std::list<const Token*> callstack = { tok, containerTok };
@@ -3453,7 +3444,6 @@ void CheckStl::getErrorMessages(ErrorLogger* errorLogger, const Settings* settin
34533444
c.outOfBoundsError(nullptr, "container", nullptr, "x", nullptr);
34543445
c.invalidIteratorError(nullptr, "iterator");
34553446
c.iteratorsError(nullptr, "container1", "container2");
3456-
c.iteratorsError(nullptr, nullptr, "container0", "container1");
34573447
c.iteratorsError(nullptr, nullptr, "container");
34583448
c.invalidContainerLoopError(nullptr, nullptr, ErrorPath{});
34593449
c.invalidContainerError(nullptr, nullptr, nullptr, ErrorPath{});

lib/checkstl.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ class CPPCHECKLIB CheckStl : public Check {
176176
void negativeIndexError(const Token* tok, const ValueFlow::Value& index);
177177
void invalidIteratorError(const Token* tok, const std::string& iteratorName);
178178
void iteratorsError(const Token* tok, const std::string& containerName1, const std::string& containerName2);
179-
void iteratorsError(const Token* tok, const Token* containerTok, const std::string& containerName1, const std::string& containerName2);
180179
void iteratorsError(const Token* tok, const Token* containerTok, const std::string& containerName);
181180
void mismatchingContainerIteratorError(const Token* containerTok, const Token* iterTok, const Token* containerTok2);
182181
void mismatchingContainersError(const Token* tok1, const Token* tok2);

lib/tokenize.cpp

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5631,8 +5631,6 @@ bool Tokenizer::simplifyTokenList1(const char FileName[])
56315631
findGarbageCode();
56325632
});
56335633

5634-
checkConfiguration();
5635-
56365634
// if (x) MACRO() ..
56375635
for (const Token *tok = list.front(); tok; tok = tok->next()) {
56385636
if (Token::simpleMatch(tok, "if (")) {
@@ -8219,14 +8217,6 @@ void Tokenizer::unhandled_macro_class_x_y(const Token *tok, const std::string& t
82198217
bracket + "' is not handled. You can use -I or --include to add handling of this code.");
82208218
}
82218219

8222-
void Tokenizer::macroWithSemicolonError(const Token *tok, const std::string &macroName) const
8223-
{
8224-
reportError(tok,
8225-
Severity::information,
8226-
"macroWithSemicolon",
8227-
"Ensure that '" + macroName + "' is defined either using -I, --include or -D.");
8228-
}
8229-
82308220
void Tokenizer::invalidConstFunctionTypeError(const Token *tok) const
82318221
{
82328222
reportError(tok,
@@ -8287,25 +8277,6 @@ bool Tokenizer::isOneNumber(const std::string &s)
82878277
return isNumberOneOf(s, 1L, "1.0");
82888278
}
82898279
// ------------------------------------------------------------------------
8290-
void Tokenizer::checkConfiguration() const
8291-
{
8292-
if (!mSettings.checkConfiguration)
8293-
return;
8294-
for (const Token *tok = tokens(); tok; tok = tok->next()) {
8295-
if (!Token::Match(tok, "%name% ("))
8296-
continue;
8297-
if (tok->isControlFlowKeyword())
8298-
continue;
8299-
for (const Token *tok2 = tok->tokAt(2); tok2 && tok2->str() != ")"; tok2 = tok2->next()) {
8300-
if (tok2->str() == ";") {
8301-
macroWithSemicolonError(tok, tok->str());
8302-
break;
8303-
}
8304-
if (Token::Match(tok2, "(|{"))
8305-
tok2 = tok2->link();
8306-
}
8307-
}
8308-
}
83098280

83108281
void Tokenizer::validateC() const
83118282
{
@@ -11033,6 +11004,5 @@ void Tokenizer::getErrorMessages(ErrorLogger& errorLogger, const Settings& setti
1103311004
tokenizer.invalidConstFunctionTypeError(nullptr);
1103411005
// checkLibraryNoReturn
1103511006
tokenizer.unhandled_macro_class_x_y(nullptr, "", "", "", "");
11036-
tokenizer.macroWithSemicolonError(nullptr, "");
1103711007
tokenizer.unhandledCharLiteral(nullptr, "");
1103811008
}

lib/tokenize.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,10 +388,6 @@ class CPPCHECKLIB Tokenizer {
388388
/** Report that there is an unhandled "class x y {" code */
389389
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;
390390

391-
/** Check configuration (unknown macros etc) */
392-
void checkConfiguration() const;
393-
void macroWithSemicolonError(const Token *tok, const std::string &macroName) const;
394-
395391
void invalidConstFunctionTypeError(const Token *tok) const;
396392

397393
/**

0 commit comments

Comments
 (0)