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: fix line number in debug log after return...



details:   https://anonhg.NetBSD.org/src/rev/4410ec64b9f1
branches:  trunk
changeset: 359529:4410ec64b9f1
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jan 08 22:24:20 2022 +0000

description:
make: fix line number in debug log after returning from a file

The parser returns to the next line, not to the current line.

diffstat:

 usr.bin/make/parse.c                        |  6 +++---
 usr.bin/make/unit-tests/opt-debug-parse.exp |  8 ++++----
 usr.bin/make/unit-tests/opt-debug-parse.mk  |  7 ++++---
 3 files changed, 11 insertions(+), 10 deletions(-)

diffs (72 lines):

diff -r 82073add6128 -r 4410ec64b9f1 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Sat Jan 08 22:13:43 2022 +0000
+++ b/usr.bin/make/parse.c      Sat Jan 08 22:24:20 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.640 2022/01/08 21:28:59 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.641 2022/01/08 22:24:20 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.640 2022/01/08 21:28:59 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.641 2022/01/08 22:24:20 rillig Exp $");
 
 /*
  * A file being read.
@@ -2263,7 +2263,7 @@
 
        curFile = CurFile();
        DEBUG2(PARSE, "ParseEOF: returning to file %s, line %d\n",
-           curFile->name.str, curFile->lineno);
+           curFile->name.str, curFile->readLines + 1);
 
        SetParseFile(curFile->name.str);
        return true;
diff -r 82073add6128 -r 4410ec64b9f1 usr.bin/make/unit-tests/opt-debug-parse.exp
--- a/usr.bin/make/unit-tests/opt-debug-parse.exp       Sat Jan 08 22:13:43 2022 +0000
+++ b/usr.bin/make/unit-tests/opt-debug-parse.exp       Sat Jan 08 22:24:20 2022 +0000
@@ -3,14 +3,14 @@
 Parsing line 17: .info trace with multi-line .for loop head
 make: "opt-debug-parse.mk" line 17: trace with multi-line .for loop head
        in .include from opt-debug-parse.mk:18
-ParseEOF: returning to file opt-debug-parse.mk, line 18
+ParseEOF: returning to file opt-debug-parse.mk, line 19
 SetFilenameVars: ${.PARSEDIR} = `<curdir>' ${.PARSEFILE} = `opt-debug-parse.mk'
-Parsing line 23: .include "/dev/null"
+Parsing line 24: .include "/dev/null"
 Parse_PushInput: file /dev/null, line 1
 SetFilenameVars: ${.PARSEDIR} = `/dev' ${.PARSEFILE} = `null'
 SetFilenameVars: ${.INCLUDEDFROMDIR} = `<curdir>' ${.INCLUDEDFROMFILE} = `opt-debug-parse.mk'
-ParseEOF: returning to file opt-debug-parse.mk, line 23
+ParseEOF: returning to file opt-debug-parse.mk, line 25
 SetFilenameVars: ${.PARSEDIR} = `<curdir>' ${.PARSEFILE} = `opt-debug-parse.mk'
-Parsing line 25: .MAKEFLAGS: -d0
+Parsing line 26: .MAKEFLAGS: -d0
 ParseDependency(.MAKEFLAGS: -d0)
 exit status 0
diff -r 82073add6128 -r 4410ec64b9f1 usr.bin/make/unit-tests/opt-debug-parse.mk
--- a/usr.bin/make/unit-tests/opt-debug-parse.mk        Sat Jan 08 22:13:43 2022 +0000
+++ b/usr.bin/make/unit-tests/opt-debug-parse.mk        Sat Jan 08 22:24:20 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: opt-debug-parse.mk,v 1.3 2022/01/08 22:13:43 rillig Exp $
+# $NetBSD: opt-debug-parse.mk,v 1.4 2022/01/08 22:24:20 rillig Exp $
 #
 # Tests for the -dp command line option, which adds debug logging about
 # makefile parsing.
@@ -16,10 +16,11 @@
     value
 .info trace with multi-line .for loop head
 .endfor
-# FIXME: The .exp file says 'in .include from opt-debug-parse.mk:19', which is
+# FIXME: The .exp file says 'in .include from opt-debug-parse.mk:18', which is
 # completely wrong.  It should rather say 'in .for loop from :13'.
 
-# XXX: The debug log should return to "line 24" instead of "line 23".
+# Before parse.c 1.461 from 2022-01-08, the debug log said it returned to
+# the line of the '.include' instead of the line following it.
 .include "/dev/null"
 
 .MAKEFLAGS: -d0



Home | Main Index | Thread Index | Old Index