From 59692f8b9fa2b71711de78d07f031c4866024da4 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 13 May 2019 12:18:15 +0200 Subject: Remove order dependence in ad hoc group handling Also, don't match group_recipe since we neither execute nor access the state. --- build2/algorithm.hxx | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) (limited to 'build2/algorithm.hxx') diff --git a/build2/algorithm.hxx b/build2/algorithm.hxx index 5f0854f..f1aad0c 100644 --- a/build2/algorithm.hxx +++ b/build2/algorithm.hxx @@ -170,7 +170,7 @@ namespace build2 const target_lock* dependency_cycle (action, const target&); - // If the target is already applied (for this action ) or executed, then no + // If the target is already applied (for this action) or executed, then no // lock is acquired. Otherwise, the target must not yet be matched for this // action. // @@ -184,8 +184,6 @@ namespace build2 // existing member of this target type is the same. Return the locked member // target. // - // @@ Maybe the same type and name? - // target_lock add_adhoc_member (action, target&, @@ -194,33 +192,57 @@ namespace build2 const dir_path& out, const string& name); - // If the suffix is specified, it is added (as an extension) to the member's - // target name. + // If the extension is specified then it is added to the member's target + // name. // target_lock add_adhoc_member (action, target&, const target_type&, - const char* suffix = nullptr); + const char* ext = nullptr); template inline target_lock - add_adhoc_member (action a, target& t, const char* s = nullptr) + add_adhoc_member (action a, target& g, const char* e = nullptr) { - return add_adhoc_member (a, t, T::static_type, s); + return add_adhoc_member (a, g, T::static_type, e); } // Find an ad hoc member of the specified target type returning NULL if not // found. // + target* + find_adhoc_member (target&, const target_type&); + const target* find_adhoc_member (const target&, const target_type&); template + inline T* + find_adhoc_member (target& g, const target_type& tt) + { + return static_cast (find_adhoc_member (g, tt)); + } + + template inline const T* - find_adhoc_member (const target& t) + find_adhoc_member (const target& g, const target_type& tt) + { + return static_cast (find_adhoc_member (g, tt)); + } + + template + inline const T* + find_adhoc_member (const target& g) + { + return find_adhoc_member (g, T::static_type); + } + + template + inline T* + find_adhoc_member (target& g) { - return static_cast (find_adhoc_member (t, T::static_type)); + return find_adhoc_member (g, T::static_type); } // Match and apply a rule to the action/target with ambiguity detection. -- cgit v1.1