summaryrefslogtreecommitdiffstats
path: root/dwarflint/dwarflint.cc
diff options
context:
space:
mode:
authorPetr Machata <[email protected]>2010-09-15 20:13:43 +0200
committerPetr Machata <[email protected]>2010-09-15 20:13:43 +0200
commit77fa9aeeb5cfa975f2f1bb9e6c338187839f458e (patch)
tree9d64a557e177bd283b4bc71cd60a0b2600d297fa /dwarflint/dwarflint.cc
parent63493d047025685826b62d5a8ffe72f4fc05cf5f (diff)
dwarflint: Extract checkrule into module of its own
Diffstat (limited to 'dwarflint/dwarflint.cc')
-rw-r--r--dwarflint/dwarflint.cc57
1 files changed, 1 insertions, 56 deletions
diff --git a/dwarflint/dwarflint.cc b/dwarflint/dwarflint.cc
index 9c21dbcc..a6d68a04 100644
--- a/dwarflint/dwarflint.cc
+++ b/dwarflint/dwarflint.cc
@@ -67,7 +67,7 @@ namespace
}
}
-dwarflint::dwarflint (char const *a_fname, check_rules const &rules)
+dwarflint::dwarflint (char const *a_fname, checkrules const &rules)
: _m_fname (a_fname)
, _m_fd (get_fd (_m_fname))
, _m_rules (rules)
@@ -166,61 +166,6 @@ dwarflint::check_registrar::list_checks () const
<< std::endl;
}
-namespace
-{
- bool
- rule_matches (std::string const &name,
- checkdescriptor const &cd)
- {
- if (name == "@all")
- return true;
- if (name == "@none")
- return false;
- if (name == cd.name ())
- return true;
- return cd.in_group (name);
- }
-}
-
-bool
-check_rules::should_check (checkstack const &stack) const
-{
-#if 0
- std::cout << "---\nstack" << std::endl;
- for (checkstack::const_iterator jt = stack.begin ();
- jt != stack.end (); ++jt)
- std::cout << (*jt)->name << std::flush << " ";
- std::cout << std::endl;
-#endif
-
- // We always allow scheduling hidden checks. Those are service
- // routines that the user doesn't even see it the list of checks.
- assert (!stack.empty ());
- if (stack.back ()->hidden ())
- return true;
-
- bool should = false;
- for (const_iterator it = begin (); it != end (); ++it)
- {
- std::string const &rule_name = it->name;
- bool nflag = it->action == check_rule::request;
- if (nflag == should)
- continue;
-
- for (checkstack::const_iterator jt = stack.begin ();
- jt != stack.end (); ++jt)
- if (rule_matches (rule_name, **jt))
- {
- //std::cout << " rule: " << rule_name << " " << nflag << std::endl;
- should = nflag;
- break;
- }
- }
-
- return should;
-}
-
-
void *const dwarflint::marker = (void *)-1;
void *