Module Name:    src
Committed By:   rillig
Date:           Sun Jan  9 11:43:58 UTC 2022

Modified Files:
        src/usr.bin/make: parse.c
        src/usr.bin/make/unit-tests: include-main.exp opt-debug-parse.exp

Log Message:
make: remove redundant lines from stack traces

These lines repeated the information from the .for loop line above them.


To generate a diff of this commit:
cvs rdiff -u -r1.645 -r1.646 src/usr.bin/make/parse.c
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/include-main.exp
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/opt-debug-parse.exp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.645 src/usr.bin/make/parse.c:1.646
--- src/usr.bin/make/parse.c:1.645	Sun Jan  9 11:28:04 2022
+++ src/usr.bin/make/parse.c	Sun Jan  9 11:43:58 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.645 2022/01/09 11:28:04 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.646 2022/01/09 11:43:58 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -106,7 +106,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.645 2022/01/09 11:28:04 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.646 2022/01/09 11:43:58 rillig Exp $");
 
 /*
  * A file being read.
@@ -357,13 +357,10 @@ PrintStackTrace(void)
 			debug_printf("\tin .for loop from %s:%d with %s\n",
 			    fname, entry->forHeadLineno, details);
 			free(details);
-		} else {
-			int lineno =
-			    i + 1 < n && entries[i + 1].forLoop != NULL
-				? entries[i + 1].forHeadLineno
-				: entry->lineno;
-			debug_printf("\tin %s:%d\n", fname, lineno);
-		}
+		} else if (i + 1 < n && entries[i + 1].forLoop != NULL) {
+			/* entry->lineno is not a useful line number */
+		} else
+			debug_printf("\tin %s:%d\n", fname, entry->lineno);
 	}
 }
 

Index: src/usr.bin/make/unit-tests/include-main.exp
diff -u src/usr.bin/make/unit-tests/include-main.exp:1.10 src/usr.bin/make/unit-tests/include-main.exp:1.11
--- src/usr.bin/make/unit-tests/include-main.exp:1.10	Sat Jan  8 23:52:26 2022
+++ src/usr.bin/make/unit-tests/include-main.exp	Sun Jan  9 11:43:58 2022
@@ -7,7 +7,6 @@ make: "include-subsub.mk" line 5: subsub
 	in .for loop from include-sub.mk:31 with i = include
 	in .for loop from include-sub.mk:30 with i = nested
 	in .for loop from include-sub.mk:29 with i = deeply
-	in include-sub.mk:29
 	in include-main.mk:27
 Parsing line 6: .MAKEFLAGS: -d0
 ParseDependency(.MAKEFLAGS: -d0)

Index: src/usr.bin/make/unit-tests/opt-debug-parse.exp
diff -u src/usr.bin/make/unit-tests/opt-debug-parse.exp:1.7 src/usr.bin/make/unit-tests/opt-debug-parse.exp:1.8
--- src/usr.bin/make/unit-tests/opt-debug-parse.exp:1.7	Sat Jan  8 23:52:26 2022
+++ src/usr.bin/make/unit-tests/opt-debug-parse.exp	Sun Jan  9 11:43:58 2022
@@ -3,7 +3,6 @@ SetFilenameVars: ${.PARSEDIR} = `<curdir
 Parsing line 20: .info trace with multi-line .for loop head
 make: "opt-debug-parse.mk" line 20: trace with multi-line .for loop head
 	in .for loop from opt-debug-parse.mk:16 with var = value
-	in opt-debug-parse.mk:16
 ParseEOF: returning to file opt-debug-parse.mk, line 22
 SetFilenameVars: ${.PARSEDIR} = `<curdir>' ${.PARSEFILE} = `opt-debug-parse.mk'
 Parsing line 25: .include "/dev/null"
@@ -17,11 +16,9 @@ SetFilenameVars: ${.PARSEDIR} = `<curdir
 Parsing line 31: .info trace
 make: "opt-debug-parse.mk" line 31: trace
 	in .for loop from opt-debug-parse.mk:30 with a = 1, b = 2, c = 3
-	in opt-debug-parse.mk:30
 Parsing line 31: .info trace
 make: "opt-debug-parse.mk" line 31: trace
 	in .for loop from opt-debug-parse.mk:30 with a = 4, b = 5, c = 6
-	in opt-debug-parse.mk:30
 ParseEOF: returning to file opt-debug-parse.mk, line 33
 SetFilenameVars: ${.PARSEDIR} = `<curdir>' ${.PARSEFILE} = `opt-debug-parse.mk'
 Parsing line 35: .MAKEFLAGS: -d0

Reply via email to