From d38dbf711c9532eea99607368278a8396b3db667 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 4 Dec 2020 12:53:52 +0300 Subject: In update ad hoc recipe buildscripts allow non-pure function calls only in depdeb preamble --- libbuild2/build/script/parser.hxx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'libbuild2/build/script/parser.hxx') diff --git a/libbuild2/build/script/parser.hxx b/libbuild2/build/script/parser.hxx index e96a806..b5a45ca 100644 --- a/libbuild2/build/script/parser.hxx +++ b/libbuild2/build/script/parser.hxx @@ -121,6 +121,9 @@ namespace build2 virtual lookup lookup_variable (name&&, string&&, const location&) override; + virtual void + lookup_function (string&&, const location&) override; + // During execution translate the process path and executable targets // leaving the rest for the base parser to handle. // @@ -142,6 +145,11 @@ namespace build2 script* script_; const adhoc_actions* actions_; // Non-NULL during pre-parsing. + // True if performing update is one of the actions. Only set for the + // pre-parse mode. + // + bool perform_update_; + // Current low-verbosity script diagnostics and its weight. // // During pre-parsing each command leading names are translated into a @@ -197,6 +205,17 @@ namespace build2 optional depdb_clear_; // 'depdb clear' location if any. lines depdb_preamble_; // Note: excludes 'depdb clear'. + // If present, the first impure function called in the body of the + // script that performs update. + // + // Note that during the line pre-parsing we cannot tell if this is a + // body or depdb preamble line. Thus, if we encounter an impure + // function call we just save its name/location and postpone the + // potential failure till the end of the script pre-parsing, if it + // turns out to be a body line. + // + optional> impure_func_; + // True during pre-parsing when the pre-parse mode is temporarily // suspended to perform expansion. // -- cgit v1.1