aboutsummaryrefslogtreecommitdiff
path: root/build/algorithm.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-08-13 14:48:41 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-08-13 14:48:41 +0200
commit9fa5209175dffb881e8ec6c5f6ad4fc54448244a (patch)
treeb937763e9605832f9cac87b846a2996c8727af12 /build/algorithm.ixx
parent467d700c66582471013a07384318d0142d2f3de2 (diff)
Rework postponed logic
Specifically, now postponed is only used by the execution mode logic and rules should not return it directly.
Diffstat (limited to 'build/algorithm.ixx')
-rw-r--r--build/algorithm.ixx31
1 files changed, 24 insertions, 7 deletions
diff --git a/build/algorithm.ixx b/build/algorithm.ixx
index bb66b53..e0b9364 100644
--- a/build/algorithm.ixx
+++ b/build/algorithm.ixx
@@ -60,6 +60,19 @@ namespace build
match_impl (a, t, true);
t.dependents++;
+ dependency_count++;
+
+ // text << "M " << t << ": " << t.dependents << " " << dependency_count;
+ }
+
+ inline void
+ unmatch (action, target& t)
+ {
+ assert (t.dependents != 0 && dependency_count != 0);
+ t.dependents--;
+ dependency_count--;
+
+ // text << "U " << t << ": " << t.dependents << " " << dependency_count;
}
inline void
@@ -118,10 +131,14 @@ namespace build
inline target_state
execute (action a, target& t)
{
- // This can happen when we re-examine the state after being postponed.
- //
- if (t.dependents != 0)
+ if (dependency_count != 0) // Re-examination of a postponed target?
+ {
+ assert (t.dependents != 0);
t.dependents--;
+ dependency_count--;
+ }
+
+ // text << "E " << t << ": " << t.dependents << " " << dependency_count;
switch (target_state ts = t.state ())
{
@@ -138,10 +155,10 @@ namespace build
// clean the group via three of its members, only the last
// attempt will actually execute the clean. This means that
// when we match a group member, inside we should also match
- // the group in order to increment the dependents count.
- // Though this seems to be a natural requirement (if we
- // are delegating to the group, we need to find a recipe
- // for it, just like we would for a prerequisite).
+ // the group in order to increment the dependents count. This
+ // seems to be a natural requirement: if we are delegating to
+ // the group, we need to find a recipe for it, just like we
+ // would for a prerequisite.
//
// Note that below we are going to change the group state
// to postponed. This is not a mistake: until we execute