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): extract DebugFailedTarget from Compat_...
details: https://anonhg.NetBSD.org/src/rev/19e6ca8c22b6
branches: trunk
changeset: 957296:19e6ca8c22b6
user: rillig <rillig%NetBSD.org@localhost>
date: Mon Nov 23 19:14:24 2020 +0000
description:
make(1): extract DebugFailedTarget from Compat_RunCommand
diffstat:
usr.bin/make/compat.c | 45 +++++++++++++++++++++++++--------------------
1 files changed, 25 insertions(+), 20 deletions(-)
diffs (73 lines):
diff -r 91578a43cd26 -r 19e6ca8c22b6 usr.bin/make/compat.c
--- a/usr.bin/make/compat.c Mon Nov 23 19:07:12 2020 +0000
+++ b/usr.bin/make/compat.c Mon Nov 23 19:14:24 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat.c,v 1.183 2020/11/15 22:31:03 rillig Exp $ */
+/* $NetBSD: compat.c,v 1.184 2020/11/23 19:14:24 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.183 2020/11/15 22:31:03 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.184 2020/11/23 19:14:24 rillig Exp $");
static GNode *curTarg = NULL;
static pid_t compatChild;
@@ -159,6 +159,27 @@
}
}
+static void
+DebugFailedTarget(const char *cmd, GNode *gn)
+{
+ const char *p = cmd;
+ debug_printf("\n*** Failed target: %s\n*** Failed command: ",
+ gn->name);
+
+ /* Replace runs of whitespace with a single space, to reduce
+ * the amount of whitespace for multi-line command lines. */
+ while (*p != '\0') {
+ if (ch_isspace(*p)) {
+ debug_printf(" ");
+ cpp_skip_whitespace(&p);
+ } else {
+ debug_printf("%c", *p);
+ p++;
+ }
+ }
+ debug_printf("\n");
+}
+
/* Execute the next command for a target. If the command returns an error,
* the node's made field is set to ERROR and creation stops.
*
@@ -373,24 +394,8 @@
}
#endif
if (status != 0) {
- if (DEBUG(ERROR)) {
- const char *p = cmd;
- debug_printf("\n*** Failed target: %s\n*** Failed command: ",
- gn->name);
-
- /* Replace runs of whitespace with a single space, to reduce
- * the amount of whitespace for multi-line command lines. */
- while (*p != '\0') {
- if (ch_isspace(*p)) {
- debug_printf(" ");
- cpp_skip_whitespace(&p);
- } else {
- debug_printf("%c", *p);
- p++;
- }
- }
- debug_printf("\n");
- }
+ if (DEBUG(ERROR))
+ DebugFailedTarget(cmd, gn);
printf("*** Error code %d", status);
}
} else {
Home |
Main Index |
Thread Index |
Old Index