aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/algorithm.cxx8
-rw-r--r--build2/target.ixx9
2 files changed, 15 insertions, 2 deletions
diff --git a/build2/algorithm.cxx b/build2/algorithm.cxx
index e702836..fa9787b 100644
--- a/build2/algorithm.cxx
+++ b/build2/algorithm.cxx
@@ -840,7 +840,13 @@ namespace build2
ts = t.recipe_ (a, t);
- target_count.fetch_sub (1, memory_order_relaxed);
+ // Decrement the target count (see target::recipe() for details).
+ //
+ {
+ recipe_function** f (t.recipe_.target<recipe_function*> ());
+ if (f == nullptr || *f != &group_action)
+ target_count.fetch_sub (1, memory_order_relaxed);
+ }
// See the recipe documentation for details on what's going on here.
// Note that if the result is group, then the group's state can be
diff --git a/build2/target.ixx b/build2/target.ixx
index 48036be..459265b 100644
--- a/build2/target.ixx
+++ b/build2/target.ixx
@@ -147,11 +147,18 @@ namespace build2
if (f != nullptr && *f == &noop_action)
state_ = target_state::unchanged;
else
+ {
// This gets tricky when we start considering overrides (which can
// only happen for noop recipes), direct execution, etc. So here seems
// like the best place to do this.
//
- target_count.fetch_add (1, memory_order_relaxed);
+ // We also ignore the group recipe since it is used for ad hoc
+ // groups (which are not executed). Plus, group action means real
+ // recipe is in the group so this also feels right conceptually.
+ //
+ if (f == nullptr || *f != &group_action)
+ target_count.fetch_add (1, memory_order_relaxed);
+ }
}
}