aboutsummaryrefslogtreecommitdiff
path: root/build2/algorithm.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-11-22 11:31:35 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-11-22 11:31:35 +0200
commit6cb9d0e810c3336106b6c1f3c8a80cdec6fbdcf0 (patch)
treeeb2475162e91e81fded9645df54d6e199c6c3fc5 /build2/algorithm.ixx
parent1a2ea6db0d5de8c5cabb4fedc845ce9e72cccff0 (diff)
Fix dist bug where missing source file would be silently ignored
Diffstat (limited to 'build2/algorithm.ixx')
-rw-r--r--build2/algorithm.ixx35
1 files changed, 17 insertions, 18 deletions
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 (