aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-06-01 09:56:35 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-06-01 09:56:35 +0200
commit061879137a62cb905f75e35c104cff379fb95134 (patch)
treef2eadd70948730f9b8f7f570330479eef49e956a
parent3a71bffd5680d64d19c914aa9dbf1a8fc9f094ef (diff)
Add inner_recipe for expressiveness
-rw-r--r--libbuild2/adhoc-rule-buildscript.cxx2
-rw-r--r--libbuild2/algorithm.hxx6
-rw-r--r--libbuild2/algorithm.ixx2
-rw-r--r--libbuild2/install/rule.cxx2
-rw-r--r--libbuild2/operation.cxx2
-rw-r--r--libbuild2/recipe.cxx1
-rw-r--r--libbuild2/recipe.hxx1
-rw-r--r--libbuild2/target.hxx2
8 files changed, 11 insertions, 7 deletions
diff --git a/libbuild2/adhoc-rule-buildscript.cxx b/libbuild2/adhoc-rule-buildscript.cxx
index fa5100c..a67b07b 100644
--- a/libbuild2/adhoc-rule-buildscript.cxx
+++ b/libbuild2/adhoc-rule-buildscript.cxx
@@ -319,7 +319,7 @@ namespace build2
if (a.outer ())
{
match_inner (a, t);
- return execute_inner;
+ return inner_recipe;
}
context& ctx (t.ctx);
diff --git a/libbuild2/algorithm.hxx b/libbuild2/algorithm.hxx
index 93a609f..216ec4b 100644
--- a/libbuild2/algorithm.hxx
+++ b/libbuild2/algorithm.hxx
@@ -430,7 +430,8 @@ namespace build2
match_inc_dependents (action, const target&);
// Match (synchronously) a rule for the inner operation from withing the
- // outer rule's apply() function. See also the companion execute_inner().
+ // outer rule's apply() function. See also the companion execute_inner()
+ // and inner_recipe.
//
target_state
match_inner (action, const target&);
@@ -604,7 +605,8 @@ namespace build2
// Note that the returned target state is for the inner operation. The
// appropriate usage is to call this function from the outer operation's
// recipe and to factor the obtained state into the one returned (similar to
- // how we do it for prerequisites).
+ // how we do it for prerequisites). Or, if factoring is not needed, simply
+ // return inner_recipe as outer recipe.
//
// Note: waits for the completion if the target is busy and translates
// target_state::failed to the failed exception.
diff --git a/libbuild2/algorithm.ixx b/libbuild2/algorithm.ixx
index 6fcc1e9..9f1b70f 100644
--- a/libbuild2/algorithm.ixx
+++ b/libbuild2/algorithm.ixx
@@ -845,7 +845,7 @@ namespace build2
}
inline target_state
- execute_inner (action a, const target& t) // @@ TMP Why inline (used as recipe)?
+ execute_inner (action a, const target& t)
{
assert (a.outer ());
return execute_sync (a.inner_action (), t);
diff --git a/libbuild2/install/rule.cxx b/libbuild2/install/rule.cxx
index c0fbe0c..7e6121d 100644
--- a/libbuild2/install/rule.cxx
+++ b/libbuild2/install/rule.cxx
@@ -197,7 +197,7 @@ namespace build2
if (a.operation () == update_id)
{
match_inner (a, t);
- return &execute_inner;
+ return inner_recipe;
}
else
return noop_recipe;
diff --git a/libbuild2/operation.cxx b/libbuild2/operation.cxx
index 1c3493c..e9b9211 100644
--- a/libbuild2/operation.cxx
+++ b/libbuild2/operation.cxx
@@ -803,7 +803,7 @@ namespace build2
// @@ There are special recipes that don't populate prerequisite_targets
// like group_recipe! Are we banning any user-defined such recipes?
// Need to actually look if we have anything else like this. There
- // is also execute_inner, though doesn't apply here (only for outer).
+ // is also inner_recipe, though doesn't apply here (only for outer).
//
// @@ TMP: do and enable after the 0.16.0 release.
//
diff --git a/libbuild2/recipe.cxx b/libbuild2/recipe.cxx
index eeafe87..87d37e7 100644
--- a/libbuild2/recipe.cxx
+++ b/libbuild2/recipe.cxx
@@ -11,4 +11,5 @@ namespace build2
recipe_function* const noop_recipe = &noop_action;
recipe_function* const default_recipe = &default_action;
recipe_function* const group_recipe = &group_action;
+ recipe_function* const inner_recipe = &execute_inner;
}
diff --git a/libbuild2/recipe.hxx b/libbuild2/recipe.hxx
index 5a6e38d..97261f5 100644
--- a/libbuild2/recipe.hxx
+++ b/libbuild2/recipe.hxx
@@ -49,6 +49,7 @@ namespace build2
LIBBUILD2_SYMEXPORT extern recipe_function* const noop_recipe;
LIBBUILD2_SYMEXPORT extern recipe_function* const default_recipe;
LIBBUILD2_SYMEXPORT extern recipe_function* const group_recipe;
+ LIBBUILD2_SYMEXPORT extern recipe_function* const inner_recipe;
}
#endif // LIBBUILD2_RECIPE_HXX
diff --git a/libbuild2/target.hxx b/libbuild2/target.hxx
index c33893f..d01e8b7 100644
--- a/libbuild2/target.hxx
+++ b/libbuild2/target.hxx
@@ -938,7 +938,7 @@ namespace build2
// resolve_members_impl() for background). Note that a rule should not
// store targets that are semantically prerequisites in an ad hoc manner
// (e.g., in match data) with a few well-known execeptions (see
- // group_action and execute_inner).
+ // group_recipe and inner_recipe).
//
// Note that the recipe may modify this list. @@ TMP TSAN issue
//