@@ -168,8 +168,8 @@ unsigned int CppCheck::processFile(const std::string& filename, std::istream& fi
168168 }
169169
170170 // Run rules on this code
171- for (std::map<std::string, Settings::Rule>::const_iterator it = _settings.rules .begin (); it != _settings.rules .end (); ++it) {
172- if (it->second . enabled && it-> second . tokenlist == " define" ) {
171+ for (std::list< Settings::Rule>::const_iterator it = _settings.rules .begin (); it != _settings.rules .end (); ++it) {
172+ if (it->tokenlist == " define" ) {
173173 Tokenizer tokenizer2 (&_settings, this );
174174 std::istringstream istr2 (filedata);
175175 tokenizer2.list .createTokens (istr2, filename);
@@ -320,8 +320,8 @@ bool CppCheck::checkFile(const std::string &code, const char FileName[], std::se
320320 _tokenizer.setTimerResults (&S_timerResults);
321321 try {
322322 // Execute rules for "raw" code
323- for (std::map<std::string, Settings::Rule>::const_iterator it = _settings.rules .begin (); it != _settings.rules .end (); ++it) {
324- if (it->second . enabled && it-> second . tokenlist == " raw" ) {
323+ for (std::list< Settings::Rule>::const_iterator it = _settings.rules .begin (); it != _settings.rules .end (); ++it) {
324+ if (it->tokenlist == " raw" ) {
325325 Tokenizer tokenizer2 (&_settings, this );
326326 std::istringstream istr (code);
327327 tokenizer2.list .createTokens (istr, FileName);
@@ -439,8 +439,8 @@ void CppCheck::executeRules(const std::string &tokenlist, const Tokenizer &token
439439#ifdef HAVE_RULES
440440 // Are there rules to execute?
441441 bool isrule = false ;
442- for (std::map<std::string, Settings::Rule>::const_iterator it = _settings.rules .begin (); it != _settings.rules .end (); ++it) {
443- if (it->second . enabled && it-> second . tokenlist == tokenlist)
442+ for (std::list< Settings::Rule>::const_iterator it = _settings.rules .begin (); it != _settings.rules .end (); ++it) {
443+ if (it->tokenlist == tokenlist)
444444 isrule = true ;
445445 }
446446
@@ -454,9 +454,9 @@ void CppCheck::executeRules(const std::string &tokenlist, const Tokenizer &token
454454 ostr << " " << tok->str ();
455455 const std::string str (ostr.str ());
456456
457- for (std::map<std::string, Settings::Rule>::const_iterator it = _settings.rules .begin (); it != _settings.rules .end (); ++it) {
458- const Settings::Rule &rule = it-> second ;
459- if (rule.pattern .empty () || rule.id .empty () || rule.severity .empty () || rule.tokenlist != tokenlist || !rule. enabled )
457+ for (std::list< Settings::Rule>::const_iterator it = _settings.rules .begin (); it != _settings.rules .end (); ++it) {
458+ const Settings::Rule &rule = *it ;
459+ if (rule.pattern .empty () || rule.id .empty () || rule.severity .empty () || rule.tokenlist != tokenlist)
460460 continue ;
461461
462462 const char *error = nullptr ;
@@ -511,26 +511,6 @@ void CppCheck::executeRules(const std::string &tokenlist, const Tokenizer &token
511511
512512 // Report error
513513 reportErr (errmsg);
514-
515- // Disable rules that must be disabled
516- std::istringstream disable (rule.disable_rules );
517- do {
518- std::string rule_to_disable;
519- disable >> rule_to_disable;
520- if (rule_to_disable != " " ) {
521- _settings.rules [rule_to_disable].enabled = false ;
522- }
523- } while (disable);
524-
525- // Enable rules that must be enabled
526- std::istringstream enable (rule.enable_rules );
527- do {
528- std::string rule_to_enable;
529- enable >> rule_to_enable;
530- if (rule_to_enable != " " ) {
531- _settings.rules [rule_to_enable].enabled = true ;
532- }
533- } while (enable);
534514 }
535515
536516 pcre_free (re);
0 commit comments