From 9bea2f465cc2b47e06d65d6a29cb0f0f0c37f29c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 29 May 2023 07:56:33 +0200 Subject: Extend special match_rule() logic to all groups with dynamic targets --- libbuild2/operation.cxx | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'libbuild2/operation.cxx') diff --git a/libbuild2/operation.cxx b/libbuild2/operation.cxx index f199827..7355f38 100644 --- a/libbuild2/operation.cxx +++ b/libbuild2/operation.cxx @@ -774,6 +774,21 @@ namespace build2 if (ctx.dependency_count.load (memory_order_relaxed) != 0) { + auto dependents = [base = ctx.count_base ()] (action a, + const target& t) + { + const target::opstate& s (t.state[a]); + + // Only consider targets that have been matched for this operation + // (since matching is what causes the dependents count reset). + // + size_t c (s.task_count.load (memory_order_relaxed) - base); + + return (c >= target::offset_applied + ? s.dependents.load (memory_order_relaxed) + : 0); + }; + diag_record dr; dr << info << "detected unexecuted matched targets:"; @@ -781,14 +796,12 @@ namespace build2 { const target& t (*pt); - if (size_t n = t[a].dependents.load (memory_order_relaxed)) + if (size_t n = dependents (a, t)) dr << text << t << ' ' << n; if (a.outer ()) { - action ia (a.inner_action ()); - - if (size_t n = t[ia].dependents.load (memory_order_relaxed)) + if (size_t n = dependents (a.inner_action (), t)) dr << text << t << ' ' << n; } } -- cgit v1.1