Skip to content

Commit 187cde1

Browse files
committed
Cleanup: Removed Tokenizer::simplifyTokenList2. As a side-effect, rules for "simple" token list are now executed on normal token list.
1 parent eb9576c commit 187cde1

12 files changed

Lines changed: 782 additions & 9501 deletions

cli/cmdlineparser.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,6 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
258258
else if (std::strcmp(argv[i], "--debug-bug-hunting") == 0)
259259
mSettings->debugBugHunting = true;
260260

261-
// Flag used for various purposes during debugging
262-
else if (std::strcmp(argv[i], "--debug-simplified") == 0)
263-
mSettings->debugSimplified = true;
264-
265261
// Show template information
266262
else if (std::strcmp(argv[i], "--debug-template") == 0)
267263
mSettings->debugtemplate = true;

lib/cppcheck.cpp

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ CppCheck::CppCheck(ErrorLogger &errorLogger,
249249
, mSuppressInternalErrorFound(false)
250250
, mUseGlobalSuppressions(useGlobalSuppressions)
251251
, mTooManyConfigs(false)
252-
, mSimplify(true)
253252
, mExecuteCommand(executeCommand)
254253
{
255254
}
@@ -385,7 +384,7 @@ unsigned int CppCheck::check(const std::string &path)
385384
clangimport::parseClangAstDump(&tokenizer, ast);
386385
ValueFlow::setValues(&tokenizer.list, const_cast<SymbolDatabase *>(tokenizer.getSymbolDatabase()), this, &mSettings);
387386
if (mSettings.debugnormal)
388-
tokenizer.printDebugOutput(1);
387+
tokenizer.printDebugOutput();
389388
checkNormalTokens(tokenizer);
390389
return mExitCode;
391390
}
@@ -756,18 +755,8 @@ unsigned int CppCheck::checkFile(const std::string& filename, const std::string
756755
checkUnusedFunctions.parseTokens(mTokenizer, filename.c_str(), &mSettings);
757756

758757
// simplify more if required, skip rest of iteration if failed
759-
if (mSimplify && hasRule("simple")) {
760-
std::cout << "Handling of \"simple\" rules is deprecated and will be removed in Cppcheck 2.5." << std::endl;
761-
762-
// if further simplification fails then skip rest of iteration
763-
Timer timer3("Tokenizer::simplifyTokenList2", mSettings.showtime, &s_timerResults);
764-
result = mTokenizer.simplifyTokenList2();
765-
timer3.stop();
766-
if (!result)
767-
continue;
768-
769-
if (!Settings::terminated())
770-
executeRules("simple", mTokenizer);
758+
if (hasRule("simple")) {
759+
std::cout << "Handling of \"simple\" rules was removed in Cppcheck 2.1. Rule is executed on normal token list instead." << std::endl;
771760
}
772761

773762
} catch (const simplecpp::Output &o) {
@@ -971,6 +960,7 @@ void CppCheck::checkNormalTokens(const Tokenizer &tokenizer)
971960
}
972961

973962
executeRules("normal", tokenizer);
963+
executeRules("simple", tokenizer);
974964
}
975965
}
976966

lib/cppcheck.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,6 @@ class CPPCHECKLIB CppCheck : ErrorLogger {
128128
void tooManyConfigsError(const std::string &file, const std::size_t numberOfConfigurations);
129129
void purgedConfigurationMessage(const std::string &file, const std::string& configuration);
130130

131-
void dontSimplify() {
132-
mSimplify = false;
133-
}
134-
135131
/** Analyse whole program, run this after all TUs has been scanned.
136132
* This is deprecated and the plan is to remove this when
137133
* .analyzeinfo is good enough.
@@ -227,9 +223,6 @@ class CPPCHECKLIB CppCheck : ErrorLogger {
227223
/** Are there too many configs? */
228224
bool mTooManyConfigs;
229225

230-
/** Simplify code? true by default */
231-
bool mSimplify;
232-
233226
/** File info used for whole program analysis */
234227
std::list<Check::FileInfo*> mFileInfo;
235228

lib/settings.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ Settings::Settings()
4141
daca(false),
4242
debugBugHunting(false),
4343
debugnormal(false),
44-
debugSimplified(false),
4544
debugtemplate(false),
4645
debugwarnings(false),
4746
dump(false),

lib/settings.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,6 @@ class CPPCHECKLIB Settings : public cppcheck::Platform {
130130
/** @brief Is --debug-normal given? */
131131
bool debugnormal;
132132

133-
/** @brief Is --debug-simplified given? */
134-
bool debugSimplified;
135-
136133
/** @brief Is --debug-template given? */
137134
bool debugtemplate;
138135

0 commit comments

Comments
 (0)