From e50b11ceb81089fc32eac7614b66daef7119f620 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 12 Jun 2018 09:05:48 +0200 Subject: Remove output if ld fails This helps link.exe which leaves broken the output around. --- build2/cc/link-rule.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/build2/cc/link-rule.cxx b/build2/cc/link-rule.cxx index 4e7ca9a..ce1a9f6 100644 --- a/build2/cc/link-rule.cxx +++ b/build2/cc/link-rule.cxx @@ -2032,6 +2032,13 @@ namespace build2 try_rmfile (relt, true); } + // Remove the target file if any of the subsequent (after ld) actions + // fail or if ld fails but does not clean up its mess (like link.exe). + // If we don't do that, then we will end up with a broken build that is + // up-to-date. + // + auto_rmfile rm (relt); + if (verb >= 2) print_process (args); else if (verb) @@ -2090,11 +2097,6 @@ namespace build2 throw failed (); } - // Remove the target file if any of the subsequent actions fail. If we - // don't do that, we will end up with a broken build that is up-to-date. - // - auto_rmfile rm (relt); - if (ranlib) { const process_path& rl (cast (ranlib)); -- cgit v1.1