Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions lib/checkinternal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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");
Expand Down
1 change: 0 additions & 1 deletion lib/checkinternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 0 additions & 10 deletions lib/checkstl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<const Token*> 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<const Token*> callstack = { tok, containerTok };
Expand Down Expand Up @@ -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{});
Expand Down
1 change: 0 additions & 1 deletion lib/checkstl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
30 changes: 0 additions & 30 deletions lib/tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 (")) {
Expand Down Expand Up @@ -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 &macroName) 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,
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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, "");
}
4 changes: 0 additions & 4 deletions lib/tokenize.h
Original file line number Diff line number Diff line change
Expand Up @@ -388,10 +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 macroWithSemicolonError(const Token *tok, const std::string &macroName) const;

void invalidConstFunctionTypeError(const Token *tok) const;

/**
Expand Down