Module Name:    src
Committed By:   rillig
Date:           Mon Dec 28 00:46:25 UTC 2020

Modified Files:
        src/usr.bin/make: enum.h main.c make.h nonints.h parse.c var.c
        src/usr.bin/make/unit-tests: varmod-defined.exp varmod-indirect.exp
            varname-dot-shell.exp

Log Message:
make(1): replace global preserveUndefined with VARE_KEEP_UNDEF

Controlling the expansion of variable expressions using a global
variable and a VARE flag was inconsistent.

Converting the global variable into a flag had to prerequisites:

1.  The unintended duplicate variable assignment had to be fixed, as
done in parse.c 1.520 from 2020-12-27.  Without this fix, it would have
been necessary to add more flags to Var_Exists and Var_SetWithFlags, and
this would have become too complex.

2.  There had to be a unit test demonstrating that VARE_KEEP_DOLLAR only
applies to the top-level expression and is not passed to the
subexpressions, while VARE_KEEP_UNDEF applies to all subexpressions as
well.  This test is in var-op-expand.mk 1.10 from 2020-12-28, at least
for the ':@word@' modifier.  In ParseModifierPartSubst, VARE_KEEP_UNDEF
is not passed down either, in the same way.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/enum.h
cvs rdiff -u -r1.505 -r1.506 src/usr.bin/make/main.c
cvs rdiff -u -r1.239 -r1.240 src/usr.bin/make/make.h
cvs rdiff -u -r1.185 -r1.186 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.520 -r1.521 src/usr.bin/make/parse.c
cvs rdiff -u -r1.773 -r1.774 src/usr.bin/make/var.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-defined.exp
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/varmod-indirect.exp
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/varname-dot-shell.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/enum.h
diff -u src/usr.bin/make/enum.h:1.12 src/usr.bin/make/enum.h:1.13
--- src/usr.bin/make/enum.h:1.12	Fri Sep 25 15:54:50 2020
+++ src/usr.bin/make/enum.h	Mon Dec 28 00:46:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: enum.h,v 1.12 2020/09/25 15:54:50 rillig Exp $	*/
+/*	$NetBSD: enum.h,v 1.13 2020/12/28 00:46:24 rillig Exp $	*/
 
 /*
  Copyright (c) 2020 Roland Illig <[email protected]>
@@ -130,6 +130,17 @@ const char *Enum_ValueToString(int, cons
 		ENUM__JOIN_STR_1(v3)))
 
 /* Declare the necessary data structures for calling Enum_FlagsToString
+ * for an enum with 4 flags. */
+#define ENUM_FLAGS_RTTI_4(typnam, v1, v2, v3, v4) \
+	ENUM__FLAGS_RTTI(typnam, \
+	    ENUM__SPECS_2( \
+		ENUM__SPEC_2(v1, v2), \
+		ENUM__SPEC_2(v3, v4)), \
+	    ENUM__JOIN_2( \
+		ENUM__JOIN_STR_2(v1, v2), \
+		ENUM__JOIN_STR_2(v3, v4)))
+
+/* Declare the necessary data structures for calling Enum_FlagsToString
  * for an enum with 6 flags. */
 #define ENUM_FLAGS_RTTI_6(typnam, v1, v2, v3, v4, v5, v6) \
 	ENUM__FLAGS_RTTI(typnam, \

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.505 src/usr.bin/make/main.c:1.506
--- src/usr.bin/make/main.c:1.505	Sun Dec 27 11:47:04 2020
+++ src/usr.bin/make/main.c	Mon Dec 28 00:46:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.505 2020/12/27 11:47:04 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.506 2020/12/28 00:46:24 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.505 2020/12/27 11:47:04 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.506 2020/12/28 00:46:24 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	    "The Regents of the University of California.  "
@@ -125,7 +125,6 @@ Boolean deleteOnError;		/* .DELETE_ON_ER
 static int maxJobTokens;	/* -j argument */
 Boolean enterFlagObj;		/* -w and objdir != srcdir */
 
-Boolean preserveUndefined;
 static int jp_0 = -1, jp_1 = -1; /* ends of parent job pipe */
 Boolean doing_depend;		/* Set while reading .depend */
 static Boolean jobsRunning;	/* TRUE if the jobs might be running */

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.239 src/usr.bin/make/make.h:1.240
--- src/usr.bin/make/make.h:1.239	Wed Dec 23 14:05:32 2020
+++ src/usr.bin/make/make.h	Mon Dec 28 00:46:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.239 2020/12/23 14:05:32 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.240 2020/12/28 00:46:24 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -496,21 +496,6 @@ extern char var_Error[];
 /* The time at the start of this whole process */
 extern time_t now;
 
-/*
- * If FALSE (the default behavior), undefined subexpressions in a variable
- * expression are discarded.  If TRUE (only during variable assignments using
- * the ':=' assignment operator, no matter how deeply nested), they are
- * preserved and possibly expanded later when the variable from the
- * subexpression has been defined.
- *
- * Example for a ':=' assignment:
- *	CFLAGS = $(.INCLUDES)
- *	CFLAGS := -I.. $(CFLAGS)
- *	# If .INCLUDES (an undocumented special variable, by the way) is
- *	# still undefined, the updated CFLAGS becomes "-I.. $(.INCLUDES)".
- */
-extern Boolean preserveUndefined;
-
 /* The list of directories to search when looking for targets (set by the
  * special target .PATH). */
 extern SearchPath dirSearchPath;

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.185 src/usr.bin/make/nonints.h:1.186
--- src/usr.bin/make/nonints.h:1.185	Sun Dec 27 14:02:12 2020
+++ src/usr.bin/make/nonints.h	Mon Dec 28 00:46:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.185 2020/12/27 14:02:12 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.186 2020/12/28 00:46:24 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -302,7 +302,20 @@ typedef enum VarEvalFlags {
 	 * See also preserveUndefined, which preserves subexpressions that are
 	 * based on undefined variables; maybe that can be converted to a flag
 	 * as well. */
-	VARE_KEEP_DOLLAR	= 1 << 2
+	VARE_KEEP_DOLLAR	= 1 << 2,
+
+	/*
+	 * Keep undefined variables as-is instead of expanding them to an
+	 * empty string.
+	 *
+	 * Example for a ':=' assignment:
+	 *	CFLAGS = $(.INCLUDES)
+	 *	CFLAGS := -I.. $(CFLAGS)
+	 *	# If .INCLUDES (an undocumented special variable, by the
+	 *	# way) is still undefined, the updated CFLAGS becomes
+	 *	# "-I.. $(.INCLUDES)".
+	 */
+	VARE_KEEP_UNDEF		= 1 << 3
 } VarEvalFlags;
 
 typedef enum VarSetFlags {

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.520 src/usr.bin/make/parse.c:1.521
--- src/usr.bin/make/parse.c:1.520	Sun Dec 27 22:29:37 2020
+++ src/usr.bin/make/parse.c	Mon Dec 28 00:46:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.520 2020/12/27 22:29:37 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.521 2020/12/28 00:46:24 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -117,7 +117,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.520 2020/12/27 22:29:37 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.521 2020/12/28 00:46:24 rillig Exp $");
 
 /* types and constants */
 
@@ -1929,7 +1929,6 @@ VarAssign_EvalSubst(const char *name, co
 {
 	const char *avalue;
 	char *evalue;
-	Boolean savedPreserveUndefined = preserveUndefined;
 
 	/*
 	 * make sure that we set the variable the first time to nothing
@@ -1938,9 +1937,8 @@ VarAssign_EvalSubst(const char *name, co
 	if (!Var_Exists(name, ctxt))
 		Var_Set(name, "", ctxt);
 
-	preserveUndefined = TRUE;
-	(void)Var_Subst(uvalue, ctxt, VARE_WANTRES | VARE_KEEP_DOLLAR, &evalue);
-	preserveUndefined = savedPreserveUndefined;
+	(void)Var_Subst(uvalue, ctxt,
+	    VARE_WANTRES | VARE_KEEP_DOLLAR | VARE_KEEP_UNDEF, &evalue);
 	/* TODO: handle errors */
 
 	avalue = evalue;

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.773 src/usr.bin/make/var.c:1.774
--- src/usr.bin/make/var.c:1.773	Sun Dec 27 16:31:58 2020
+++ src/usr.bin/make/var.c	Mon Dec 28 00:46:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.773 2020/12/27 16:31:58 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.774 2020/12/28 00:46:24 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.773 2020/12/27 16:31:58 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.774 2020/12/28 00:46:24 rillig Exp $");
 
 typedef enum VarFlags {
 	VAR_NONE	= 0,
@@ -243,8 +243,9 @@ typedef struct SepBuf {
 } SepBuf;
 
 
-ENUM_FLAGS_RTTI_3(VarEvalFlags,
-		  VARE_UNDEFERR, VARE_WANTRES, VARE_KEEP_DOLLAR);
+ENUM_FLAGS_RTTI_4(VarEvalFlags,
+		  VARE_UNDEFERR, VARE_WANTRES, VARE_KEEP_DOLLAR,
+		  VARE_KEEP_UNDEF);
 
 /*
  * This lets us tell if we have replaced the original environ
@@ -4194,7 +4195,7 @@ VarSubstExpr(const char **pp, Buffer *bu
 	/* TODO: handle errors */
 
 	if (val.str == var_Error || val.str == varUndefined) {
-		if (!preserveUndefined) {
+		if (!(eflags & VARE_KEEP_UNDEF)) {
 			p = nested_p;
 		} else if ((eflags & VARE_UNDEFERR) || val.str == var_Error) {
 

Index: src/usr.bin/make/unit-tests/varmod-defined.exp
diff -u src/usr.bin/make/unit-tests/varmod-defined.exp:1.2 src/usr.bin/make/unit-tests/varmod-defined.exp:1.3
--- src/usr.bin/make/unit-tests/varmod-defined.exp:1.2	Sun Nov  8 20:29:13 2020
+++ src/usr.bin/make/unit-tests/varmod-defined.exp	Mon Dec 28 00:46:24 2020
@@ -1,22 +1,22 @@
 Global:8_DOLLARS = $$$$$$$$
 Global:VAR = 
-Var_Parse: ${8_DOLLARS} with VARE_WANTRES|VARE_KEEP_DOLLAR
+Var_Parse: ${8_DOLLARS} with VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF
 Global:VAR = $$$$$$$$
-Var_Parse: ${VAR:D${8_DOLLARS}} with VARE_WANTRES|VARE_KEEP_DOLLAR
-Applying ${VAR:D...} to "$$$$$$$$" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, none)
-Var_Parse: ${8_DOLLARS}} with VARE_WANTRES|VARE_KEEP_DOLLAR
-Result of ${VAR:D${8_DOLLARS}} is "$$$$$$$$" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, none)
+Var_Parse: ${VAR:D${8_DOLLARS}} with VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF
+Applying ${VAR:D...} to "$$$$$$$$" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, none)
+Var_Parse: ${8_DOLLARS}} with VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF
+Result of ${VAR:D${8_DOLLARS}} is "$$$$$$$$" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, none)
 Global:VAR = $$$$$$$$
-Var_Parse: ${VAR:@var@${8_DOLLARS}@} with VARE_WANTRES|VARE_KEEP_DOLLAR
-Applying ${VAR:@...} to "$$$$$$$$" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, none)
+Var_Parse: ${VAR:@var@${8_DOLLARS}@} with VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF
+Applying ${VAR:@...} to "$$$$$$$$" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, none)
 Modifier part: "var"
 Modifier part: "${8_DOLLARS}"
 ModifyWords: split "$$$$$$$$" into 1 words
 Global:var = $$$$$$$$
-Var_Parse: ${8_DOLLARS} with VARE_WANTRES
+Var_Parse: ${8_DOLLARS} with VARE_WANTRES|VARE_KEEP_UNDEF
 ModifyWord_Loop: in "$$$$$$$$", replace "var" with "${8_DOLLARS}" to "$$$$"
 Global:delete var
-Result of ${VAR:@var@${8_DOLLARS}@} is "$$$$" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, none)
+Result of ${VAR:@var@${8_DOLLARS}@} is "$$$$" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, none)
 Global:VAR = $$$$
 Global:.MAKEFLAGS =  -r -k -d v -d
 Global:.MAKEFLAGS =  -r -k -d v -d 0

Index: src/usr.bin/make/unit-tests/varmod-indirect.exp
diff -u src/usr.bin/make/unit-tests/varmod-indirect.exp:1.6 src/usr.bin/make/unit-tests/varmod-indirect.exp:1.7
--- src/usr.bin/make/unit-tests/varmod-indirect.exp:1.6	Sun Dec 27 17:32:25 2020
+++ src/usr.bin/make/unit-tests/varmod-indirect.exp	Mon Dec 28 00:46:24 2020
@@ -10,45 +10,45 @@ make: "varmod-indirect.mk" line 125: bef
 make: "varmod-indirect.mk" line 125: after
 ParseReadLine (134): '_:=	before ${UNDEF} after'
 Global:_ = 
-Var_Parse: ${UNDEF} after with VARE_WANTRES|VARE_KEEP_DOLLAR
+Var_Parse: ${UNDEF} after with VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF
 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
-Var_Parse: ${:US,a,a,}} after with VARE_WANTRES|VARE_KEEP_DOLLAR
-Applying ${:U...} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
-Result of ${:US,a,a,} is "S,a,a," (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF|VEF_DEF)
+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)
 Indirect modifier "S,a,a," from "${:US,a,a,}"
-Applying ${UNDEF:S...} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
+Applying ${UNDEF:S...} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VEF_UNDEF)
 Modifier part: "a"
 Modifier part: "a"
 ModifyWords: split "" into 1 words
-Result of ${UNDEF:S,a,a,} is "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
-Var_Parse: ${:US,a,a,}} after with VARE_WANTRES|VARE_KEEP_DOLLAR
-Applying ${:U...} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
-Result of ${:US,a,a,} is "S,a,a," (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF|VEF_DEF)
+Result of ${UNDEF:S,a,a,} is "" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VEF_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)
 Global:_ = before ${UNDEF:S,a,a,} after
 ParseReadLine (147): '_:=	before ${UNDEF:${:U}} after'
-Var_Parse: ${UNDEF:${:U}} after with VARE_WANTRES|VARE_KEEP_DOLLAR
-Var_Parse: ${:U}} after with VARE_WANTRES|VARE_KEEP_DOLLAR
-Applying ${:U} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
-Result of ${:U} is "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF|VEF_DEF)
+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)
 Indirect modifier "" from "${:U}"
-Var_Parse: ${:U}} after with VARE_WANTRES|VARE_KEEP_DOLLAR
-Applying ${:U} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
-Result of ${:U} is "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF|VEF_DEF)
+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)
 Global:_ = before ${UNDEF:} after
 ParseReadLine (152): '_:=	before ${UNDEF:${:UZ}} after'
-Var_Parse: ${UNDEF:${:UZ}} after with VARE_WANTRES|VARE_KEEP_DOLLAR
-Var_Parse: ${:UZ}} after with VARE_WANTRES|VARE_KEEP_DOLLAR
-Applying ${:U...} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
-Result of ${:UZ} is "Z" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF|VEF_DEF)
+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)
 Indirect modifier "Z" from "${:UZ}"
-Applying ${UNDEF:Z} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
+Applying ${UNDEF:Z} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VEF_UNDEF)
 make: "varmod-indirect.mk" line 152: Unknown modifier 'Z'
-Result of ${UNDEF:Z} is error (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
-Var_Parse: ${:UZ}} after with VARE_WANTRES|VARE_KEEP_DOLLAR
-Applying ${:U...} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
-Result of ${:UZ} is "Z" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF|VEF_DEF)
+Result of ${UNDEF:Z} is error (VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF, none, VEF_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)
 Global:_ = before ${UNDEF:Z} after
 ParseReadLine (154): '.MAKEFLAGS: -d0'
 ParseDoDependency(.MAKEFLAGS: -d0)

Index: src/usr.bin/make/unit-tests/varname-dot-shell.exp
diff -u src/usr.bin/make/unit-tests/varname-dot-shell.exp:1.8 src/usr.bin/make/unit-tests/varname-dot-shell.exp:1.9
--- src/usr.bin/make/unit-tests/varname-dot-shell.exp:1.8	Sun Nov  8 16:58:34 2020
+++ src/usr.bin/make/unit-tests/varname-dot-shell.exp	Mon Dec 28 00:46:24 2020
@@ -1,6 +1,6 @@
 ParseReadLine (10): 'ORIG_SHELL:=	${.SHELL}'
 Global:ORIG_SHELL = 
-Var_Parse: ${.SHELL} with VARE_WANTRES|VARE_KEEP_DOLLAR
+Var_Parse: ${.SHELL} with VARE_WANTRES|VARE_KEEP_DOLLAR|VARE_KEEP_UNDEF
 Global:delete .SHELL (not found)
 Command:.SHELL = (details omitted)
 Global:ORIG_SHELL = (details omitted)

Reply via email to