Module Name:    src
Committed By:   rillig
Date:           Tue Feb  2 16:18:16 UTC 2021

Modified Files:
        src/usr.bin/make: var.c
        src/usr.bin/make/unit-tests: directive-export-impl.exp
            var-op-append.exp vardebug.exp varmod-indirect.exp
            varmod-match-escape.exp varname.exp

Log Message:
make: replace VarExprFlags with VarExprStatus

The combination of !VEF_UNDEF && VEF_DEF was not possible, which made it
rather strange to model this state as a bit set.

The only functional change is the renamed constants in the debug output.

Using ENUM_VALUE_RTTI_2 felt like overengineering since it's harder to
understand than a simple array of names.


To generate a diff of this commit:
cvs rdiff -u -r1.788 -r1.789 src/usr.bin/make/var.c
cvs rdiff -u -r1.1 -r1.2 \
    src/usr.bin/make/unit-tests/directive-export-impl.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/var-op-append.exp
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/vardebug.exp
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/varmod-indirect.exp
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-match-escape.exp
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/varname.exp

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/var.c
diff -u src/usr.bin/make/var.c:1.788 src/usr.bin/make/var.c:1.789
--- src/usr.bin/make/var.c:1.788	Tue Feb  2 15:41:14 2021
+++ src/usr.bin/make/var.c	Tue Feb  2 16:18:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.788 2021/02/02 15:41:14 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.789 2021/02/02 16:18:16 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.788 2021/02/02 15:41:14 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.789 2021/02/02 16:18:16 rillig Exp $");
 
 typedef enum VarFlags {
 	VAR_NONE	= 0,
@@ -1971,21 +1971,24 @@ VarStrftime(const char *fmt, Boolean zul
  * Some modifiers need to free some memory.
  */
 
-typedef enum VarExprFlags {
-	VEF_NONE	= 0,
+typedef enum VarExprStatus {
+	/* The variable expression is based in a regular, defined variable. */
+	VES_NONE,
 	/* The variable expression is based on an undefined variable. */
-	VEF_UNDEF = 0x01,
+	VES_UNDEF,
 	/*
 	 * The variable expression started as an undefined expression, but one
 	 * of the modifiers (such as :D or :U) has turned the expression from
 	 * undefined to defined.
 	 */
-	VEF_DEF = 0x02
-} VarExprFlags;
-
-ENUM_FLAGS_RTTI_2(VarExprFlags,
-		  VEF_UNDEF, VEF_DEF);
+	VES_DEF
+} VarExprStatus;
 
+static const char * const VarExprStatus_Name[] = {
+	    "none",
+	    "VES_UNDEF",
+	    "VES_DEF"
+};
 
 typedef struct ApplyModifiersState {
 	/* '\0' or '{' or '(' */
@@ -2008,14 +2011,14 @@ typedef struct ApplyModifiersState {
 	 * big word, possibly containing spaces.
 	 */
 	Boolean oneBigWord;
-	VarExprFlags exprFlags;
+	VarExprStatus exprStatus;
 } ApplyModifiersState;
 
 static void
 ApplyModifiersState_Define(ApplyModifiersState *st)
 {
-	if (st->exprFlags & VEF_UNDEF)
-		st->exprFlags |= VEF_DEF;
+	if (st->exprStatus == VES_UNDEF)
+		st->exprStatus = VES_DEF;
 }
 
 typedef enum ApplyModifierResult {
@@ -2325,7 +2328,7 @@ ApplyModifier_Defined(const char **pp, c
 
 	VarEvalFlags eflags = VARE_NONE;
 	if (st->eflags & VARE_WANTRES)
-		if ((**pp == 'D') == !(st->exprFlags & VEF_UNDEF))
+		if ((**pp == 'D') == (st->exprStatus == VES_NONE))
 			eflags = st->eflags;
 
 	Buf_Init(&buf);
@@ -3203,7 +3206,7 @@ ok:
 	}
 
 	ctxt = st->ctxt;	/* context where v belongs */
-	if (!(st->exprFlags & VEF_UNDEF) && st->ctxt != VAR_GLOBAL) {
+	if (st->exprStatus == VES_NONE && st->ctxt != VAR_GLOBAL) {
 		Var *gv = VarFind(st->var->name.str, st->ctxt, FALSE);
 		if (gv == NULL)
 			ctxt = VAR_GLOBAL;
@@ -3245,7 +3248,7 @@ ok:
 			break;
 		}
 		case '?':
-			if (!(st->exprFlags & VEF_UNDEF))
+			if (st->exprStatus == VES_NONE)
 				break;
 			/* FALLTHROUGH */
 		default:
@@ -3396,7 +3399,6 @@ LogBeforeApply(const ApplyModifiersState
 {
 	char eflags_str[VarEvalFlags_ToStringSize];
 	char vflags_str[VarFlags_ToStringSize];
-	char exprflags_str[VarExprFlags_ToStringSize];
 	Boolean is_single_char = mod[0] != '\0' &&
 				 (mod[1] == endc || mod[1] == ':');
 
@@ -3406,7 +3408,7 @@ LogBeforeApply(const ApplyModifiersState
 	    st->var->name.str, mod[0], is_single_char ? "" : "...", val,
 	    VarEvalFlags_ToString(eflags_str, st->eflags),
 	    VarFlags_ToString(vflags_str, st->var->flags),
-	    VarExprFlags_ToString(exprflags_str, st->exprFlags));
+	    VarExprStatus_Name[st->exprStatus]);
 }
 
 static void
@@ -3414,7 +3416,6 @@ LogAfterApply(ApplyModifiersState *st, c
 {
 	char eflags_str[VarEvalFlags_ToStringSize];
 	char vflags_str[VarFlags_ToStringSize];
-	char exprflags_str[VarExprFlags_ToStringSize];
 	const char *quot = st->newVal.str == var_Error ? "" : "\"";
 	const char *newVal =
 	    st->newVal.str == var_Error ? "error" : st->newVal.str;
@@ -3423,7 +3424,7 @@ LogAfterApply(ApplyModifiersState *st, c
 	    st->var->name.str, (int)(p - mod), mod, quot, newVal, quot,
 	    VarEvalFlags_ToString(eflags_str, st->eflags),
 	    VarFlags_ToString(vflags_str, st->var->flags),
-	    VarExprFlags_ToString(exprflags_str, st->exprFlags));
+	    VarExprStatus_Name[st->exprStatus]);
 }
 
 static ApplyModifierResult
@@ -3493,7 +3494,7 @@ ApplyModifier(const char **pp, const cha
 }
 
 static FStr ApplyModifiers(const char **, FStr, char, char, Var *,
-			    VarExprFlags *, GNode *, VarEvalFlags);
+			    VarExprStatus *, GNode *, VarEvalFlags);
 
 typedef enum ApplyModifiersIndirectResult {
 	/* The indirect modifiers have been applied successfully. */
@@ -3541,7 +3542,7 @@ ApplyModifiersIndirect(ApplyModifiersSta
 	if (mods.str[0] != '\0') {
 		const char *modsp = mods.str;
 		FStr newVal = ApplyModifiers(&modsp, *inout_value, '\0', '\0',
-		    st->var, &st->exprFlags, st->ctxt, st->eflags);
+		    st->var, &st->exprStatus, st->ctxt, st->eflags);
 		*inout_value = newVal;
 		if (newVal.str == var_Error || *modsp != '\0') {
 			FStr_Done(&mods);
@@ -3637,7 +3638,7 @@ ApplyModifiers(
     char startc,		/* '(' or '{', or '\0' for indirect modifiers */
     char endc,			/* ')' or '}', or '\0' for indirect modifiers */
     Var *v,
-    VarExprFlags *exprFlags,
+    VarExprStatus *exprStatus,
     GNode *ctxt,		/* for looking up and modifying variables */
     VarEvalFlags eflags
 )
@@ -3652,7 +3653,7 @@ ApplyModifiers(
 #endif
 	    ' ',		/* .sep */
 	    FALSE,		/* .oneBigWord */
-	    *exprFlags		/* .exprFlags */
+	    *exprStatus		/* .exprStatus */
 	};
 	const char *p;
 	const char *mod;
@@ -3695,7 +3696,7 @@ ApplyModifiers(
 
 	*pp = p;
 	assert(value.str != NULL); /* Use var_Error or varUndefined instead. */
-	*exprFlags = st.exprFlags;
+	*exprStatus = st.exprStatus;
 	return value;
 
 bad_modifier:
@@ -3706,7 +3707,7 @@ bad_modifier:
 cleanup:
 	*pp = p;
 	FStr_Done(&value);
-	*exprFlags = st.exprFlags;
+	*exprStatus = st.exprStatus;
 	return FStr_InitRefer(var_Error);
 }
 
@@ -3987,7 +3988,7 @@ ParseVarnameLong(
 	Boolean *out_TRUE_haveModifier,
 	const char **out_TRUE_extraModifiers,
 	Boolean *out_TRUE_dynamic,
-	VarExprFlags *out_TRUE_exprFlags
+	VarExprStatus *out_TRUE_exprStatus
 )
 {
 	size_t namelen;
@@ -4056,7 +4057,7 @@ ParseVarnameLong(
 		 * instead of the actually computed value.
 		 */
 		v = VarNew(FStr_InitOwn(varname), "", VAR_NONE);
-		*out_TRUE_exprFlags = VEF_UNDEF;
+		*out_TRUE_exprStatus = VES_UNDEF;
 	} else
 		free(varname);
 
@@ -4142,7 +4143,7 @@ Var_Parse(const char **pp, GNode *ctxt, 
 	Var *v;
 	FStr value;
 	char eflags_str[VarEvalFlags_ToStringSize];
-	VarExprFlags exprFlags = VEF_NONE;
+	VarExprStatus exprStatus = VES_NONE;
 
 	DEBUG2(VAR, "Var_Parse: %s with %s\n", start,
 	    VarEvalFlags_ToString(eflags_str, eflags));
@@ -4170,7 +4171,7 @@ Var_Parse(const char **pp, GNode *ctxt, 
 		if (!ParseVarnameLong(p, startc, ctxt, eflags,
 		    pp, &res, out_val,
 		    &endc, &p, &v, &haveModifier, &extramodifiers,
-		    &dynamic, &exprFlags))
+		    &dynamic, &exprStatus))
 			return res;
 	}
 
@@ -4208,14 +4209,14 @@ Var_Parse(const char **pp, GNode *ctxt, 
 		if (extramodifiers != NULL) {
 			const char *em = extramodifiers;
 			value = ApplyModifiers(&em, value, '\0', '\0',
-			    v, &exprFlags, ctxt, eflags);
+			    v, &exprStatus, ctxt, eflags);
 		}
 
 		if (haveModifier) {
 			p++;	/* Skip initial colon. */
 
 			value = ApplyModifiers(&p, value, startc, endc,
-			    v, &exprFlags, ctxt, eflags);
+			    v, &exprStatus, ctxt, eflags);
 		}
 	}
 
@@ -4227,8 +4228,8 @@ Var_Parse(const char **pp, GNode *ctxt, 
 	if (v->flags & VAR_FROM_ENV) {
 		FreeEnvVar(&value.freeIt, v, value.str);
 
-	} else if (exprFlags & VEF_UNDEF) {
-		if (!(exprFlags & VEF_DEF)) {
+	} else if (exprStatus != VES_NONE) {
+		if (exprStatus != VES_DEF) {
 			FStr_Done(&value);
 			if (dynamic) {
 				value = FStr_InitOwn(bmake_strsedup(start, p));

Index: src/usr.bin/make/unit-tests/directive-export-impl.exp
diff -u src/usr.bin/make/unit-tests/directive-export-impl.exp:1.1 src/usr.bin/make/unit-tests/directive-export-impl.exp:1.2
--- src/usr.bin/make/unit-tests/directive-export-impl.exp:1.1	Tue Dec 29 01:45:06 2020
+++ src/usr.bin/make/unit-tests/directive-export-impl.exp	Tue Feb  2 16:18:16 2021
@@ -12,7 +12,7 @@ Result of ${UT_VAR:N*} is "" (VARE_UNDEF
 ParseDoDependency(: )
 CondParser_Eval: ${:!echo "\$UT_VAR"!} != "<>"
 Var_Parse: ${:!echo "\$UT_VAR"!} != "<>" with VARE_UNDEFERR|VARE_WANTRES
-Applying ${:!...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF)
+Applying ${:!...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VES_UNDEF)
 Modifier part: "echo "$UT_VAR""
 Var_Parse: ${.MAKE.EXPORTED:O:u} with VARE_WANTRES
 Applying ${.MAKE.EXPORTED:O} to "UT_VAR" (VARE_WANTRES, none, none)
@@ -21,7 +21,7 @@ Applying ${.MAKE.EXPORTED:u} to "UT_VAR"
 Result of ${.MAKE.EXPORTED:u} is "UT_VAR" (VARE_WANTRES, none, none)
 Var_Parse: ${UT_VAR} with VARE_WANTRES
 Var_Parse: ${REF}> with VARE_WANTRES
-Result of ${:!echo "\$UT_VAR"!} is "<>" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
+Result of ${:!echo "\$UT_VAR"!} is "<>" (VARE_UNDEFERR|VARE_WANTRES, none, VES_DEF)
 lhs = "<>", rhs = "<>", op = !=
 ParseReadLine (49): ': ${UT_VAR:N*}'
 Var_Parse: ${UT_VAR:N*} with VARE_UNDEFERR|VARE_WANTRES
@@ -35,7 +35,7 @@ ParseReadLine (53): 'REF=		defined'
 Global:REF = defined
 CondParser_Eval: ${:!echo "\$UT_VAR"!} != "<defined>"
 Var_Parse: ${:!echo "\$UT_VAR"!} != "<defined>" with VARE_UNDEFERR|VARE_WANTRES
-Applying ${:!...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF)
+Applying ${:!...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VES_UNDEF)
 Modifier part: "echo "$UT_VAR""
 Var_Parse: ${.MAKE.EXPORTED:O:u} with VARE_WANTRES
 Applying ${.MAKE.EXPORTED:O} to "UT_VAR" (VARE_WANTRES, none, none)
@@ -44,7 +44,7 @@ Applying ${.MAKE.EXPORTED:u} to "UT_VAR"
 Result of ${.MAKE.EXPORTED:u} is "UT_VAR" (VARE_WANTRES, none, none)
 Var_Parse: ${UT_VAR} with VARE_WANTRES
 Var_Parse: ${REF}> with VARE_WANTRES
-Result of ${:!echo "\$UT_VAR"!} is "<defined>" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
+Result of ${:!echo "\$UT_VAR"!} is "<defined>" (VARE_UNDEFERR|VARE_WANTRES, none, VES_DEF)
 lhs = "<defined>", rhs = "<defined>", op = !=
 ParseReadLine (61): 'all:'
 ParseDoDependency(all:)

Index: src/usr.bin/make/unit-tests/var-op-append.exp
diff -u src/usr.bin/make/unit-tests/var-op-append.exp:1.2 src/usr.bin/make/unit-tests/var-op-append.exp:1.3
--- src/usr.bin/make/unit-tests/var-op-append.exp:1.2	Fri Oct 30 20:36:33 2020
+++ src/usr.bin/make/unit-tests/var-op-append.exp	Tue Feb  2 16:18:16 2021
@@ -1,6 +1,6 @@
 Var_Parse: ${:U\$\$\$\$\$\$\$\$} with VARE_WANTRES
-Applying ${:U...} to "" (VARE_WANTRES, none, VEF_UNDEF)
-Result of ${:U\$\$\$\$\$\$\$\$} is "$$$$$$$$" (VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
+Applying ${:U...} to "" (VARE_WANTRES, none, VES_UNDEF)
+Result of ${:U\$\$\$\$\$\$\$\$} is "$$$$$$$$" (VARE_WANTRES, none, VES_DEF)
 Global:VAR.$$$$ = dollars
 Global:.MAKEFLAGS =  -r -k -d v -d
 Global:.MAKEFLAGS =  -r -k -d v -d 0

Index: src/usr.bin/make/unit-tests/vardebug.exp
diff -u src/usr.bin/make/unit-tests/vardebug.exp:1.14 src/usr.bin/make/unit-tests/vardebug.exp:1.15
--- src/usr.bin/make/unit-tests/vardebug.exp:1.14	Sun Dec 20 19:47:34 2020
+++ src/usr.bin/make/unit-tests/vardebug.exp	Tue Feb  2 16:18:16 2021
@@ -6,12 +6,12 @@ Global:VAR = overwritten
 Global:delete VAR
 Global:delete VAR (not found)
 Var_Parse: ${:U} with VARE_WANTRES
-Applying ${:U} to "" (VARE_WANTRES, none, VEF_UNDEF)
-Result of ${:U} is "" (VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
+Applying ${:U} to "" (VARE_WANTRES, none, VES_UNDEF)
+Result of ${:U} is "" (VARE_WANTRES, none, VES_DEF)
 Var_Set("${:U}", "empty name", ...) name expands to empty string - ignored
 Var_Parse: ${:U} with VARE_WANTRES
-Applying ${:U} to "" (VARE_WANTRES, none, VEF_UNDEF)
-Result of ${:U} is "" (VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
+Applying ${:U} to "" (VARE_WANTRES, none, VES_UNDEF)
+Result of ${:U} is "" (VARE_WANTRES, none, VES_DEF)
 Var_Append("${:U}", "empty name", ...) name expands to empty string - ignored
 Global:FROM_CMDLINE = overwritten ignored!
 Global:VAR = 1
@@ -47,32 +47,32 @@ Result of ${VAR:tl} is "1 2 3" (VARE_UND
 Applying ${VAR:Q} to "1 2 3" (VARE_UNDEFERR|VARE_WANTRES, none, none)
 Result of ${VAR:Q} is "1\ 2\ 3" (VARE_UNDEFERR|VARE_WANTRES, none, none)
 Var_Parse: ${:Uvalue:${:UM*e}:Mvalu[e]} with VARE_UNDEFERR|VARE_WANTRES
-Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF)
-Result of ${:Uvalue} is "value" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
+Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VES_UNDEF)
+Result of ${:Uvalue} is "value" (VARE_UNDEFERR|VARE_WANTRES, none, VES_DEF)
 Var_Parse: ${:UM*e}:Mvalu[e]} with VARE_UNDEFERR|VARE_WANTRES
-Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF)
-Result of ${:UM*e} is "M*e" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
+Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VES_UNDEF)
+Result of ${:UM*e} is "M*e" (VARE_UNDEFERR|VARE_WANTRES, none, VES_DEF)
 Indirect modifier "M*e" from "${:UM*e}"
-Applying ${:M...} to "value" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
+Applying ${:M...} to "value" (VARE_UNDEFERR|VARE_WANTRES, none, VES_DEF)
 Pattern[] for [value] is [*e]
 ModifyWords: split "value" into 1 words
 VarMatch [value] [*e]
-Result of ${:M*e} is "value" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
-Applying ${:M...} to "value" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
+Result of ${:M*e} is "value" (VARE_UNDEFERR|VARE_WANTRES, none, VES_DEF)
+Applying ${:M...} to "value" (VARE_UNDEFERR|VARE_WANTRES, none, VES_DEF)
 Pattern[] for [value] is [valu[e]]
 ModifyWords: split "value" into 1 words
 VarMatch [value] [valu[e]]
-Result of ${:Mvalu[e]} is "value" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
+Result of ${:Mvalu[e]} is "value" (VARE_UNDEFERR|VARE_WANTRES, none, VES_DEF)
 Var_Parse: ${:UVAR} with VARE_WANTRES
-Applying ${:U...} to "" (VARE_WANTRES, none, VEF_UNDEF)
-Result of ${:UVAR} is "VAR" (VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
+Applying ${:U...} to "" (VARE_WANTRES, none, VES_UNDEF)
+Result of ${:UVAR} is "VAR" (VARE_WANTRES, none, VES_DEF)
 Global:delete VAR
 Var_Parse: ${:Uvariable:unknown} with VARE_UNDEFERR|VARE_WANTRES
-Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF)
-Result of ${:Uvariable} is "variable" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
-Applying ${:u...} to "variable" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
+Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VES_UNDEF)
+Result of ${:Uvariable} is "variable" (VARE_UNDEFERR|VARE_WANTRES, none, VES_DEF)
+Applying ${:u...} to "variable" (VARE_UNDEFERR|VARE_WANTRES, none, VES_DEF)
 make: "vardebug.mk" line 44: Unknown modifier 'u'
-Result of ${:unknown} is error (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
+Result of ${:unknown} is error (VARE_UNDEFERR|VARE_WANTRES, none, VES_DEF)
 make: "vardebug.mk" line 44: Malformed conditional (${:Uvariable:unknown})
 Var_Parse: ${UNDEFINED} with VARE_UNDEFERR|VARE_WANTRES
 make: "vardebug.mk" line 53: Malformed conditional (${UNDEFINED})

Index: src/usr.bin/make/unit-tests/varmod-indirect.exp
diff -u src/usr.bin/make/unit-tests/varmod-indirect.exp:1.7 src/usr.bin/make/unit-tests/varmod-indirect.exp:1.8
--- src/usr.bin/make/unit-tests/varmod-indirect.exp:1.7	Mon Dec 28 00:46:24 2020
+++ src/usr.bin/make/unit-tests/varmod-indirect.exp	Tue Feb  2 16:18:16 2021
@@ -15,40 +15,40 @@ Global:_ = before ${UNDEF} after
 ParseReadLine (137): '_:=	before ${UNDEF:${:US,a,a,}} after'
 Var_Parse: ${UNDEF:${:US,a,a,}} after with VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF
 Var_Parse: ${:US,a,a,}} after with VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF
-Applying ${:U...} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VEF_UNDEF)
-Result of ${:US,a,a,} is "S,a,a," (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VEF_UNDEF|VEF_DEF)
+Applying ${:U...} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VES_UNDEF)
+Result of ${:US,a,a,} is "S,a,a," (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VES_DEF)
 Indirect modifier "S,a,a," from "${:US,a,a,}"
-Applying ${UNDEF:S...} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VEF_UNDEF)
+Applying ${UNDEF:S...} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VES_UNDEF)
 Modifier part: "a"
 Modifier part: "a"
 ModifyWords: split "" into 1 words
-Result of ${UNDEF:S,a,a,} is "" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VEF_UNDEF)
+Result of ${UNDEF:S,a,a,} is "" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VES_UNDEF)
 Var_Parse: ${:US,a,a,}} after with VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF
-Applying ${:U...} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VEF_UNDEF)
-Result of ${:US,a,a,} is "S,a,a," (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VEF_UNDEF|VEF_DEF)
+Applying ${:U...} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VES_UNDEF)
+Result of ${:US,a,a,} is "S,a,a," (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VES_DEF)
 Global:_ = before ${UNDEF:S,a,a,} after
 ParseReadLine (147): '_:=	before ${UNDEF:${:U}} after'
 Var_Parse: ${UNDEF:${:U}} after with VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF
 Var_Parse: ${:U}} after with VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF
-Applying ${:U} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VEF_UNDEF)
-Result of ${:U} is "" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VEF_UNDEF|VEF_DEF)
+Applying ${:U} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VES_UNDEF)
+Result of ${:U} is "" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VES_DEF)
 Indirect modifier "" from "${:U}"
 Var_Parse: ${:U}} after with VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF
-Applying ${:U} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VEF_UNDEF)
-Result of ${:U} is "" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VEF_UNDEF|VEF_DEF)
+Applying ${:U} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VES_UNDEF)
+Result of ${:U} is "" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VES_DEF)
 Global:_ = before ${UNDEF:} after
 ParseReadLine (152): '_:=	before ${UNDEF:${:UZ}} after'
 Var_Parse: ${UNDEF:${:UZ}} after with VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF
 Var_Parse: ${:UZ}} after with VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF
-Applying ${:U...} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VEF_UNDEF)
-Result of ${:UZ} is "Z" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VEF_UNDEF|VEF_DEF)
+Applying ${:U...} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VES_UNDEF)
+Result of ${:UZ} is "Z" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VES_DEF)
 Indirect modifier "Z" from "${:UZ}"
-Applying ${UNDEF:Z} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VEF_UNDEF)
+Applying ${UNDEF:Z} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VES_UNDEF)
 make: "varmod-indirect.mk" line 152: Unknown modifier 'Z'
-Result of ${UNDEF:Z} is error (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VEF_UNDEF)
+Result of ${UNDEF:Z} is error (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VES_UNDEF)
 Var_Parse: ${:UZ}} after with VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF
-Applying ${:U...} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VEF_UNDEF)
-Result of ${:UZ} is "Z" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VEF_UNDEF|VEF_DEF)
+Applying ${:U...} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VES_UNDEF)
+Result of ${:UZ} is "Z" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VES_DEF)
 Global:_ = before ${UNDEF:Z} after
 ParseReadLine (154): '.MAKEFLAGS: -d0'
 ParseDoDependency(.MAKEFLAGS: -d0)

Index: src/usr.bin/make/unit-tests/varmod-match-escape.exp
diff -u src/usr.bin/make/unit-tests/varmod-match-escape.exp:1.5 src/usr.bin/make/unit-tests/varmod-match-escape.exp:1.6
--- src/usr.bin/make/unit-tests/varmod-match-escape.exp:1.5	Sun Nov  1 19:49:28 2020
+++ src/usr.bin/make/unit-tests/varmod-match-escape.exp	Tue Feb  2 16:18:16 2021
@@ -3,8 +3,8 @@ CondParser_Eval: ${SPECIALS:M${:U}\:} !=
 Var_Parse: ${SPECIALS:M${:U}\:} != ${SPECIALS:M\:${:U}} with VARE_UNDEFERR|VARE_WANTRES
 Applying ${SPECIALS:M...} to "\: : \\ * \*" (VARE_UNDEFERR|VARE_WANTRES, none, none)
 Var_Parse: ${:U}\: with VARE_UNDEFERR|VARE_WANTRES
-Applying ${:U} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF)
-Result of ${:U} is "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
+Applying ${:U} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VES_UNDEF)
+Result of ${:U} is "" (VARE_UNDEFERR|VARE_WANTRES, none, VES_DEF)
 Pattern[SPECIALS] for [\: : \\ * \*] is [\:]
 ModifyWords: split "\: : \\ * \*" into 5 words
 VarMatch [\:] [\:]
@@ -16,8 +16,8 @@ Result of ${SPECIALS:M${:U}\:} is ":" (V
 Var_Parse: ${SPECIALS:M\:${:U}} with VARE_UNDEFERR|VARE_WANTRES
 Applying ${SPECIALS:M...} to "\: : \\ * \*" (VARE_UNDEFERR|VARE_WANTRES, none, none)
 Var_Parse: ${:U} with VARE_UNDEFERR|VARE_WANTRES
-Applying ${:U} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF)
-Result of ${:U} is "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
+Applying ${:U} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VES_UNDEF)
+Result of ${:U} is "" (VARE_UNDEFERR|VARE_WANTRES, none, VES_DEF)
 Pattern[SPECIALS] for [\: : \\ * \*] is [:]
 ModifyWords: split "\: : \\ * \*" into 5 words
 VarMatch [\:] [:]
@@ -32,8 +32,8 @@ CondParser_Eval: ${VALUES:M\:${:U\:}} !=
 Var_Parse: ${VALUES:M\:${:U\:}} != ${VALUES:M${:U\:}\:} with VARE_UNDEFERR|VARE_WANTRES
 Applying ${VALUES:M...} to ": :: :\:" (VARE_UNDEFERR|VARE_WANTRES, none, none)
 Var_Parse: ${:U:} with VARE_UNDEFERR|VARE_WANTRES
-Applying ${:U} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF)
-Result of ${:U} is "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
+Applying ${:U} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VES_UNDEF)
+Result of ${:U} is "" (VARE_UNDEFERR|VARE_WANTRES, none, VES_DEF)
 Pattern[VALUES] for [: :: :\:] is [:]
 ModifyWords: split ": :: :\:" into 3 words
 VarMatch [:] [:]
@@ -43,8 +43,8 @@ Result of ${VALUES:M\:${:U\:}} is ":" (V
 Var_Parse: ${VALUES:M${:U\:}\:} with VARE_UNDEFERR|VARE_WANTRES
 Applying ${VALUES:M...} to ": :: :\:" (VARE_UNDEFERR|VARE_WANTRES, none, none)
 Var_Parse: ${:U\:}\: with VARE_UNDEFERR|VARE_WANTRES
-Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF)
-Result of ${:U\:} is ":" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
+Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VES_UNDEF)
+Result of ${:U\:} is ":" (VARE_UNDEFERR|VARE_WANTRES, none, VES_DEF)
 Pattern[VALUES] for [: :: :\:] is [:\:]
 ModifyWords: split ": :: :\:" into 3 words
 VarMatch [:] [:\:]

Index: src/usr.bin/make/unit-tests/varname.exp
diff -u src/usr.bin/make/unit-tests/varname.exp:1.10 src/usr.bin/make/unit-tests/varname.exp:1.11
--- src/usr.bin/make/unit-tests/varname.exp:1.10	Mon Feb  1 21:56:03 2021
+++ src/usr.bin/make/unit-tests/varname.exp	Tue Feb  2 16:18:16 2021
@@ -5,14 +5,14 @@ Var_Parse: ${VARNAME} with VARE_WANTRES
 Global:VAR((( = 3 open parentheses
 Var_Parse: ${VAR(((}}}}" != "3 open parentheses}}}" with VARE_WANTRES
 Var_Parse: ${:UVAR(((}=	try1 with VARE_UNDEFERR|VARE_WANTRES
-Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF)
-Result of ${:UVAR(((} is "VAR(((" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
+Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VES_UNDEF)
+Result of ${:UVAR(((} is "VAR(((" (VARE_UNDEFERR|VARE_WANTRES, none, VES_DEF)
 Global:.ALLTARGETS =  VAR(((=)
 make: "varname.mk" line 30: No closing parenthesis in archive specification
 make: "varname.mk" line 30: Error in archive specification: "VAR"
 Var_Parse: ${:UVAR\(\(\(}=	try2 with VARE_UNDEFERR|VARE_WANTRES
-Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF)
-Result of ${:UVAR\(\(\(} is "VAR\(\(\(" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
+Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VES_UNDEF)
+Result of ${:UVAR\(\(\(} is "VAR\(\(\(" (VARE_UNDEFERR|VARE_WANTRES, none, VES_DEF)
 Global:.ALLTARGETS =  VAR(((=) VAR\(\(\(=
 make: "varname.mk" line 35: Invalid line type
 Var_Parse: ${VARNAME} with VARE_WANTRES

Reply via email to