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: when exiting due to an error, print graph...
details: https://anonhg.NetBSD.org/src/rev/9c9d87762923
branches: trunk
changeset: 959156:9c9d87762923
user: rillig <rillig%NetBSD.org@localhost>
date: Tue Feb 02 17:47:56 2021 +0000
description:
make: when exiting due to an error, print graph information
The code now does what the manual page has been promising since at least
1993.
diffstat:
usr.bin/make/compat.c | 8 ++-
usr.bin/make/unit-tests/opt-debug-graph2.exp | 83 ++++++++++++++++++++++++++++
usr.bin/make/unit-tests/opt-debug-graph2.mk | 4 +-
usr.bin/make/unit-tests/opt-debug-graph3.exp | 83 ++++++++++++++++++++++++++++
usr.bin/make/unit-tests/opt-debug-graph3.mk | 4 +-
5 files changed, 176 insertions(+), 6 deletions(-)
diffs (245 lines):
diff -r 1e87328139f7 -r 9c9d87762923 usr.bin/make/compat.c
--- a/usr.bin/make/compat.c Tue Feb 02 17:27:35 2021 +0000
+++ b/usr.bin/make/compat.c Tue Feb 02 17:47:56 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat.c,v 1.221 2021/02/01 21:04:10 rillig Exp $ */
+/* $NetBSD: compat.c,v 1.222 2021/02/02 17:47:56 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.221 2021/02/01 21:04:10 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.222 2021/02/02 17:47:56 rillig Exp $");
static GNode *curTarg = NULL;
static pid_t compatChild;
@@ -749,6 +749,10 @@
}
if (errorNode != NULL) {
+ if (DEBUG(GRAPH2))
+ Targ_PrintGraph(2);
+ else if (DEBUG(GRAPH3))
+ Targ_PrintGraph(3);
PrintOnError(errorNode, "\nStop.");
exit(1);
}
diff -r 1e87328139f7 -r 9c9d87762923 usr.bin/make/unit-tests/opt-debug-graph2.exp
--- a/usr.bin/make/unit-tests/opt-debug-graph2.exp Tue Feb 02 17:27:35 2021 +0000
+++ b/usr.bin/make/unit-tests/opt-debug-graph2.exp Tue Feb 02 17:47:56 2021 +0000
@@ -4,6 +4,89 @@
false
*** Error code 1 (continuing)
`all' not remade because of errors.
+#*** Input graph:
+# made-target, made MADE, type OP_DEPENDS|OP_PHONY|OP_HAS_COMMANDS|OP_DEPS_FOUND|OP_MARK, flags REMAKE|DONE_ALLSRC
+#
+# *** MAIN TARGET ***
+# No unmade children
+# last modified <timestamp>: made
+# parents: all
+made-target :
+ (null)
+
+
+# error-target, made ERROR, type OP_DEPENDS|OP_PHONY|OP_HAS_COMMANDS|OP_DEPS_FOUND|OP_MARK, flags REMAKE|DONE_ALLSRC
+#
+# No unmade children
+# nonexistent (maybe): error when made
+# parents: all
+error-target :
+ (null)
+
+
+# aborted-target, made ABORTED, type OP_DEPENDS|OP_PHONY|OP_DEPS_FOUND|OP_MARK, flags none
+# aborted-target-dependency, made ERROR, type OP_DEPENDS|OP_PHONY|OP_HAS_COMMANDS|OP_DEPS_FOUND|OP_MARK, flags REMAKE|DONE_ALLSRC
+#
+# No unmade children
+# nonexistent (maybe): error when made
+# parents: aborted-target
+aborted-target-dependency:
+ (null)
+
+
+# all, made ABORTED, type OP_DEPENDS|OP_DEPS_FOUND, flags CHILDMADE|FORCE
+#
+# 3 unmade children
+# nonexistent (maybe): aborted
+all : made-target error-target aborted-target
+
+
+# .END, made UNMADE, type OP_SPECIAL, flags none
+
+
+#
+# Files that are only sources:
+# .END [.END]
+#*** Global Variables:
+.ALLTARGETS = made-target error-target aborted-target aborted-target-dependency all .END
+.CURDIR = <curdir>
+.INCLUDES =
+.LIBS =
+.MAKE = <details omitted>
+.MAKE.DEPENDFILE = <details omitted>
+.MAKE.GID = <details omitted>
+.MAKE.LEVEL = <details omitted>
+.MAKE.MAKEFILES = <details omitted>
+.MAKE.MAKEFILE_PREFERENCE = <details omitted>
+.MAKE.OS = <details omitted>
+.MAKE.PATH_FILEMON = <details omitted>
+.MAKE.PID = <details omitted>
+.MAKE.PPID = <details omitted>
+.MAKE.UID = <details omitted>
+.MAKEFLAGS = -r -k -d g2
+.MAKEOVERRIDES =
+.OBJDIR = <curdir>
+.PATH = . <curdir>
+.TARGETS = all
+.newline =
+
+MACHINE = <details omitted>
+MACHINE_ARCH = <details omitted>
+MAKE = <details omitted>
+MFLAGS = -r -k -d g2
+#*** Command-line Variables:
+.MAKE.LEVEL.ENV = MAKELEVEL
+.SHELL = <details omitted>
+
+#*** Directory Cache:
+# Stats: 0 hits 4 misses 0 near misses 0 losers (0%)
+# refs hits directory
+# 1 0 <curdir>
+# 1 0 .
+# 1 0 <defsyspath>
+
+#*** Suffixes:
+#*** Transformations:
Stop.
make: stopped in unit-tests
diff -r 1e87328139f7 -r 9c9d87762923 usr.bin/make/unit-tests/opt-debug-graph2.mk
--- a/usr.bin/make/unit-tests/opt-debug-graph2.mk Tue Feb 02 17:27:35 2021 +0000
+++ b/usr.bin/make/unit-tests/opt-debug-graph2.mk Tue Feb 02 17:47:56 2021 +0000
@@ -1,9 +1,9 @@
-# $NetBSD: opt-debug-graph2.mk,v 1.2 2021/02/02 17:27:35 rillig Exp $
+# $NetBSD: opt-debug-graph2.mk,v 1.3 2021/02/02 17:47:56 rillig Exp $
#
# Tests for the -dg2 command line option, which prints the input
# graph after making everything, or before exiting on error.
#
-# FIXME: The documentation is wrong. There is no debug output despite
+# Before compat.c 1.222 from 2021-02-02, there was no debug output despite
# the error.
.MAKEFLAGS: -dg2
diff -r 1e87328139f7 -r 9c9d87762923 usr.bin/make/unit-tests/opt-debug-graph3.exp
--- a/usr.bin/make/unit-tests/opt-debug-graph3.exp Tue Feb 02 17:27:35 2021 +0000
+++ b/usr.bin/make/unit-tests/opt-debug-graph3.exp Tue Feb 02 17:47:56 2021 +0000
@@ -4,6 +4,89 @@
false
*** Error code 1 (continuing)
`all' not remade because of errors.
+#*** Input graph:
+# made-target, made MADE, type OP_DEPENDS|OP_PHONY|OP_HAS_COMMANDS|OP_DEPS_FOUND|OP_MARK, flags REMAKE|DONE_ALLSRC
+#
+# *** MAIN TARGET ***
+# No unmade children
+# last modified <timestamp>: made
+# parents: all
+made-target :
+ (null)
+
+
+# error-target, made ERROR, type OP_DEPENDS|OP_PHONY|OP_HAS_COMMANDS|OP_DEPS_FOUND|OP_MARK, flags REMAKE|DONE_ALLSRC
+#
+# No unmade children
+# nonexistent (maybe): error when made
+# parents: all
+error-target :
+ (null)
+
+
+# aborted-target, made ABORTED, type OP_DEPENDS|OP_PHONY|OP_DEPS_FOUND|OP_MARK, flags none
+# aborted-target-dependency, made ERROR, type OP_DEPENDS|OP_PHONY|OP_HAS_COMMANDS|OP_DEPS_FOUND|OP_MARK, flags REMAKE|DONE_ALLSRC
+#
+# No unmade children
+# nonexistent (maybe): error when made
+# parents: aborted-target
+aborted-target-dependency:
+ (null)
+
+
+# all, made ABORTED, type OP_DEPENDS|OP_DEPS_FOUND, flags CHILDMADE|FORCE
+#
+# 3 unmade children
+# nonexistent (maybe): aborted
+all : made-target error-target aborted-target
+
+
+# .END, made UNMADE, type OP_SPECIAL, flags none
+
+
+#
+# Files that are only sources:
+# .END [.END]
+#*** Global Variables:
+.ALLTARGETS = made-target error-target aborted-target aborted-target-dependency all .END
+.CURDIR = <curdir>
+.INCLUDES =
+.LIBS =
+.MAKE = <details omitted>
+.MAKE.DEPENDFILE = <details omitted>
+.MAKE.GID = <details omitted>
+.MAKE.LEVEL = <details omitted>
+.MAKE.MAKEFILES = <details omitted>
+.MAKE.MAKEFILE_PREFERENCE = <details omitted>
+.MAKE.OS = <details omitted>
+.MAKE.PATH_FILEMON = <details omitted>
+.MAKE.PID = <details omitted>
+.MAKE.PPID = <details omitted>
+.MAKE.UID = <details omitted>
+.MAKEFLAGS = -r -k -d g3
+.MAKEOVERRIDES =
+.OBJDIR = <curdir>
+.PATH = . <curdir>
+.TARGETS = all
+.newline =
+
+MACHINE = <details omitted>
+MACHINE_ARCH = <details omitted>
+MAKE = <details omitted>
+MFLAGS = -r -k -d g3
+#*** Command-line Variables:
+.MAKE.LEVEL.ENV = MAKELEVEL
+.SHELL = <details omitted>
+
+#*** Directory Cache:
+# Stats: 0 hits 4 misses 0 near misses 0 losers (0%)
+# refs hits directory
+# 1 0 <curdir>
+# 1 0 .
+# 1 0 <defsyspath>
+
+#*** Suffixes:
+#*** Transformations:
Stop.
make: stopped in unit-tests
diff -r 1e87328139f7 -r 9c9d87762923 usr.bin/make/unit-tests/opt-debug-graph3.mk
--- a/usr.bin/make/unit-tests/opt-debug-graph3.mk Tue Feb 02 17:27:35 2021 +0000
+++ b/usr.bin/make/unit-tests/opt-debug-graph3.mk Tue Feb 02 17:47:56 2021 +0000
@@ -1,9 +1,9 @@
-# $NetBSD: opt-debug-graph3.mk,v 1.2 2021/02/02 17:27:35 rillig Exp $
+# $NetBSD: opt-debug-graph3.mk,v 1.3 2021/02/02 17:47:56 rillig Exp $
#
# Tests for the -dg3 command line option, which prints the input
# graph before exiting on error.
#
-# FIXME: The documentation is wrong. There is no debug output despite
+# Before compat.c 1.222 from 2021-02-02, there was no debug output despite
# the error.
.MAKEFLAGS: -dg3
Home |
Main Index |
Thread Index |
Old Index