make(1): remove dead code from ApplyModifiersIndirect
At that point, the expression can never be varUndefined. At the beginning of ParseVarnameLong, the expression is initialized to a simple empty string, and that string is only ever converted to varUndefined at the very end of Var_Parse.
This commit is contained in:
parent
831eba2610
commit
9524640e66
@ -1,4 +1,8 @@
|
||||
make: "varmod-indirect.mk" line 13: Unknown modifier '$'
|
||||
make: "varmod-indirect.mk" line 106: before
|
||||
make: "varmod-indirect.mk" line 106: after
|
||||
make: "varmod-indirect.mk" line 112: before
|
||||
make: "varmod-indirect.mk" line 112: after
|
||||
make: Fatal errors encountered -- cannot continue
|
||||
make: stopped in unit-tests
|
||||
exit status 1
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: varmod-indirect.mk,v 1.2 2020/12/20 19:29:06 rillig Exp $
|
||||
# $NetBSD: varmod-indirect.mk,v 1.3 2020/12/27 16:31:58 rillig Exp $
|
||||
#
|
||||
# Tests for indirect variable modifiers, such as in ${VAR:${M_modifiers}}.
|
||||
# These can be used for very basic purposes like converting a string to either
|
||||
@ -99,4 +99,17 @@ M_NoPrimes= ${PRIMES:${M_ListToSkip}}
|
||||
.endif
|
||||
.MAKEFLAGS: -d0
|
||||
|
||||
|
||||
# In contrast to the .if conditions, the .for loop allows undefined variable
|
||||
# expressions. These expressions expand to empty strings.
|
||||
.for var in before ${UNDEF} ${UNDEF:${:US,a,a,}} after
|
||||
. info ${var}
|
||||
.endfor
|
||||
|
||||
# Even in an indirect modifier based on an undefined variable, the value of
|
||||
# the expression in Var_Parse is a simple empty string.
|
||||
.for var in before ${UNDEF} ${UNDEF:${:U}} after
|
||||
. info ${var}
|
||||
.endfor
|
||||
|
||||
all:
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: var.c,v 1.772 2020/12/27 14:41:25 rillig Exp $ */
|
||||
/* $NetBSD: var.c,v 1.773 2020/12/27 16:31:58 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.772 2020/12/27 14:41:25 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: var.c,v 1.773 2020/12/27 16:31:58 rillig Exp $");
|
||||
|
||||
typedef enum VarFlags {
|
||||
VAR_NONE = 0,
|
||||
@ -3473,8 +3473,7 @@ ApplyModifiersIndirect(ApplyModifiersState *st, const char **pp,
|
||||
FStr newVal = ApplyModifiers(&modsp, *inout_value, '\0', '\0',
|
||||
st->var, &st->exprFlags, st->ctxt, st->eflags);
|
||||
*inout_value = newVal;
|
||||
if (newVal.str == var_Error || newVal.str == varUndefined ||
|
||||
*modsp != '\0') {
|
||||
if (newVal.str == var_Error || *modsp != '\0') {
|
||||
FStr_Done(&mods);
|
||||
*pp = p;
|
||||
return AMIR_OUT; /* error already reported */
|
||||
|
Loading…
Reference in New Issue
Block a user