Module Name:    src
Committed By:   rillig
Date:           Sun Apr 11 13:35:56 UTC 2021

Modified Files:
        src/usr.bin/make: nonints.h var.c
        src/usr.bin/make/unit-tests: cond-func-empty.mk varmod-defined.mk
            varmod-ifelse.mk varmod-loop.mk

Log Message:
make: clean up remaining references to VarEvalFlags

VarEvalFlags has been replaced with VarEvalMode.  There were some
comments and tests that still referred to the old names.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.212 -r1.213 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.916 -r1.917 src/usr.bin/make/var.c
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/cond-func-empty.mk
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/varmod-defined.mk \
    src/usr.bin/make/unit-tests/varmod-ifelse.mk
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/varmod-loop.mk

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/nonints.h
diff -u src/usr.bin/make/nonints.h:1.212 src/usr.bin/make/nonints.h:1.213
--- src/usr.bin/make/nonints.h:1.212	Sun Apr 11 12:06:53 2021
+++ src/usr.bin/make/nonints.h	Sun Apr 11 13:35:56 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.212 2021/04/11 12:06:53 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.213 2021/04/11 13:35:56 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -292,7 +292,7 @@ typedef enum VarParseResult {
 	 * information to them, for now.
 	 *
 	 * TODO: Instead of having this special return value, rather ensure
-	 *  that VarEvalFlags.keepUndef is processed properly.
+	 *  that VARE_EVAL_KEEP_UNDEF is processed properly.
 	 */
 	VPR_UNDEF
 

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.916 src/usr.bin/make/var.c:1.917
--- src/usr.bin/make/var.c:1.916	Sun Apr 11 12:46:54 2021
+++ src/usr.bin/make/var.c	Sun Apr 11 13:35:56 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.916 2021/04/11 12:46:54 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.917 2021/04/11 13:35:56 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -140,7 +140,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.916 2021/04/11 12:46:54 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.917 2021/04/11 13:35:56 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -272,11 +272,11 @@ char var_Error[] = "";
 
 /*
  * Special return value for Var_Parse, indicating an undefined variable in
- * a case where VarEvalFlags.undefErr is not set.  This undefined variable is
+ * a case where VARE_UNDEFERR is not set.  This undefined variable is
  * typically a dynamic variable such as ${.TARGET}, whose expansion needs to
  * be deferred until it is defined in an actual target.
  *
- * See VarEvalFlags.keepUndef.
+ * See VARE_EVAL_KEEP_UNDEF.
  */
 static char varUndefined[] = "";
 
@@ -2253,7 +2253,7 @@ ParseModifierPartSubst(
 
 		/*
 		 * XXX: This whole block is very similar to Var_Parse without
-		 * VarEvalFlags.wantRes.  There may be subtle edge cases
+		 * VARE_WANTRES.  There may be subtle edge cases
 		 * though that are not yet covered in the unit tests and that
 		 * are parsed differently, depending on whether they are
 		 * evaluated or not.
@@ -4352,18 +4352,18 @@ FreeEnvVar(Var *v, FStr *inout_val)
 }
 
 #if __STDC_VERSION__ >= 199901L
-#define Expr_Literal(name, value, eflags, scope, defined) \
-	{ name, value, eflags, scope, defined }
+#define Expr_Literal(name, value, emode, scope, defined) \
+	{ name, value, emode, scope, defined }
 #else
 MAKE_INLINE Expr
 Expr_Literal(const char *name, FStr value,
-	     VarEvalFlags eflags, GNode *scope, ExprDefined defined)
+	     VarEvalMode emode, GNode *scope, ExprDefined defined)
 {
 	Expr expr;
 
 	expr.name = name;
 	expr.value = value;
-	expr.eflags = eflags;
+	expr.emode = emode;
 	expr.scope = scope;
 	expr.defined = defined;
 	return expr;
@@ -4412,7 +4412,7 @@ Var_Parse_FastLane(const char **pp, VarE
  *			point to the "y" of "empty(VARNAME:Modifiers)", which
  *			is syntactically the same.
  *	scope		The scope for finding variables
- *	eflags		Control the exact details of parsing
+ *	emode		Controls the exact details of parsing and evaluation
  *
  * Output:
  *	*pp		The position where to continue parsing.
@@ -4424,13 +4424,13 @@ Var_Parse_FastLane(const char **pp, VarE
  *	*out_val	The value of the variable expression, never NULL.
  *	*out_val	var_Error if there was a parse error.
  *	*out_val	var_Error if the base variable of the expression was
- *			undefined, eflags has undefErr set, and none of
+ *			undefined, emode is VARE_UNDEFERR, and none of
  *			the modifiers turned the undefined expression into a
  *			defined expression.
  *			XXX: It is not guaranteed that an error message has
  *			been printed.
  *	*out_val	varUndefined if the base variable of the expression
- *			was undefined, eflags did not have undefErr set,
+ *			was undefined, emode was not VARE_UNDEFERR,
  *			and none of the modifiers turned the undefined
  *			expression into a defined expression.
  *			XXX: It is not guaranteed that an error message has
@@ -4655,7 +4655,7 @@ VarSubstPlain(const char **pp, Buffer *r
  *			expanded.
  *	scope		The scope in which to start searching for
  *			variables.  The other scopes are searched as well.
- *	eflags		Special effects during expansion.
+ *	emode		The mode for parsing or evaluating subexpressions.
  */
 VarParseResult
 Var_Subst(const char *str, GNode *scope, VarEvalMode emode, char **out_res)

Index: src/usr.bin/make/unit-tests/cond-func-empty.mk
diff -u src/usr.bin/make/unit-tests/cond-func-empty.mk:1.13 src/usr.bin/make/unit-tests/cond-func-empty.mk:1.14
--- src/usr.bin/make/unit-tests/cond-func-empty.mk:1.13	Mon Mar 15 12:15:03 2021
+++ src/usr.bin/make/unit-tests/cond-func-empty.mk	Sun Apr 11 13:35:56 2021
@@ -1,4 +1,4 @@
-# $NetBSD: cond-func-empty.mk,v 1.13 2021/03/15 12:15:03 rillig Exp $
+# $NetBSD: cond-func-empty.mk,v 1.14 2021/04/11 13:35:56 rillig Exp $
 #
 # Tests for the empty() function in .if conditions, which tests a variable
 # expression for emptiness.
@@ -93,7 +93,7 @@ WORD=	word
 # neither leading nor trailing spaces are trimmed in the argument of the
 # function.  If the spaces were trimmed, the variable name would be "" and
 # that variable is indeed undefined.  Since ParseEmptyArg calls Var_Parse
-# without VarEvalFlags.undefErr, the value of the undefined variable is
+# without VARE_UNDEFERR, the value of the undefined variable is
 # returned as an empty string.
 ${:U }=	space
 .if empty( )
@@ -168,14 +168,14 @@ ${:U WORD }=	variable name with spaces
 # parsing it, this unrealistic variable name should have done no harm.
 #
 # The variable expression was expanded though, and this was wrong.  The
-# expansion was done without VarEvalFlags.wantRes (called VARF_WANTRES back
+# expansion was done without VARE_WANTRES (called VARF_WANTRES back
 # then) though.  This had the effect that the ${:U1} from the value of VARNAME
 # expanded to an empty string.  This in turn created the seemingly recursive
 # definition VARNAME=${VARNAME}, and that definition was never meant to be
 # expanded.
 #
 # This was fixed by expanding nested variable expressions in the variable name
-# only if the flag VarEvalFlags.wantRes is given.
+# only if the flag VARE_WANTRES is given.
 VARNAME=	${VARNAME${:U1}}
 .if defined(VARNAME${:U2}) && !empty(VARNAME${:U2})
 .endif

Index: src/usr.bin/make/unit-tests/varmod-defined.mk
diff -u src/usr.bin/make/unit-tests/varmod-defined.mk:1.10 src/usr.bin/make/unit-tests/varmod-defined.mk:1.11
--- src/usr.bin/make/unit-tests/varmod-defined.mk:1.10	Mon Mar 15 12:15:03 2021
+++ src/usr.bin/make/unit-tests/varmod-defined.mk	Sun Apr 11 13:35:56 2021
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-defined.mk,v 1.10 2021/03/15 12:15:03 rillig Exp $
+# $NetBSD: varmod-defined.mk,v 1.11 2021/04/11 13:35:56 rillig Exp $
 #
 # Tests for the :D variable modifier, which returns the given string
 # if the variable is defined.  It is closely related to the :U modifier.
@@ -89,9 +89,9 @@ DEF=	defined
 
 # The :D and :U modifiers behave differently from the :@var@ modifier in
 # that they preserve dollars in a ':=' assignment.  This is because
-# ApplyModifier_Defined passes the eflags unmodified to Var_Parse, unlike
+# ApplyModifier_Defined passes the emode unmodified to Var_Parse, unlike
 # ApplyModifier_Loop, which uses ParseModifierPart, which in turn removes
-# VarEvalFlags.keepDollar from eflags.
+# the keepDollar flag from emode.
 #
 # XXX: This inconsistency is documented nowhere.
 .MAKEFLAGS: -dv
Index: src/usr.bin/make/unit-tests/varmod-ifelse.mk
diff -u src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.10 src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.11
--- src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.10	Mon Mar 15 12:15:03 2021
+++ src/usr.bin/make/unit-tests/varmod-ifelse.mk	Sun Apr 11 13:35:56 2021
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-ifelse.mk,v 1.10 2021/03/15 12:15:03 rillig Exp $
+# $NetBSD: varmod-ifelse.mk,v 1.11 2021/04/11 13:35:56 rillig Exp $
 #
 # Tests for the ${cond:?then:else} variable modifier, which evaluates either
 # the then-expression or the else-expression, depending on the condition.
@@ -74,7 +74,7 @@ COND:=	${${UNDEF} == "":?bad-assign:bad-
 # conditional expression".
 #
 # XXX: The left-hand side is enclosed in quotes.  This results in Var_Parse
-# being called without VarEvalFlags.undefErr.  When ApplyModifier_IfElse
+# being called without VARE_UNDEFERR.  When ApplyModifier_IfElse
 # returns AMR_CLEANUP as result, Var_Parse returns varUndefined since the
 # value of the variable expression is still undefined.  CondParser_String is
 # then supposed to do proper error handling, but since varUndefined is local

Index: src/usr.bin/make/unit-tests/varmod-loop.mk
diff -u src/usr.bin/make/unit-tests/varmod-loop.mk:1.14 src/usr.bin/make/unit-tests/varmod-loop.mk:1.15
--- src/usr.bin/make/unit-tests/varmod-loop.mk:1.14	Sun Apr  4 13:20:52 2021
+++ src/usr.bin/make/unit-tests/varmod-loop.mk	Sun Apr 11 13:35:56 2021
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-loop.mk,v 1.14 2021/04/04 13:20:52 rillig Exp $
+# $NetBSD: varmod-loop.mk,v 1.15 2021/04/11 13:35:56 rillig Exp $
 #
 # Tests for the :@var@...${var}...@ variable modifier.
 
@@ -67,7 +67,7 @@ mod-loop-dollar:
 # This string literal is written with 8 dollars, and this is saved as the
 # variable value.  But as soon as this value is evaluated, it goes through
 # Var_Subst, which replaces each '$$' with a single '$'.  This could be
-# prevented by VarEvalFlags.keepDollar, but that flag is usually removed
+# prevented by VARE_EVAL_KEEP_DOLLAR, but that flag is usually removed
 # before expanding subexpressions.  See ApplyModifier_Loop and
 # ParseModifierPart for examples.
 #

Reply via email to