Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make/unit-tests make(1): split test for indirect mod...
details: https://anonhg.NetBSD.org/src/rev/3eea52da31d8
branches: trunk
changeset: 979391:3eea52da31d8
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Dec 27 17:32:25 2020 +0000
description:
make(1): split test for indirect modifiers into paragraphs
diffstat:
usr.bin/make/unit-tests/varmod-indirect.exp | 12 ++++++------
usr.bin/make/unit-tests/varmod-indirect.mk | 10 ++++++++--
2 files changed, 14 insertions(+), 8 deletions(-)
diffs (89 lines):
diff -r 233c496a8692 -r 3eea52da31d8 usr.bin/make/unit-tests/varmod-indirect.exp
--- a/usr.bin/make/unit-tests/varmod-indirect.exp Sun Dec 27 17:17:46 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-indirect.exp Sun Dec 27 17:32:25 2020 +0000
@@ -8,11 +8,11 @@
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 @@
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 @@
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
diff -r 233c496a8692 -r 3eea52da31d8 usr.bin/make/unit-tests/varmod-indirect.mk
--- a/usr.bin/make/unit-tests/varmod-indirect.mk Sun Dec 27 17:17:46 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-indirect.mk Sun Dec 27 17:32:25 2020 +0000
@@ -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 @@
# 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 _
Home |
Main Index |
Thread Index |
Old Index