From 743273bd381a132c272226af00381da0494e8920 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 15 Feb 2022 15:59:22 +0200 Subject: Diagnose various misuses of library metadata protocol --- libbuild2/target.ixx | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'libbuild2/target.ixx') 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 -- cgit v1.1