@@ -249,6 +249,7 @@ CppCheck::CppCheck(ErrorLogger &errorLogger,
249249 , mSuppressInternalErrorFound(false )
250250 , mUseGlobalSuppressions(useGlobalSuppressions)
251251 , mTooManyConfigs(false )
252+ , mSimplify(true )
252253 , mExecuteCommand(executeCommand)
253254{
254255}
@@ -384,7 +385,7 @@ unsigned int CppCheck::check(const std::string &path)
384385 clangimport::parseClangAstDump (&tokenizer, ast);
385386 ValueFlow::setValues (&tokenizer.list , const_cast <SymbolDatabase *>(tokenizer.getSymbolDatabase ()), this , &mSettings );
386387 if (mSettings .debugnormal )
387- tokenizer.printDebugOutput ();
388+ tokenizer.printDebugOutput (1 );
388389 checkNormalTokens (tokenizer);
389390 return mExitCode ;
390391 }
@@ -755,8 +756,18 @@ unsigned int CppCheck::checkFile(const std::string& filename, const std::string
755756 checkUnusedFunctions.parseTokens (mTokenizer , filename.c_str (), &mSettings );
756757
757758 // simplify more if required, skip rest of iteration if failed
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;
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 );
760771 }
761772
762773 } catch (const simplecpp::Output &o) {
@@ -960,7 +971,6 @@ void CppCheck::checkNormalTokens(const Tokenizer &tokenizer)
960971 }
961972
962973 executeRules (" normal" , tokenizer);
963- executeRules (" simple" , tokenizer);
964974 }
965975}
966976
0 commit comments