aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-10-23 11:24:13 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-10-26 13:29:25 +0200
commita778f312902ad5036bc940ac63169f0b48e1f556 (patch)
tree3f4c9d1cef651c697e2b31c987af19480a0a33d9
parent3386bad31f31d5623141297e08cee5de29cd0219 (diff)
WIP: forward reapply() call to C++ ad hoc rule/recipe
-rw-r--r--libbuild2/adhoc-rule-buildscript.cxx4
-rw-r--r--libbuild2/adhoc-rule-cxx.cxx12
-rw-r--r--libbuild2/adhoc-rule-cxx.hxx3
-rw-r--r--libbuild2/algorithm.cxx7
4 files changed, 22 insertions, 4 deletions
diff --git a/libbuild2/adhoc-rule-buildscript.cxx b/libbuild2/adhoc-rule-buildscript.cxx
index 3c42e66..0263ddd 100644
--- a/libbuild2/adhoc-rule-buildscript.cxx
+++ b/libbuild2/adhoc-rule-buildscript.cxx
@@ -301,7 +301,9 @@ namespace build2
//
if (const group* g = t.group != nullptr ? t.group->is_a<group> () : nullptr)
{
- match_sync (a, *g);
+ // Note: this looks very similar to how we handle ad hoc group members.
+ //
+ match_sync (a, *g, 0 /* options */);
return group_recipe; // Execute the group's recipe.
}
diff --git a/libbuild2/adhoc-rule-cxx.cxx b/libbuild2/adhoc-rule-cxx.cxx
index e3dfe92..637f9af 100644
--- a/libbuild2/adhoc-rule-cxx.cxx
+++ b/libbuild2/adhoc-rule-cxx.cxx
@@ -691,10 +691,20 @@ namespace build2
? t.group->is_a<group> ()
: nullptr))
{
- match_sync (a, *g);
+ // @@ Hm, this looks very similar to how we handle ad hoc group members.
+ // Shouldn't impl be given a chance to translate options or some
+ // such?
+ //
+ match_sync (a, *g, 0 /* options */);
return group_recipe; // Execute the group's recipe.
}
return impl.load (memory_order_relaxed)->apply (a, t, me);
}
+
+ void adhoc_cxx_rule::
+ reapply (action a, target& t, match_extra& me) const
+ {
+ return impl.load (memory_order_relaxed)->reapply (a, t, me);
+ }
}
diff --git a/libbuild2/adhoc-rule-cxx.hxx b/libbuild2/adhoc-rule-cxx.hxx
index b563881..89bc05f 100644
--- a/libbuild2/adhoc-rule-cxx.hxx
+++ b/libbuild2/adhoc-rule-cxx.hxx
@@ -70,6 +70,9 @@ namespace build2
virtual recipe
apply (action, target&, match_extra&) const override;
+ virtual void
+ reapply (action, target&, match_extra&) const override;
+
adhoc_cxx_rule (string, const location&, size_t,
uint64_t ver,
optional<string> sep);
diff --git a/libbuild2/algorithm.cxx b/libbuild2/algorithm.cxx
index b34c175..0c90642 100644
--- a/libbuild2/algorithm.cxx
+++ b/libbuild2/algorithm.cxx
@@ -591,7 +591,7 @@ namespace build2
const rule_match* r (g->state[a].rule);
assert (r != nullptr); // Shouldn't happen with dyn_members.
- me.new_options = options; // Currently unused but maybe in future.
+ me.new_options = options;
return r;
}
@@ -622,7 +622,7 @@ namespace build2
true /* try_match */,
&gme))
{
- me.new_options = options; // Currently unused but maybe in future.
+ me.new_options = options;
return r;
}
@@ -1129,6 +1129,9 @@ namespace build2
// 4. Continue matching the group passing the translated options.
// 5. Keep track of member options in member's cur_options to handle
// member rematches (if already offset_{applied,executed}).
+ //
+ // Note: see also similar semantics but for explicit groups in
+ // adhoc-rule-*.cxx.
assert (!step && options == match_extra::all_options);