aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/target.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-02-15 15:59:22 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-02-15 15:59:22 +0200
commit743273bd381a132c272226af00381da0494e8920 (patch)
treeb43f53fa0a1b40c1aa38238e42bbe0e0515afe13 /libbuild2/target.ixx
parent84c947319c7300bab12f800088d6b92245388f20 (diff)
Diagnose various misuses of library metadata protocol
Diffstat (limited to 'libbuild2/target.ixx')
-rw-r--r--libbuild2/target.ixx21
1 files changed, 14 insertions, 7 deletions
diff --git a/libbuild2/target.ixx b/libbuild2/target.ixx
index b1e21ae..05f9698 100644
--- a/libbuild2/target.ixx
+++ b/libbuild2/target.ixx
@@ -158,17 +158,24 @@ namespace build2
inline bool target::
matched (action a) const
{
- assert (ctx.phase == run_phase::execute);
+ assert (ctx.phase == run_phase::match ||
+ ctx.phase == run_phase::execute);
const opstate& s (state[a]);
-
- // Note that while the target could be being executed, we should see at
- // least offset_matched since it must have been "achieved" before the
- // phase switch.
- //
size_t c (s.task_count.load (memory_order_relaxed) - ctx.count_base ());
- return c >= offset_matched;
+ if (ctx.phase == run_phase::match)
+ {
+ return c == offset_applied;
+ }
+ else
+ {
+ // Note that while the target could be being executed, we should see at
+ // least offset_matched since it must have been "achieved" before the
+ // phase switch.
+ //
+ return c >= offset_matched;
+ }
}
LIBBUILD2_SYMEXPORT target_state