aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-11-24 10:01:29 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-11-24 10:01:29 +0200
commitd82719606408de169097715d673745a96d9b1d56 (patch)
tree2fbf0919279b52b3dee282a3804ea0923076c860
parentc7e6b5ab3e244ae5a47c7f461ebc9cb683c93270 (diff)
Allow calling cc module functions during match
An ad hoc recipe with dynamic dependency extraction (depdb-dyndep) executes its depdb preamble during match (but after matching all the prerequisites).
-rw-r--r--libbuild2/cc/functions.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/libbuild2/cc/functions.cxx b/libbuild2/cc/functions.cxx
index cafb7f0..9c06f87 100644
--- a/libbuild2/cc/functions.cxx
+++ b/libbuild2/cc/functions.cxx
@@ -47,7 +47,12 @@ namespace build2
if (rs == nullptr)
fail << f.name << " called out of project";
- if (bs->ctx.phase != run_phase::execute)
+ // Note that we also allow calling this during match since an ad hoc
+ // recipe with dynamic dependency extraction (depdb-dyndep) executes its
+ // depdb preamble during match (after matching all the prerequisites).
+ //
+ if (bs->ctx.phase != run_phase::match ||
+ bs->ctx.phase != run_phase::execute)
fail << f.name << " can only be called during execution";
const module* m (rs->find_module<module> (d.x));
@@ -102,7 +107,8 @@ namespace build2
if (rs == nullptr)
fail << f.name << " called out of project";
- if (bs->ctx.phase != run_phase::execute)
+ if (bs->ctx.phase != run_phase::match || // See above.
+ bs->ctx.phase != run_phase::execute)
fail << f.name << " can only be called during execution";
const module* m (rs->find_module<module> (d.x));