diff options
-rw-r--r-- | build2/algorithm | 9 | ||||
-rw-r--r-- | build2/algorithm.cxx | 6 | ||||
-rw-r--r-- | build2/algorithm.ixx | 9 | ||||
-rw-r--r-- | build2/cc/link.cxx | 2 | ||||
-rw-r--r-- | build2/install/rule.cxx | 4 | ||||
-rw-r--r-- | build2/rule.cxx | 6 | ||||
-rw-r--r-- | build2/test/rule.cxx | 2 |
7 files changed, 25 insertions, 13 deletions
diff --git a/build2/algorithm b/build2/algorithm index 2243c47..e9098bd 100644 --- a/build2/algorithm +++ b/build2/algorithm @@ -190,13 +190,18 @@ namespace build2 // Note that this function can be used as a recipe. // target_state - execute_prerequisites (action, const target&); + straight_execute_prerequisites (action, const target&); // As above but iterates over the prerequisites in reverse. // target_state reverse_execute_prerequisites (action, const target&); + // Call straight or reverse depending on the current mode. + // + target_state + execute_prerequisites (action, const target&); + // A version of the above that also determines whether the action needs to // be executed on the target based on the passed timestamp and filter. // @@ -214,7 +219,7 @@ namespace build2 // recursively linking liba{} prerequisites). // // Note that because we use mtime, this function should normally only be - // used in the perform_update action. + // used in the perform_update action (which is straight). // using prerequisite_filter = function<bool (const target&)>; diff --git a/build2/algorithm.cxx b/build2/algorithm.cxx index 1ede115..872b10e 100644 --- a/build2/algorithm.cxx +++ b/build2/algorithm.cxx @@ -669,6 +669,8 @@ namespace build2 action a, const target& t, const timestamp& mt, const prerequisite_filter& pf) { + assert (current_mode == execution_mode::first); + // Pretty much as straight_execute_members() but hairier. // target_state rs (target_state::unchanged); @@ -766,9 +768,7 @@ namespace build2 target_state default_action (action a, const target& t) { - return current_mode == execution_mode::first - ? execute_prerequisites (a, t) - : reverse_execute_prerequisites (a, t); + return execute_prerequisites (a, t); } target_state diff --git a/build2/algorithm.ixx b/build2/algorithm.ixx index 9ff56f8..33a5fe0 100644 --- a/build2/algorithm.ixx +++ b/build2/algorithm.ixx @@ -194,7 +194,7 @@ namespace build2 } inline target_state - execute_prerequisites (action a, const target& t) + straight_execute_prerequisites (action a, const target& t) { auto& p (t.prerequisite_targets); return straight_execute_members (a, t, p.data (), p.size ()); @@ -207,6 +207,13 @@ namespace build2 return reverse_execute_members (a, t, p.data (), p.size ()); } + inline target_state + execute_prerequisites (action a, const target& t) + { + auto& p (t.prerequisite_targets); + return execute_members (a, t, p.data (), p.size ()); + } + // If the first argument is NULL, then the result is treated as a boolean // value. // diff --git a/build2/cc/link.cxx b/build2/cc/link.cxx index 2bdf8c1..0aef9f0 100644 --- a/build2/cc/link.cxx +++ b/build2/cc/link.cxx @@ -909,7 +909,7 @@ namespace build2 // bool update (false); timestamp mt (t.mtime ()); - target_state ts (execute_prerequisites (a, t)); + target_state ts (straight_execute_prerequisites (a, t)); // If targeting Windows, take care of the manifest. // diff --git a/build2/install/rule.cxx b/build2/install/rule.cxx index 45e4710..13d8919 100644 --- a/build2/install/rule.cxx +++ b/build2/install/rule.cxx @@ -231,7 +231,7 @@ namespace build2 // Swap our prerequisite targets back in and execute. // t.prerequisite_targets.swap (pt); - r |= execute_prerequisites (a, t); + r |= straight_execute_prerequisites (a, t); pt.swap (t.prerequisite_targets); // In case we get re-executed. return r; @@ -656,7 +656,7 @@ namespace build2 // First handle installable prerequisites. // - target_state r (execute_prerequisites (a, t)); + target_state r (straight_execute_prerequisites (a, t)); // Then installable ad hoc group members, if any. // diff --git a/build2/rule.cxx b/build2/rule.cxx index 922a4f7..c18173b 100644 --- a/build2/rule.cxx +++ b/build2/rule.cxx @@ -167,11 +167,11 @@ namespace build2 { target_state ts (target_state::unchanged); - // First update prerequisites (e.g. create parent directories) - // then create this directory. + // First update prerequisites (e.g. create parent directories) then create + // this directory. // if (!t.prerequisite_targets.empty ()) - ts = execute_prerequisites (a, t); + ts = straight_execute_prerequisites (a, t); const dir_path& d (t.dir); // Everything is in t.dir. diff --git a/build2/test/rule.cxx b/build2/test/rule.cxx index 9dc24cd..1ce6efb 100644 --- a/build2/test/rule.cxx +++ b/build2/test/rule.cxx @@ -696,7 +696,7 @@ namespace build2 { // Run the alias recipe first then the test. // - target_state r (execute_prerequisites (a, t)); + target_state r (straight_execute_prerequisites (a, t)); // Note that we reuse the prerequisite_targets prepared by the standard // search and match. |