aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-04-21 17:12:22 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-04-21 17:12:22 +0200
commit34e19551c1db1d8f0be3a41735506d6ce04b70e1 (patch)
tree4b0e8c004c12cbdecaefe109c47d7c77d7b0778d
parentf0a73bf037a63849c89c090625b645e2b4da08c9 (diff)
Move target state reset back to recipe()
Doing it in target::reset() (which is called by match()) didn't play well with delegated recipes.
-rw-r--r--build2/algorithm.cxx3
-rw-r--r--build2/bin/target.cxx2
-rw-r--r--build2/target10
-rw-r--r--build2/target.cxx3
4 files changed, 8 insertions, 10 deletions
diff --git a/build2/algorithm.cxx b/build2/algorithm.cxx
index 1b19fe5..a22837f 100644
--- a/build2/algorithm.cxx
+++ b/build2/algorithm.cxx
@@ -449,8 +449,9 @@ namespace build2
}
target_state
- noop_action (action, target&)
+ noop_action (action a, target& t)
{
+ text << "noop action triggered for " << diag_doing (a, t);
assert (false); // We shouldn't be called, see target::recipe().
return target_state::unchanged;
}
diff --git a/build2/bin/target.cxx b/build2/bin/target.cxx
index 6cd5d11..b0ce6d5 100644
--- a/build2/bin/target.cxx
+++ b/build2/bin/target.cxx
@@ -196,8 +196,6 @@ namespace build2
{
// Don't clear prerequisite_targets since it is "given" to our
// members to implement "library meta-information protocol".
- //
- raw_state = target_state::unknown;
}
static target*
diff --git a/build2/target b/build2/target
index 76d7132..be0eff9 100644
--- a/build2/target
+++ b/build2/target
@@ -64,10 +64,9 @@ namespace build2
// error, then the recipe should throw rather than returning failed.
//
// The return value of the recipe is used to update the target state except
- // if the state is target_state::group (either was was manually set by the
- // recipe or already that value). Note that in this case the returned by the
- // recipe value is still used as the resulting target state so it should
- // match the group's state.
+ // if the state is set to target_state::group by the recipe. Note that in
+ // this case the returned by the recipe value is still used as the resulting
+ // target state so it should match the group's state.
//
using recipe_function = target_state (action, target&);
using recipe = function<recipe_function>;
@@ -198,8 +197,7 @@ namespace build2
: dir (move (d)), out (move (o)), name (move (n)), ext (e) {}
// Reset the target before matching it to a rule. The default
- // implementation clears prerequisite_targets and sets the state to
- // unknown.
+ // implementation clears prerequisite_targets.
//
virtual void
reset (action_type);
diff --git a/build2/target.cxx b/build2/target.cxx
index 4d4fe2a..d64b0be 100644
--- a/build2/target.cxx
+++ b/build2/target.cxx
@@ -66,6 +66,8 @@ namespace build2
action = a;
recipe_ = move (r);
+ raw_state = target_state::unknown;
+
// If this is a noop recipe, then mark the target unchanged so that we
// don't waste time executing the recipe.
//
@@ -86,7 +88,6 @@ namespace build2
reset (action_type)
{
prerequisite_targets.clear ();
- raw_state = target_state::unknown;
}
group_view target::