aboutsummaryrefslogtreecommitdiff
path: root/build2/rule.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'build2/rule.hxx')
-rw-r--r--build2/rule.hxx44
1 files changed, 6 insertions, 38 deletions
diff --git a/build2/rule.hxx b/build2/rule.hxx
index f6e23f6..8e43ca6 100644
--- a/build2/rule.hxx
+++ b/build2/rule.hxx
@@ -13,48 +13,16 @@
namespace build2
{
- class match_result
- {
- public:
- bool result;
-
- // If set, then this is a recipe's action. It must override the original
- // action. Normally it is "unconditional inner operation". Only
- // noop_recipe can be overridden.
- //
- // It is passed to rule::apply() so that prerequisites are matched for
- // this action. It is also passed to target::recipe() so that if someone
- // is matching this target for this action, we won't end-up re-matching
- // it. However, the recipe itself is executed with the original action
- // so that it can adjust its logic, if necessary.
- //
- action recipe_action = action ();
-
- explicit
- operator bool () const {return result;}
-
- // Note that the from-bool constructor is intentionally implicit so that
- // we can return true/false from match().
- //
- match_result (bool r): result (r) {}
- match_result (bool r, action a): result (r), recipe_action (a) {}
- };
-
// Once a rule is registered (for a scope), it is treated as immutable. If
// you need to modify some state (e.g., counters or some such), then make
// sure it is MT-safe.
//
- // Note that match() may not be followed by apply() or be called several
- // times before the following apply() (see resolve_group_members()) which
- // means that it should be idempotent. The target_data object in the call
- // to match() may not be the same as target.
- //
- // match() can also be called by another rules (see cc/install).
+ // Note: match() is only called once but may not be followed by apply().
//
class rule
{
public:
- virtual match_result
+ virtual bool
match (action, target&, const string& hint) const = 0;
virtual recipe
@@ -68,7 +36,7 @@ namespace build2
public:
file_rule () {}
- virtual match_result
+ virtual bool
match (action, target&, const string&) const override;
virtual recipe
@@ -82,7 +50,7 @@ namespace build2
public:
alias_rule () {}
- virtual match_result
+ virtual bool
match (action, target&, const string&) const override;
virtual recipe
@@ -96,7 +64,7 @@ namespace build2
public:
fsdir_rule () {}
- virtual match_result
+ virtual bool
match (action, target&, const string&) const override;
virtual recipe
@@ -124,7 +92,7 @@ namespace build2
public:
fallback_rule () {}
- virtual match_result
+ virtual bool
match (action, target&, const string&) const override
{
return true;