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: reduce confusing code in ParseForLoop
details: https://anonhg.NetBSD.org/src/rev/5d6a900963b5
branches: trunk
changeset: 359531:5d6a900963b5
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Jan 08 22:42:27 2022 +0000
description:
make: reduce confusing code in ParseForLoop
The previous version of the code gave the wrong impression that For_Eval
would modify CurFile. That happens only later, in For_Run.
No functional change.
diffstat:
usr.bin/make/parse.c | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
diffs (58 lines):
diff -r ae41363cc510 -r 5d6a900963b5 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c Sat Jan 08 22:24:53 2022 +0000
+++ b/usr.bin/make/parse.c Sat Jan 08 22:42:27 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.641 2022/01/08 22:24:20 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.642 2022/01/08 22:42:27 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.641 2022/01/08 22:24:20 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.642 2022/01/08 22:42:27 rillig Exp $");
/*
* A file being read.
@@ -336,9 +336,6 @@
const IncludedFile *entries;
size_t i, n;
- if (!DEBUG(PARSE))
- return;
-
entries = GetInclude(0);
n = includes.len;
if (n == 0)
@@ -463,7 +460,8 @@
parseErrors++;
}
- PrintStackTrace();
+ if (DEBUG(PARSE))
+ PrintStackTrace();
}
static void
@@ -2508,16 +2506,17 @@
int bodyReadLines;
int forLevel;
- forHeadLineno = CurFile()->lineno;
rval = For_Eval(line);
if (rval == 0)
return false; /* Not a .for line */
if (rval < 0)
return true; /* Syntax error - error printed, ignore line */
+ forHeadLineno = CurFile()->lineno;
+ bodyReadLines = CurFile()->readLines;
+
/* Accumulate the loop body until the matching '.endfor'. */
forLevel = 1;
- bodyReadLines = CurFile()->readLines;
do {
line = ReadLowLevelLine(LK_FOR_BODY);
if (line == NULL) {
Home |
Main Index |
Thread Index |
Old Index