diff options
Diffstat (limited to 'libbuild2')
-rw-r--r-- | libbuild2/adhoc-rule-buildscript.cxx | 2 | ||||
-rw-r--r-- | libbuild2/cc/compile-rule.cxx | 2 | ||||
-rw-r--r-- | libbuild2/rule.cxx | 30 | ||||
-rw-r--r-- | libbuild2/rule.hxx | 4 |
4 files changed, 20 insertions, 18 deletions
diff --git a/libbuild2/adhoc-rule-buildscript.cxx b/libbuild2/adhoc-rule-buildscript.cxx index 0263ddd..c3e559c 100644 --- a/libbuild2/adhoc-rule-buildscript.cxx +++ b/libbuild2/adhoc-rule-buildscript.cxx @@ -843,7 +843,7 @@ namespace build2 } if (dir != nullptr) - fsdir_rule::perform_update_direct (a, t); + fsdir_rule::perform_update_direct (a, *dir); // Because the depdb preamble can access $<, we have to blank out all the // ad hoc prerequisites. Since we will still need them later, we "move" diff --git a/libbuild2/cc/compile-rule.cxx b/libbuild2/cc/compile-rule.cxx index 128fe14..4f94167 100644 --- a/libbuild2/cc/compile-rule.cxx +++ b/libbuild2/cc/compile-rule.cxx @@ -1145,7 +1145,7 @@ namespace build2 // this can very well be happening in parallel. But that's not a // problem since fsdir{}'s update is idempotent. // - fsdir_rule::perform_update_direct (a, t); + fsdir_rule::perform_update_direct (a, *dir); } // Note: the leading '@' is reserved for the module map prefix (see diff --git a/libbuild2/rule.cxx b/libbuild2/rule.cxx index a3e3268..79ccb86 100644 --- a/libbuild2/rule.cxx +++ b/libbuild2/rule.cxx @@ -352,16 +352,17 @@ namespace build2 } void fsdir_rule:: - perform_update_direct (action a, const target& t) + perform_update_direct (action a, const fsdir& t) { // First create the parent directory. If present, it is always first. // - const target* p (t.prerequisite_targets[a].empty () - ? nullptr - : t.prerequisite_targets[a][0]); - - if (p != nullptr && p->is_a<fsdir> ()) - perform_update_direct (a, *p); + if (const target* p = (t.prerequisite_targets[a].empty () + ? nullptr + : t.prerequisite_targets[a][0])) + { + if (const fsdir* fp = p->is_a<fsdir> ()) + perform_update_direct (a, *fp); + } // The same code as in perform_update() above. // @@ -394,7 +395,7 @@ namespace build2 } void fsdir_rule:: - perform_clean_direct (action a, const target& t) + perform_clean_direct (action a, const fsdir& t) { // The same code as in perform_clean() above. // @@ -402,12 +403,13 @@ namespace build2 // Then clean the parent directory. If present, it is always first. // - const target* p (t.prerequisite_targets[a].empty () - ? nullptr - : t.prerequisite_targets[a][0]); - - if (p != nullptr && p->is_a<fsdir> ()) - perform_clean_direct (a, *p); + if (const target* p = (t.prerequisite_targets[a].empty () + ? nullptr + : t.prerequisite_targets[a][0])) + { + if (const fsdir* fp = p->is_a<fsdir> ()) + perform_clean_direct (a, *fp); + } } const fsdir_rule fsdir_rule::instance; diff --git a/libbuild2/rule.hxx b/libbuild2/rule.hxx index 7e5ddb1..e4afcd4 100644 --- a/libbuild2/rule.hxx +++ b/libbuild2/rule.hxx @@ -189,10 +189,10 @@ namespace build2 // of fsdir{} without the overhead of switching to the execute phase. // static void - perform_update_direct (action, const target&); + perform_update_direct (action, const fsdir&); static void - perform_clean_direct (action, const target&); + perform_clean_direct (action, const fsdir&); fsdir_rule () {} static const fsdir_rule instance; |