make: remove unused VARE_EVAL_KEEP_DOLLAR

This commit is contained in:
rillig 2024-06-01 05:08:48 +00:00
parent 8b057ce4a3
commit f8e0665918
4 changed files with 13 additions and 33 deletions

View File

@ -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
@ -956,18 +956,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.

View File

@ -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:

View File

@ -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} $$$$$$$$

View File

@ -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 *name)
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 emode)
static bool
VarEvalMode_ShouldKeepDollar(VarEvalMode emode)
{
return emode == VARE_EVAL_KEEP_DOLLAR ||
emode == VARE_KEEP_DOLLAR_UNDEF;
return emode == VARE_KEEP_DOLLAR_UNDEF;
}