From 6cb9d0e810c3336106b6c1f3c8a80cdec6fbdcf0 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 22 Nov 2017 11:31:35 +0200 Subject: Fix dist bug where missing source file would be silently ignored --- build2/algorithm.ixx | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'build2/algorithm.ixx') diff --git a/build2/algorithm.ixx b/build2/algorithm.ixx index 928386d..565414a 100644 --- a/build2/algorithm.ixx +++ b/build2/algorithm.ixx @@ -23,16 +23,7 @@ namespace build2 const target* r (p.target.load (memory_order_consume)); if (r == nullptr) - { - r = &search (t, p.key ()); - - const target* e (nullptr); - if (!p.target.compare_exchange_strong ( - e, r, - memory_order_release, - memory_order_consume)) - assert (e == r); - } + r = &search_custom (p, search (t, p.key ())); return *r; } @@ -49,20 +40,28 @@ namespace build2 r = search_existing (p.key ()); if (r != nullptr) - { - const target* e (nullptr); - if (!p.target.compare_exchange_strong ( - e, r, - memory_order_release, - memory_order_consume)) - assert (e == r); - } + search_custom (p, *r); } return r; } inline const target& + search_custom (const prerequisite& p, const target& t) + { + assert (phase == run_phase::match || phase == run_phase::execute); + + const target* e (nullptr); + if (!p.target.compare_exchange_strong ( + e, &t, + memory_order_release, + memory_order_consume)) + assert (e == &t); + + return t; + } + + inline const target& search (const target& t, const target_type& tt, const prerequisite_key& k) { return search ( -- cgit v1.1