aboutsummaryrefslogtreecommitdiff
path: root/build/rule
diff options
context:
space:
mode:
Diffstat (limited to 'build/rule')
-rw-r--r--build/rule27
1 files changed, 10 insertions, 17 deletions
diff --git a/build/rule b/build/rule
index a144a9b..5339b40 100644
--- a/build/rule
+++ b/build/rule
@@ -23,20 +23,22 @@ namespace build
// Can contain neither (both are NULL), one of, or both. If both
// are NULL, then it is a "no match" indicator.
//
- // Note that if the "payload" is stored in value instead of
+ // Note that if the "payload" is stored in *value instead of
// prerequisite, then target must not be NULL.
//
union
{
prerequisite_type* prerequisite;
- bool value;
+
+ bool bvalue;
+ void* pvalue;
+ const void* cpvalue;
};
target_type* target;
action recipe_action = action (); // Used as recipe's action if set.
- match_result (target_type& t, bool v): value (v), target (&t) {}
match_result (std::nullptr_t v = nullptr): prerequisite (v), target (v) {}
match_result (prerequisite_type& p): prerequisite (&p), target (nullptr) {}
match_result (prerequisite_type* p): prerequisite (p), target (nullptr) {}
@@ -45,6 +47,11 @@ namespace build
match_result (const prerequisite_member& pm)
: prerequisite (&pm.prerequisite.get ()), target (pm.target) {}
+ match_result (target_type& t, bool v): bvalue (v), target (&t) {}
+ match_result (target_type& t, void* v): pvalue (v), target (&t) {}
+ match_result (target_type& t, const void* v): cpvalue (v), target (&t) {}
+ match_result (target_type& t, std::nullptr_t v): pvalue (v), target (&t) {}
+
explicit
operator bool () const
{
@@ -77,20 +84,6 @@ namespace build
static target_state
perform_update (action, target&);
- // Sometimes it is useful, normally as an optimization, to check
- // if the file target is up to date. In particular, if the rule
- // that matched a target is this fallback rule and the target
- // has no prerequisites, then it means it is up to date.
- //
- static bool
- uptodate (action a, target& t)
- {
- recipe_function* const* r (t.recipe (a).target<recipe_function*> ());
- return r != nullptr && *r == &perform_update &&
- t.prerequisites.empty () &&
- (t.group == nullptr || t.group->prerequisites.empty ());
- }
-
static file_rule instance;
};