aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/algorithm.cxx68
-rw-r--r--libbuild2/algorithm.hxx6
-rw-r--r--libbuild2/algorithm.ixx69
-rw-r--r--libbuild2/context.hxx2
-rw-r--r--libbuild2/diagnostics.hxx2
-rw-r--r--libbuild2/target.hxx13
-rw-r--r--libbuild2/target.ixx4
-rw-r--r--libbuild2/types.hxx3
-rw-r--r--libbuild2/utility.hxx2
9 files changed, 85 insertions, 84 deletions
diff --git a/libbuild2/algorithm.cxx b/libbuild2/algorithm.cxx
index ded34b4..2f59c73 100644
--- a/libbuild2/algorithm.cxx
+++ b/libbuild2/algorithm.cxx
@@ -20,6 +20,37 @@ using namespace butl;
namespace build2
{
const target&
+ search (const target& t, const prerequisite& p)
+ {
+ assert (phase == run_phase::match);
+
+ const target* r (p.target.load (memory_order_consume));
+
+ if (r == nullptr)
+ r = &search_custom (p, search (t, p.key ()));
+
+ return *r;
+ }
+
+ const target*
+ search_existing (const prerequisite& p)
+ {
+ assert (phase == run_phase::match || phase == run_phase::execute);
+
+ const target* r (p.target.load (memory_order_consume));
+
+ if (r == nullptr)
+ {
+ r = search_existing (p.key ());
+
+ if (r != nullptr)
+ search_custom (p, *r);
+ }
+
+ return r;
+ }
+
+ const target&
search (const target& t, const prerequisite_key& pk)
{
assert (phase == run_phase::match);
@@ -637,7 +668,7 @@ namespace build2
return ct.try_matched_state (a, false);
}
- group_view
+ static group_view
resolve_members_impl (action a, const target& g, target_lock l)
{
// Note that we will be unlocked if the target is already applied.
@@ -709,6 +740,41 @@ namespace build2
return r;
}
+ group_view
+ resolve_members (action a, const target& g)
+ {
+ group_view r;
+
+ if (a.outer ())
+ a = a.inner_action ();
+
+ // We can be called during execute though everything should have been
+ // already resolved.
+ //
+ switch (phase)
+ {
+ case run_phase::match:
+ {
+ // Grab a target lock to make sure the group state is synchronized.
+ //
+ target_lock l (lock_impl (a, g, scheduler::work_none));
+ r = g.group_members (a);
+
+ // If the group members are alrealy known or there is nothing else
+ // we can do, then unlock and return.
+ //
+ if (r.members == nullptr && l.offset != target::offset_executed)
+ r = resolve_members_impl (a, g, move (l));
+
+ break;
+ }
+ case run_phase::execute: r = g.group_members (a); break;
+ case run_phase::load: assert (false);
+ }
+
+ return r;
+ }
+
void
resolve_group_impl (action, const target&, target_lock l)
{
diff --git a/libbuild2/algorithm.hxx b/libbuild2/algorithm.hxx
index 50e8423..4707ae7 100644
--- a/libbuild2/algorithm.hxx
+++ b/libbuild2/algorithm.hxx
@@ -23,12 +23,12 @@ namespace build2
// prerequisite-type-specific search function. If that doesn't yeld
// anything, it creates a new target.
//
- const target&
+ LIBBUILD2_SYMEXPORT const target&
search (const target&, const prerequisite&);
// As above but only search for an already existing target.
//
- const target*
+ LIBBUILD2_SYMEXPORT const target*
search_existing (const prerequisite&);
// As above but cache a target searched in a custom way.
@@ -411,7 +411,7 @@ namespace build2
// don't do this, then the group resolution will be racy since we will use
// two different task_count instances for synchronization).
//
- group_view
+ LIBBUILD2_SYMEXPORT group_view
resolve_members (action, const target&);
// Unless already known, match the target in order to resolve its group.
diff --git a/libbuild2/algorithm.ixx b/libbuild2/algorithm.ixx
index 7d68611..a3fa906 100644
--- a/libbuild2/algorithm.ixx
+++ b/libbuild2/algorithm.ixx
@@ -10,37 +10,6 @@
namespace build2
{
inline const target&
- search (const target& t, const prerequisite& p)
- {
- assert (phase == run_phase::match);
-
- const target* r (p.target.load (memory_order_consume));
-
- if (r == nullptr)
- r = &search_custom (p, search (t, p.key ()));
-
- return *r;
- }
-
- inline const target*
- search_existing (const prerequisite& p)
- {
- assert (phase == run_phase::match || phase == run_phase::execute);
-
- const target* r (p.target.load (memory_order_consume));
-
- if (r == nullptr)
- {
- r = search_existing (p.key ());
-
- if (r != nullptr)
- 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);
@@ -469,44 +438,6 @@ namespace build2
return match (a.inner_action (), t, um);
}
- LIBBUILD2_SYMEXPORT group_view
- resolve_members_impl (action, const target&, target_lock);
-
- inline group_view
- resolve_members (action a, const target& g)
- {
- group_view r;
-
- if (a.outer ())
- a = a.inner_action ();
-
- // We can be called during execute though everything should have been
- // already resolved.
- //
- switch (phase)
- {
- case run_phase::match:
- {
- // Grab a target lock to make sure the group state is synchronized.
- //
- target_lock l (lock_impl (a, g, scheduler::work_none));
- r = g.group_members (a);
-
- // If the group members are alrealy known or there is nothing else
- // we can do, then unlock and return.
- //
- if (r.members == nullptr && l.offset != target::offset_executed)
- r = resolve_members_impl (a, g, move (l));
-
- break;
- }
- case run_phase::execute: r = g.group_members (a); break;
- case run_phase::load: assert (false);
- }
-
- return r;
- }
-
LIBBUILD2_SYMEXPORT void
resolve_group_impl (action, const target&, target_lock);
diff --git a/libbuild2/context.hxx b/libbuild2/context.hxx
index 66874e7..f662fdd 100644
--- a/libbuild2/context.hxx
+++ b/libbuild2/context.hxx
@@ -327,7 +327,7 @@ namespace build2
// the same as true.
//
// To query this value in rule implementations use the include() helpers
- // from prerequisites.hxx.
+ // from <libbuild2/prerequisites.hxx>.
//
// [string] prereq visibility
//
diff --git a/libbuild2/diagnostics.hxx b/libbuild2/diagnostics.hxx
index 9ad18ff..802cd3c 100644
--- a/libbuild2/diagnostics.hxx
+++ b/libbuild2/diagnostics.hxx
@@ -62,7 +62,7 @@ namespace build2
// While uint8 is more than enough, use uint16 for the ease of printing.
//
- // Forward-declarated in utility.hxx.
+ // Forward-declarated in <libbuild2/utility.hxx>.
//
// extern uint16_t verb;
// const uint16_t verb_never = 7;
diff --git a/libbuild2/target.hxx b/libbuild2/target.hxx
index cfbd9bc..6d320d4 100644
--- a/libbuild2/target.hxx
+++ b/libbuild2/target.hxx
@@ -36,8 +36,11 @@ namespace build2
// From <libbuild2/algorithm.hxx>.
//
- const target& search (const target&, const prerequisite&);
- const target* search_existing (const prerequisite&);
+ LIBBUILD2_SYMEXPORT const target&
+ search (const target&, const prerequisite&);
+
+ LIBBUILD2_SYMEXPORT const target*
+ search_existing (const prerequisite&);
// Recipe.
//
@@ -278,7 +281,7 @@ namespace build2
public:
// Normally you should not call this function directly and rather use
- // resolve_members() from algorithm.hxx.
+ // resolve_members() from <libbuild2/algorithm.hxx>.
//
virtual group_view
group_members (action) const;
@@ -469,7 +472,7 @@ namespace build2
static size_t count_executed () {return offset_executed + count_base ();}
static size_t count_busy () {return offset_busy + count_base ();}
- // Inner/outer operation state. See operation.hxx for details.
+ // Inner/outer operation state. See <libbuild2/operation.hxx> for details.
//
class LIBBUILD2_SYMEXPORT opstate
{
@@ -480,7 +483,7 @@ namespace build2
// operation. It is incremented during match and then decremented during
// execution, before running the recipe. As a result, the recipe can
// detect the last chance (i.e., last dependent) to execute the command
- // (see also the first/last execution modes in <operation.hxx>).
+ // (see also the first/last execution modes in <libbuild2/operation.hxx>).
//
mutable atomic_count dependents {0};
diff --git a/libbuild2/target.ixx b/libbuild2/target.ixx
index 4570558..1671c25 100644
--- a/libbuild2/target.ixx
+++ b/libbuild2/target.ixx
@@ -306,8 +306,8 @@ namespace build2
// prerequisite_members
//
- group_view
- resolve_members (action, const target&); // algorithm.hxx
+ LIBBUILD2_SYMEXPORT group_view
+ resolve_members (action, const target&); // <libbuild2/algorithm.hxx>
template <typename T>
inline auto prerequisite_members_range<T>::iterator::
diff --git a/libbuild2/types.hxx b/libbuild2/types.hxx
index cbaf89a..61880ed 100644
--- a/libbuild2/types.hxx
+++ b/libbuild2/types.hxx
@@ -5,7 +5,8 @@
#ifndef LIBBUILD2_TYPES_HXX
#define LIBBUILD2_TYPES_HXX
-// Include unprocessed file during bootstrap. See config.hxx.in for details.
+// Include unprocessed file during bootstrap. See <libbuild2/config.hxx.in>
+// for details.
//
#ifdef BUILD2_BOOTSTRAP
# include <libbuild2/config.hxx.in>
diff --git a/libbuild2/utility.hxx b/libbuild2/utility.hxx
index af72c58..9598208 100644
--- a/libbuild2/utility.hxx
+++ b/libbuild2/utility.hxx
@@ -84,7 +84,7 @@ namespace build2
using butl::eof;
- // Diagnostics state (verbosity level, etc; see diagnostics.hxx).
+ // Diagnostics state (verbosity level, etc; see <libbuild2/diagnostics.hxx>).
//
// Note on naming of values (here and in the global state below) that come
// from the command line options: if a value is not meant to be used