From 1c75d32ee310f02d2c04ab427ad300222cc40d86 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 16 Jun 2017 17:58:54 +0200 Subject: Fix bug (forward-declared inline function) --- build2/algorithm.cxx | 26 ++++++++++++++++++++++++++ build2/algorithm.ixx | 32 -------------------------------- 2 files changed, 26 insertions(+), 32 deletions(-) (limited to 'build2') diff --git a/build2/algorithm.cxx b/build2/algorithm.cxx index 9310644..a55b885 100644 --- a/build2/algorithm.cxx +++ b/build2/algorithm.cxx @@ -19,6 +19,32 @@ using namespace butl; namespace build2 { + const target* + search_existing (const prerequisite& p) + { + assert (phase == run_phase::match); // Could be relaxed. + + const target* r (p.target.load (memory_order_consume)); + + if (r == nullptr) + { + const prerequisite_key& pk (p.key ()); + r = pk.proj ? import_existing (pk) : search_existing_target (pk); + + if (r != nullptr) + { + const target* e (nullptr); + if (!p.target.compare_exchange_strong ( + e, r, + memory_order_release, + memory_order_consume)) + assert (e == r); + } + } + + return r; + } + const target& search (const target& t, const prerequisite_key& pk) { diff --git a/build2/algorithm.ixx b/build2/algorithm.ixx index 4885ecf..27759c9 100644 --- a/build2/algorithm.ixx +++ b/build2/algorithm.ixx @@ -29,38 +29,6 @@ namespace build2 return *r; } - const target* - search_existing_target (const prerequisite_key&); // - - const target* - import_existing (const prerequisite_key&); // - - inline const target* - search_existing (const prerequisite& p) - { - assert (phase == run_phase::match); // Could be relaxed. - - const target* r (p.target.load (memory_order_consume)); - - if (r == nullptr) - { - const prerequisite_key& pk (p.key ()); - r = pk.proj ? import_existing (pk) : search_existing_target (pk); - - if (r != nullptr) - { - const target* e (nullptr); - if (!p.target.compare_exchange_strong ( - e, r, - memory_order_release, - memory_order_consume)) - assert (e == r); - } - } - - return r; - } - inline const target& search (const target& t, const target_type& tt, const prerequisite_key& k) { -- cgit v1.1