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 variable and function names relating ...
details: https://anonhg.NetBSD.org/src/rev/b4feb5987494
branches: trunk
changeset: 370678:b4feb5987494
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Sep 24 10:26:31 2022 +0000
description:
make: fix variable and function names relating to .if nesting
The previous names were confusing since they suggested that cond_depth
instead of cond_min_depth would be saved and restored.
No functional change.
diffstat:
usr.bin/make/cond.c | 20 ++++++++++----------
usr.bin/make/make.h | 8 ++++----
usr.bin/make/parse.c | 14 ++++++++------
3 files changed, 22 insertions(+), 20 deletions(-)
diffs (142 lines):
diff -r 7cf5caeda59e -r b4feb5987494 usr.bin/make/cond.c
--- a/usr.bin/make/cond.c Sat Sep 24 10:19:07 2022 +0000
+++ b/usr.bin/make/cond.c Sat Sep 24 10:26:31 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cond.c,v 1.340 2022/09/24 10:19:07 rillig Exp $ */
+/* $NetBSD: cond.c,v 1.341 2022/09/24 10:26:31 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -81,8 +81,9 @@
* of one of the .if directives or the condition in a
* ':?then:else' variable modifier.
*
- * Cond_save_depth
- * Cond_restore_depth
+ * Cond_PushMinDepth
+ * Cond_PopMinDepth
+ * Cond_ResetDepth
* Save and restore the nesting of the conditions, at
* the start and end of including another makefile, to
* ensure that in each makefile the conditional
@@ -95,7 +96,7 @@
#include "dir.h"
/* "@(#)cond.c 8.2 (Berkeley) 1/2/94" */
-MAKE_RCSID("$NetBSD: cond.c,v 1.340 2022/09/24 10:19:07 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.341 2022/09/24 10:26:31 rillig Exp $");
/*
* Conditional expressions conform to this grammar:
@@ -1256,7 +1257,7 @@
}
unsigned int
-Cond_save_depth(void)
+Cond_PushMinDepth(void)
{
unsigned int depth = cond_min_depth;
@@ -1265,7 +1266,7 @@
}
void
-Cond_restore_depth(unsigned int saved_depth)
+Cond_PopMinDepth(unsigned int saved_depth)
{
unsigned int open_conds = cond_depth - cond_min_depth;
@@ -1280,12 +1281,11 @@
}
/*
- * When we break out of a .for loop
- * we want to restore cond_depth to where it was
- * when the loop started.
+ * When breaking out of a .for loop, restore cond_depth to where it was when
+ * the loop started.
*/
void
-Cond_reset_depth(void)
+Cond_ResetDepth(void)
{
cond_depth = cond_min_depth;
}
diff -r 7cf5caeda59e -r b4feb5987494 usr.bin/make/make.h
--- a/usr.bin/make/make.h Sat Sep 24 10:19:07 2022 +0000
+++ b/usr.bin/make/make.h Sat Sep 24 10:26:31 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: make.h,v 1.305 2022/09/23 22:58:15 sjg Exp $ */
+/* $NetBSD: make.h,v 1.306 2022/09/24 10:26:31 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -799,9 +799,9 @@
/* cond.c */
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(void);
-unsigned int Cond_save_depth(void) MAKE_ATTR_USE;
+unsigned int Cond_PushMinDepth(void) MAKE_ATTR_USE;
+void Cond_PopMinDepth(unsigned int);
+void Cond_ResetDepth(void);
/* dir.c; see also dir.h */
diff -r 7cf5caeda59e -r b4feb5987494 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c Sat Sep 24 10:19:07 2022 +0000
+++ b/usr.bin/make/parse.c Sat Sep 24 10:26:31 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.684 2022/09/23 22:58:15 sjg Exp $ */
+/* $NetBSD: parse.c,v 1.685 2022/09/24 10:26:32 rillig 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.684 2022/09/23 22:58:15 sjg Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.685 2022/09/24 10:26:32 rillig Exp $");
/*
* A file being read.
@@ -119,7 +119,9 @@
unsigned forBodyReadLines; /* the number of physical lines that have
* been read from the file above the body of
* the .for loop */
- unsigned int cond_depth; /* 'if' nesting when file opened */
+ unsigned int including_cond_min_depth; /* depth of nested 'if'
+ * directives, at the point where the
+ * including file was opened */
bool depending; /* state of doing_depend on EOF */
Buffer buf; /* the file's content or the body of the .for
@@ -2139,7 +2141,7 @@
curFile->buf_ptr = curFile->buf.data;
curFile->buf_end = curFile->buf.data + curFile->buf.len;
- curFile->cond_depth = Cond_save_depth();
+ curFile->including_cond_min_depth = Cond_PushMinDepth();
SetParseFile(name);
}
@@ -2276,7 +2278,7 @@
* Ensure the makefile (or .for loop) didn't have mismatched
* conditionals.
*/
- Cond_restore_depth(curFile->cond_depth);
+ Cond_PopMinDepth(curFile->including_cond_min_depth);
FStr_Done(&curFile->name);
Buf_Done(&curFile->buf);
@@ -2669,7 +2671,7 @@
if (curFile->forLoop != NULL) {
/* pretend we reached EOF */
For_Break(curFile->forLoop);
- Cond_reset_depth();
+ Cond_ResetDepth();
ParseEOF();
} else
Parse_Error(PARSE_FATAL, "break outside of for loop");
Home |
Main Index |
Thread Index |
Old Index