Module Name:    src
Committed By:   rillig
Date:           Sat Jun  1 05:08:48 UTC 2024

Modified Files:
        src/usr.bin/make: make.h var.c
        src/usr.bin/make/unit-tests: varmod-loop.exp varmod-loop.mk

Log Message:
make: remove unused VARE_EVAL_KEEP_DOLLAR


To generate a diff of this commit:
cvs rdiff -u -r1.335 -r1.336 src/usr.bin/make/make.h
cvs rdiff -u -r1.1115 -r1.1116 src/usr.bin/make/var.c
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/unit-tests/varmod-loop.exp
cvs rdiff -u -r1.24 -r1.25 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/make.h
diff -u src/usr.bin/make/make.h:1.335 src/usr.bin/make/make.h:1.336
--- src/usr.bin/make/make.h:1.335	Sat May 25 21:07:48 2024
+++ src/usr.bin/make/make.h	Sat Jun  1 05:08:48 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.335 2024/05/25 21:07:48 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.336 2024/06/01 05:08:48 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -957,18 +957,6 @@ typedef enum VarEvalMode {
 	VARE_UNDEFERR,
 
 	/*
-	 * Parse and evaluate the expression.  Keep '$$' as '$$' instead of
-	 * reducing it to a single '$'.  Subexpressions that evaluate to
-	 * undefined expand to an empty string.
-	 *
-	 * Used in variable assignments using the ':=' operator.  It allows
-	 * multiple such assignments to be chained without accidentally
-	 * expanding '$$file' to '$file' in the first assignment and
-	 * interpreting it as '${f}' followed by 'ile' in the next assignment.
-	 */
-	VARE_EVAL_KEEP_DOLLAR,
-
-	/*
 	 * Parse and evaluate the expression.  Keep undefined variables as-is
 	 * instead of expanding them to an empty string.
 	 *

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.1115 src/usr.bin/make/var.c:1.1116
--- src/usr.bin/make/var.c:1.1115	Fri May 31 20:21:34 2024
+++ src/usr.bin/make/var.c	Sat Jun  1 05:08:48 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.1115 2024/05/31 20:21:34 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.1116 2024/06/01 05:08:48 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -132,7 +132,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.1115 2024/05/31 20:21:34 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1116 2024/06/01 05:08:48 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -328,7 +328,6 @@ static const char VarEvalMode_Name[][32]
 	"parse-balanced",
 	"eval",
 	"eval-defined",
-	"eval-keep-dollar",
 	"eval-keep-undefined",
 	"eval-keep-dollar-and-undefined",
 };
@@ -1284,11 +1283,7 @@ GNode_ValueDirect(GNode *gn, const char 
 static VarEvalMode
 VarEvalMode_WithoutKeepDollar(VarEvalMode emode)
 {
-	if (emode == VARE_KEEP_DOLLAR_UNDEF)
-		return VARE_EVAL_KEEP_UNDEF;
-	if (emode == VARE_EVAL_KEEP_DOLLAR)
-		return VARE_WANTRES;
-	return emode;
+	return emode == VARE_KEEP_DOLLAR_UNDEF ? VARE_EVAL_KEEP_UNDEF : emode;
 }
 
 static VarEvalMode
@@ -1313,8 +1308,7 @@ VarEvalMode_ShouldKeepUndef(VarEvalMode 
 static bool
 VarEvalMode_ShouldKeepDollar(VarEvalMode emode)
 {
-	return emode == VARE_EVAL_KEEP_DOLLAR ||
-	       emode == VARE_KEEP_DOLLAR_UNDEF;
+	return emode == VARE_KEEP_DOLLAR_UNDEF;
 }
 
 

Index: src/usr.bin/make/unit-tests/varmod-loop.exp
diff -u src/usr.bin/make/unit-tests/varmod-loop.exp:1.20 src/usr.bin/make/unit-tests/varmod-loop.exp:1.21
--- src/usr.bin/make/unit-tests/varmod-loop.exp:1.20	Sun Apr 14 12:30:48 2024
+++ src/usr.bin/make/unit-tests/varmod-loop.exp	Sat Jun  1 05:08:48 2024
@@ -1,12 +1,12 @@
-Parsing line 91: USE_8_DOLLARS=	${:U1:@var@${8_DOLLARS}@} ${8_DOLLARS} $$$$$$$$
-Parsing line 92: .if ${USE_8_DOLLARS} != "\$\$\$\$ \$\$\$\$ \$\$\$\$"
+Parsing line 89: USE_8_DOLLARS=	${:U1:@var@${8_DOLLARS}@} ${8_DOLLARS} $$$$$$$$
+Parsing line 90: .if ${USE_8_DOLLARS} != "\$\$\$\$ \$\$\$\$ \$\$\$\$"
 CondParser_Eval: ${USE_8_DOLLARS} != "\$\$\$\$ \$\$\$\$ \$\$\$\$"
 Comparing "$$$$ $$$$ $$$$" != "$$$$ $$$$ $$$$"
-Parsing line 96: SUBST_CONTAINING_LOOP:= ${USE_8_DOLLARS}
-Parsing line 118: .if ${SUBST_CONTAINING_LOOP} != "\$\$ \$\$\$\$ \$\$\$\$"
+Parsing line 94: SUBST_CONTAINING_LOOP:= ${USE_8_DOLLARS}
+Parsing line 116: .if ${SUBST_CONTAINING_LOOP} != "\$\$ \$\$\$\$ \$\$\$\$"
 CondParser_Eval: ${SUBST_CONTAINING_LOOP} != "\$\$ \$\$\$\$ \$\$\$\$"
 Comparing "$$ $$$$ $$$$" != "$$ $$$$ $$$$"
-Parsing line 121: .MAKEFLAGS: -d0
+Parsing line 119: .MAKEFLAGS: -d0
 ParseDependency(.MAKEFLAGS: -d0)
 :varname-overwriting-target: :x1y x2y x3y: ::
 mod-loop-dollar:1:

Index: src/usr.bin/make/unit-tests/varmod-loop.mk
diff -u src/usr.bin/make/unit-tests/varmod-loop.mk:1.24 src/usr.bin/make/unit-tests/varmod-loop.mk:1.25
--- src/usr.bin/make/unit-tests/varmod-loop.mk:1.24	Sun Nov 19 21:47:52 2023
+++ src/usr.bin/make/unit-tests/varmod-loop.mk	Sat Jun  1 05:08:48 2024
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-loop.mk,v 1.24 2023/11/19 21:47:52 rillig Exp $
+# $NetBSD: varmod-loop.mk,v 1.25 2024/06/01 05:08:48 rillig Exp $
 #
 # Tests for the expression modifier ':@var@body@', which replaces each word of
 # the expression with the expanded body, which may contain references to the
@@ -82,10 +82,8 @@ mod-loop-dollar:
 8_DOLLARS=	$$$$$$$$
 # 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 VARE_EVAL_KEEP_DOLLAR, but that flag is usually removed
-# before expanding subexpressions.  See ApplyModifier_Loop and
-# ParseModifierPart for examples.
+# Var_Subst, which replaces each '$$' with a single '$'.
+# See ApplyModifier_Loop and ParseModifierPart for examples.
 #
 .MAKEFLAGS: -dcp
 USE_8_DOLLARS=	${:U1:@var@${8_DOLLARS}@} ${8_DOLLARS} $$$$$$$$

Reply via email to