Module Name: src
Committed By: sjg
Date: Fri Sep 23 22:58:15 UTC 2022
Modified Files:
src/usr.bin/make: cond.c make.h parse.c
Log Message:
Cond_reset_depth just use cond_min_depth
To avoid errors from unclosed conditionals on .break
it is sufficient to just set cond_depth = cond_min_depth.
Patch from rillig
To generate a diff of this commit:
cvs rdiff -u -r1.337 -r1.338 src/usr.bin/make/cond.c
cvs rdiff -u -r1.304 -r1.305 src/usr.bin/make/make.h
cvs rdiff -u -r1.683 -r1.684 src/usr.bin/make/parse.c
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/cond.c
diff -u src/usr.bin/make/cond.c:1.337 src/usr.bin/make/cond.c:1.338
--- src/usr.bin/make/cond.c:1.337 Thu Sep 8 05:52:56 2022
+++ src/usr.bin/make/cond.c Fri Sep 23 22:58:15 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: cond.c,v 1.337 2022/09/08 05:52:56 rillig Exp $ */
+/* $NetBSD: cond.c,v 1.338 2022/09/23 22:58:15 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -95,7 +95,7 @@
#include "dir.h"
/* "@(#)cond.c 8.2 (Berkeley) 1/2/94" */
-MAKE_RCSID("$NetBSD: cond.c,v 1.337 2022/09/08 05:52:56 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.338 2022/09/23 22:58:15 sjg Exp $");
/*
* Conditional expressions conform to this grammar:
@@ -1284,7 +1284,7 @@ Cond_save_depth(void)
* when the loop started.
*/
void
-Cond_reset_depth(unsigned int depth)
+Cond_reset_depth(void)
{
- cond_depth = depth;
+ cond_depth = cond_min_depth;
}
Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.304 src/usr.bin/make/make.h:1.305
--- src/usr.bin/make/make.h:1.304 Fri Sep 2 16:24:31 2022
+++ src/usr.bin/make/make.h Fri Sep 23 22:58:15 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: make.h,v 1.304 2022/09/02 16:24:31 sjg Exp $ */
+/* $NetBSD: make.h,v 1.305 2022/09/23 22:58:15 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -800,7 +800,7 @@ void Compat_Make(GNode *, GNode *);
CondResult Cond_EvalCondition(const char *) MAKE_ATTR_USE;
CondResult Cond_EvalLine(const char *) MAKE_ATTR_USE;
void Cond_restore_depth(unsigned int);
-void Cond_reset_depth(unsigned int);
+void Cond_reset_depth(void);
unsigned int Cond_save_depth(void) MAKE_ATTR_USE;
/* dir.c; see also dir.h */
Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.683 src/usr.bin/make/parse.c:1.684
--- src/usr.bin/make/parse.c:1.683 Sat Sep 3 00:50:07 2022
+++ src/usr.bin/make/parse.c Fri Sep 23 22:58:15 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.683 2022/09/03 00:50:07 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.684 2022/09/23 22:58:15 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -105,7 +105,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.683 2022/09/03 00:50:07 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.684 2022/09/23 22:58:15 sjg Exp $");
/*
* A file being read.
@@ -2669,7 +2669,7 @@ HandleBreak(void)
if (curFile->forLoop != NULL) {
/* pretend we reached EOF */
For_Break(curFile->forLoop);
- Cond_reset_depth(curFile->cond_depth);
+ Cond_reset_depth();
ParseEOF();
} else
Parse_Error(PARSE_FATAL, "break outside of for loop");