Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make(1): don't make .END if the main targets al...



details:   https://anonhg.NetBSD.org/src/rev/f22a7f7be772
branches:  trunk
changeset: 1016947:f22a7f7be772
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Dec 07 01:04:06 2020 +0000

description:
make(1): don't make .END if the main targets already failed

This only applies to -k mode.  By default, make exits earlier and skips
the .END node as well if an error occurs.

diffstat:

 usr.bin/make/compat.c                           |  6 +++---
 usr.bin/make/unit-tests/deptgt-end-fail-all.exp |  3 ---
 usr.bin/make/unit-tests/deptgt-end-fail-all.mk  |  8 +++++++-
 usr.bin/make/unit-tests/deptgt-end-fail.exp     |  9 ---------
 usr.bin/make/unit-tests/deptgt-end-fail.mk      |  8 +++++---
 5 files changed, 15 insertions(+), 19 deletions(-)

diffs (118 lines):

diff -r 2851e8276a39 -r f22a7f7be772 usr.bin/make/compat.c
--- a/usr.bin/make/compat.c     Mon Dec 07 00:53:30 2020 +0000
+++ b/usr.bin/make/compat.c     Mon Dec 07 01:04:06 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat.c,v 1.199 2020/12/07 00:53:30 rillig Exp $      */
+/*     $NetBSD: compat.c,v 1.200 2020/12/07 01:04:06 rillig Exp $      */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -96,7 +96,7 @@
 #include "pathnames.h"
 
 /*     "@(#)compat.c   8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: compat.c,v 1.199 2020/12/07 00:53:30 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.200 2020/12/07 01:04:06 rillig Exp $");
 
 static GNode *curTarg = NULL;
 static pid_t compatChild;
@@ -729,7 +729,7 @@
        /*
         * If the user has defined a .END target, run its commands.
         */
-       if (!mainDepError) {
+       if (!mainError && !mainDepError) {
                GNode *endNode = Targ_GetEndNode();
                Compat_Make(endNode, endNode);
                endError = GNode_IsError(endNode);
diff -r 2851e8276a39 -r f22a7f7be772 usr.bin/make/unit-tests/deptgt-end-fail-all.exp
--- a/usr.bin/make/unit-tests/deptgt-end-fail-all.exp   Mon Dec 07 00:53:30 2020 +0000
+++ b/usr.bin/make/unit-tests/deptgt-end-fail-all.exp   Mon Dec 07 01:04:06 2020 +0000
@@ -1,9 +1,6 @@
 : Making all out of nothing.
 false
 *** Error code 1 (continuing)
-: Making .END out of nothing.
-false
-*** Error code 1 (continuing)
 
 Stop.
 make: stopped in unit-tests
diff -r 2851e8276a39 -r f22a7f7be772 usr.bin/make/unit-tests/deptgt-end-fail-all.mk
--- a/usr.bin/make/unit-tests/deptgt-end-fail-all.mk    Mon Dec 07 00:53:30 2020 +0000
+++ b/usr.bin/make/unit-tests/deptgt-end-fail-all.mk    Mon Dec 07 01:04:06 2020 +0000
@@ -1,8 +1,14 @@
-# $NetBSD: deptgt-end-fail-all.mk,v 1.1 2020/12/06 21:22:04 rillig Exp $
+# $NetBSD: deptgt-end-fail-all.mk,v 1.2 2020/12/07 01:04:07 rillig Exp $
 #
 # Test whether the commands from the .END target are run even if there is
 # an error before.  The manual page says "after everything else is done",
 # which leaves room for interpretation.
+#
+# Until 2020-12-07, the .END node was made even if the main nodes had failed.
+# This was not intended since the .END node had already been skipped if a
+# dependency of the main nodes had failed, just not if one of the main nodes
+# themselves had failed.  This inconsistency was not worth keeping.  To run
+# some commands on error, use the .ERROR target instead, see deptgt-error.mk.
 
 all: .PHONY
        : Making ${.TARGET} out of nothing.
diff -r 2851e8276a39 -r f22a7f7be772 usr.bin/make/unit-tests/deptgt-end-fail.exp
--- a/usr.bin/make/unit-tests/deptgt-end-fail.exp       Mon Dec 07 00:53:30 2020 +0000
+++ b/usr.bin/make/unit-tests/deptgt-end-fail.exp       Mon Dec 07 01:04:06 2020 +0000
@@ -84,8 +84,6 @@
 : Making all-dep out of nothing.
 : Making all from all-dep.
 *** Error code 1 (continuing)
-: Making end-dep out of nothing.
-: Making .END from end-dep.
 
 Stop.
 make: stopped in unit-tests
@@ -96,8 +94,6 @@
 : Making all-dep out of nothing.
 : Making all from all-dep.
 *** Error code 1 (continuing)
-: Making end-dep out of nothing.
-*** Error code 1 (continuing)
 
 Stop.
 make: stopped in unit-tests
@@ -108,9 +104,6 @@
 : Making all-dep out of nothing.
 : Making all from all-dep.
 *** Error code 1 (continuing)
-: Making end-dep out of nothing.
-: Making .END from end-dep.
-*** Error code 1 (continuing)
 
 Stop.
 make: stopped in unit-tests
@@ -121,8 +114,6 @@
 : Making all-dep out of nothing.
 : Making all from all-dep.
 *** Error code 1 (continuing)
-: Making end-dep out of nothing.
-*** Error code 1 (continuing)
 
 Stop.
 make: stopped in unit-tests
diff -r 2851e8276a39 -r f22a7f7be772 usr.bin/make/unit-tests/deptgt-end-fail.mk
--- a/usr.bin/make/unit-tests/deptgt-end-fail.mk        Mon Dec 07 00:53:30 2020 +0000
+++ b/usr.bin/make/unit-tests/deptgt-end-fail.mk        Mon Dec 07 01:04:06 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: deptgt-end-fail.mk,v 1.5 2020/12/07 00:53:30 rillig Exp $
+# $NetBSD: deptgt-end-fail.mk,v 1.6 2020/12/07 01:04:07 rillig Exp $
 #
 # Tests for an errors in the main target, its dependencies,
 # the .END node and its dependencies.
@@ -63,5 +63,7 @@
 # because of errors.", followed by "exit status 0", which contradicted
 # each other.
 
-# XXX: As of 2020-12-06, '.END' is made if 'all' fails, but if a dependency
-# of 'all' fails, it is skipped.  This is inconsistent.
+# Until 2020-12-07, '.END' was even made if 'all' failed, but if a dependency
+# of 'all' failed, it was skipped.  This inconsistency was not needed for
+# anything and thus has been dropped.  To run some commands on error, use the
+# .ERROR target instead, see deptgt-error.mk.



Home | Main Index | Thread Index | Old Index