Module Name: src
Committed By: rillig
Date: Sun Dec 27 17:32:25 UTC 2020
Modified Files:
src/usr.bin/make/unit-tests: varmod-indirect.exp varmod-indirect.mk
Log Message:
make(1): split test for indirect modifiers into paragraphs
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-indirect.exp
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/varmod-indirect.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/unit-tests/varmod-indirect.exp
diff -u src/usr.bin/make/unit-tests/varmod-indirect.exp:1.5 src/usr.bin/make/unit-tests/varmod-indirect.exp:1.6
--- src/usr.bin/make/unit-tests/varmod-indirect.exp:1.5 Sun Dec 27 17:17:46 2020
+++ src/usr.bin/make/unit-tests/varmod-indirect.exp Sun Dec 27 17:32:25 2020
@@ -8,11 +8,11 @@ make: "varmod-indirect.mk" line 120: aft
make: "varmod-indirect.mk" line 124: Unknown modifier 'Z'
make: "varmod-indirect.mk" line 125: before
make: "varmod-indirect.mk" line 125: after
-ParseReadLine (133): '_:= before ${UNDEF} after'
+ParseReadLine (134): '_:= before ${UNDEF} after'
Global:_ =
Var_Parse: ${UNDEF} after with VARE_WANTRES|VARE_KEEP_DOLLAR
Global:_ = before ${UNDEF} after
-ParseReadLine (135): '_:= before ${UNDEF:${:US,a,a,}} 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)
@@ -27,7 +27,7 @@ Var_Parse: ${:US,a,a,}} after with VARE_
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)
Global:_ = before ${UNDEF:S,a,a,} after
-ParseReadLine (143): '_:= before ${UNDEF:${:U}} 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)
@@ -37,20 +37,20 @@ Var_Parse: ${:U}} after with VARE_WANTRE
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)
Global:_ = before ${UNDEF:} after
-ParseReadLine (147): '_:= before ${UNDEF:${:UZ}} 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)
Indirect modifier "Z" from "${:UZ}"
Applying ${UNDEF:Z} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, VEF_UNDEF)
-make: "varmod-indirect.mk" line 147: Unknown modifier 'Z'
+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)
Global:_ = before ${UNDEF:Z} after
-ParseReadLine (148): '.MAKEFLAGS: -d0'
+ParseReadLine (154): '.MAKEFLAGS: -d0'
ParseDoDependency(.MAKEFLAGS: -d0)
Global:.MAKEFLAGS = -r -k -d 0 -d pv -d
Global:.MAKEFLAGS = -r -k -d 0 -d pv -d 0
Index: src/usr.bin/make/unit-tests/varmod-indirect.mk
diff -u src/usr.bin/make/unit-tests/varmod-indirect.mk:1.4 src/usr.bin/make/unit-tests/varmod-indirect.mk:1.5
--- src/usr.bin/make/unit-tests/varmod-indirect.mk:1.4 Sun Dec 27 17:17:46 2020
+++ src/usr.bin/make/unit-tests/varmod-indirect.mk Sun Dec 27 17:32:25 2020
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-indirect.mk,v 1.4 2020/12/27 17:17:46 rillig Exp $
+# $NetBSD: varmod-indirect.mk,v 1.5 2020/12/27 17:32:25 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
@@ -129,22 +129,28 @@ M_NoPrimes= ${PRIMES:${M_ListToSkip}}
# Another slightly different evaluation context is the right-hand side of
# a variable assignment using ':='.
.MAKEFLAGS: -dpv
+
# The undefined variable expression is kept as-is.
_:= before ${UNDEF} after
+
# The undefined variable expression is kept as-is.
_:= before ${UNDEF:${:US,a,a,}} after
+
# XXX: The subexpression ${:U} is fully defined, therefore it is expanded.
# This results in ${UNDEF:}, which can lead to tricky parse errors later,
# when the variable '_' is expanded further.
+#
# XXX: What should be the correct strategy here? One possibility is to
-# expand the defined subexpression and replace them with ${:U...}, just like
+# expand the defined subexpression and replace it with ${:U...}, just like
# in .for loops. This would preserve the structure of the expression while
# at the same time expanding the expression as far as possible.
_:= before ${UNDEF:${:U}} after
+
# XXX: This expands to ${UNDEF:Z}, which will behave differently if the
# variable '_' is used in a context where the variable expression ${_} is
# parsed but not evaluated.
_:= before ${UNDEF:${:UZ}} after
+
.MAKEFLAGS: -d0
.undef _