From 5fec6c87511cacfd9561664a652f8f1b679adcce Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 19 Oct 2022 05:45:32 +0200 Subject: Take 1: match/execute as part of target (dead end) --- libbuild2/target.hxx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'libbuild2/target.hxx') diff --git a/libbuild2/target.hxx b/libbuild2/target.hxx index 6387b8f..9b75389 100644 --- a/libbuild2/target.hxx +++ b/libbuild2/target.hxx @@ -38,16 +38,19 @@ namespace build2 // Prerequisite inclusion/exclusion (see include() function below). // + // Note that posthoc is handled internally and should normally be treated by + // the rules the same as excluded. + // class include_type { public: - enum value {excluded, adhoc, normal}; + enum value {excluded, posthoc, adhoc, normal}; include_type (value v): v_ (v) {} include_type (bool v): v_ (v ? normal : excluded) {} operator value () const {return v_;} - explicit operator bool () const {return v_ != excluded;} + explicit operator bool () const {return v_ == normal || v_ == adhoc;} private: value v_; @@ -713,6 +716,13 @@ namespace build2 static const size_t offset_executed = 5; // Recipe has been executed. static const size_t offset_busy = 6; // Match/execute in progress. + // @@ PERF There is a lot of data below that is only needed for "output" + // as opposed to "source" targets (auxiliary data pads, + // {prerequisite,posthoc}_targets, etc). Maybe we should move this + // stuff to an optional extra (like we have for the root scope). Maybe + // we could even allocate it as part of the target's memory block or + // some such? + // Inner/outer operation state. See for details. // class LIBBUILD2_SYMEXPORT opstate @@ -901,6 +911,11 @@ namespace build2 // mutable action_state prerequisite_targets; + // Targets to which posthoc prerequisites resolve for this action. Note + // that it's normally not used by the rules directly. + // + mutable action_state posthoc_targets; + // Auxiliary data storage. // // A rule that matches (i.e., returns true from its match() function) may -- cgit v1.1