make(1): fix line numbers in .for loops (since 2007-01-01)

This commit is contained in:
rillig 2020-12-19 12:24:46 +00:00
parent e8319c8295
commit c1c7380a9a
3 changed files with 15 additions and 15 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: parse.c,v 1.493 2020/12/19 10:57:17 rillig Exp $ */
/* $NetBSD: parse.c,v 1.494 2020/12/19 12:24:46 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -117,7 +117,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
MAKE_RCSID("$NetBSD: parse.c,v 1.493 2020/12/19 10:57:17 rillig Exp $");
MAKE_RCSID("$NetBSD: parse.c,v 1.494 2020/12/19 12:24:46 rillig Exp $");
/* types and constants */
@ -2814,8 +2814,8 @@ ParseGetLine(GetLineMode mode)
if (line_end == line || firstComment == line) {
if (res == PRLR_EOF)
return NULL;
/* Parse another line */
continue;
if (mode != PARSE_RAW)
continue;
}
/* We now have a line of data */

View File

@ -1,9 +1,9 @@
make: "directive-for-lines.mk" line 12: expect 18
make: "directive-for-lines.mk" line 12: expect 18
make: "directive-for-lines.mk" line 14: expect 24
make: "directive-for-lines.mk" line 12: expect 18
make: "directive-for-lines.mk" line 12: expect 18
make: "directive-for-lines.mk" line 14: expect 24
make: "directive-for-lines.mk" line 18: expect 18
make: "directive-for-lines.mk" line 18: expect 18
make: "directive-for-lines.mk" line 24: expect 24
make: "directive-for-lines.mk" line 18: expect 18
make: "directive-for-lines.mk" line 18: expect 18
make: "directive-for-lines.mk" line 24: expect 24
make: no target to make.
make: stopped in unit-tests

View File

@ -1,11 +1,11 @@
# $NetBSD: directive-for-lines.mk,v 1.1 2020/12/19 12:14:59 rillig Exp $
# $NetBSD: directive-for-lines.mk,v 1.2 2020/12/19 12:24:46 rillig Exp $
#
# Tests for the line numbers that are reported in .for loops.
#
# Since 2007-01-01 21:47:32 (git 4d3c468f96e1080e4d3cca8cc39067a73af14fbb),
# parse.c 1.127, the line numbers for the .info directives and error messages
# inside .for loops have been wrong since ParseGetLine skips empty lines, even
# when collecting the lines for the .for loop body.
# Between 2007-01-01 (git 4d3c468f96e1080e, parse.c 1.127) and 2020-12-19
# (parse.c 1.494), the line numbers for the .info directives and error
# messages inside .for loops had been wrong since ParseGetLine skipped empty
# lines, even when collecting the lines for the .for loop body.
.for outer in a b