Module Name:    src
Committed By:   rillig
Date:           Mon Feb 15 07:58:19 UTC 2021

Modified Files:
        src/usr.bin/make/unit-tests: directive-for-escape.exp
            directive-for-escape.mk

Log Message:
make: improve comments in test for expansions in .for loops


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/directive-for-escape.exp \
    src/usr.bin/make/unit-tests/directive-for-escape.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/directive-for-escape.exp
diff -u src/usr.bin/make/unit-tests/directive-for-escape.exp:1.6 src/usr.bin/make/unit-tests/directive-for-escape.exp:1.7
--- src/usr.bin/make/unit-tests/directive-for-escape.exp:1.6	Mon Jan 25 19:05:39 2021
+++ src/usr.bin/make/unit-tests/directive-for-escape.exp	Mon Feb 15 07:58:19 2021
@@ -37,19 +37,19 @@ make: "directive-for-escape.mk" line 55:
 For: end for 1
 For: loop body:
 .  info ${:Ubegin<${UNDEF:Ufallback:N{{{}}}}>end}
-make: "directive-for-escape.mk" line 66: begin<fallback>end
+make: "directive-for-escape.mk" line 67: begin<fallback>end
 For: end for 1
 For: loop body:
 .  info ${:U\$}
-make: "directive-for-escape.mk" line 74: $
+make: "directive-for-escape.mk" line 75: $
 For: end for 1
 For: loop body:
 .  info ${NUMBERS} ${:Ureplaced}
-make: "directive-for-escape.mk" line 82: one two three replaced
+make: "directive-for-escape.mk" line 83: one two three replaced
 For: end for 1
 For: loop body:
 .  info ${:Ureplaced}
-make: "directive-for-escape.mk" line 92: replaced
+make: "directive-for-escape.mk" line 93: replaced
 For: end for 1
 For: loop body:
 .  info .        $$i: ${:Uinner}
@@ -62,14 +62,14 @@ For: loop body:
 .  info .     $${i2}: ${i2}
 .  info .     $${i,}: ${i,}
 .  info .  adjacent: ${:Uinner}${:Uinner}${:Uinner:M*}${:Uinner}
-make: "directive-for-escape.mk" line 100: .        $i: inner
-make: "directive-for-escape.mk" line 101: .      ${i}: inner
-make: "directive-for-escape.mk" line 102: .   ${i:M*}: inner
-make: "directive-for-escape.mk" line 103: .      $(i): inner
-make: "directive-for-escape.mk" line 104: .   $(i:M*): inner
-make: "directive-for-escape.mk" line 105: . ${i${:U}}: outer
-make: "directive-for-escape.mk" line 106: .    ${i\}}: inner}
-make: "directive-for-escape.mk" line 107: .     ${i2}: two
-make: "directive-for-escape.mk" line 108: .     ${i,}: comma
-make: "directive-for-escape.mk" line 109: .  adjacent: innerinnerinnerinner
+make: "directive-for-escape.mk" line 101: .        $i: inner
+make: "directive-for-escape.mk" line 102: .      ${i}: inner
+make: "directive-for-escape.mk" line 103: .   ${i:M*}: inner
+make: "directive-for-escape.mk" line 104: .      $(i): inner
+make: "directive-for-escape.mk" line 105: .   $(i:M*): inner
+make: "directive-for-escape.mk" line 106: . ${i${:U}}: outer
+make: "directive-for-escape.mk" line 107: .    ${i\}}: inner}
+make: "directive-for-escape.mk" line 108: .     ${i2}: two
+make: "directive-for-escape.mk" line 109: .     ${i,}: comma
+make: "directive-for-escape.mk" line 110: .  adjacent: innerinnerinnerinner
 exit status 0
Index: src/usr.bin/make/unit-tests/directive-for-escape.mk
diff -u src/usr.bin/make/unit-tests/directive-for-escape.mk:1.6 src/usr.bin/make/unit-tests/directive-for-escape.mk:1.7
--- src/usr.bin/make/unit-tests/directive-for-escape.mk:1.6	Mon Jan 25 19:05:39 2021
+++ src/usr.bin/make/unit-tests/directive-for-escape.mk	Mon Feb 15 07:58:19 2021
@@ -1,4 +1,4 @@
-# $NetBSD: directive-for-escape.mk,v 1.6 2021/01/25 19:05:39 rillig Exp $
+# $NetBSD: directive-for-escape.mk,v 1.7 2021/02/15 07:58:19 rillig Exp $
 #
 # Test escaping of special characters in the iteration values of a .for loop.
 # These values get expanded later using the :U variable modifier, and this
@@ -7,8 +7,8 @@
 
 .MAKEFLAGS: -df
 
-# Even though the .for loops takes quotes into account when splitting the
-# string into words, the quotes don't need to be balances, as of 2020-12-31.
+# Even though the .for loops take quotes into account when splitting the
+# string into words, the quotes don't need to be balanced, as of 2020-12-31.
 # This could be considered a bug.
 ASCII=	!"\#$$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~
 
@@ -33,7 +33,7 @@ ASCII.2020-12-31=	!"\\\#$$%&'()*+,-./0-9
 #
 # XXX: It is unexpected that the variable V gets expanded in the loop body.
 # The double '$$' should prevent exactly this.  Probably nobody was
-# adventurous enough to use literal dollar signs in the values for a .for
+# adventurous enough to use literal dollar signs in the values of a .for
 # loop.
 V=		value
 VALUES=		$$ $${V} $${V:=-with-modifier} $$(V) $$(V:=-with-modifier)
@@ -43,14 +43,14 @@ VALUES=		$$ $${V} $${V:=-with-modifier} 
 
 # Try to cover the code for nested '{}' in for_var_len, without success.
 #
-# The value of VALUES is not meant to be a variable expression.  Instead, it
-# is meant to represent dollar, lbrace, "UNDEF:U", backslash, dollar,
-# backslash, dollar, space, nested braces, space, "end}".
+# The value of the variable VALUES is not meant to be a variable expression.
+# Instead, it is meant to represent literal text, the only escaping mechanism
+# being that each '$' is written as '$$'.
 #
 # The .for loop splits ${VALUES} into 3 words, at the space characters, since
 # these are not escaped.
 VALUES=		$${UNDEF:U\$$\$$ {{}} end}
-# XXX: Where does the '\$$\$$' get converted into a single '\$'?
+# XXX: Where in the code does the '\$\$' get converted into a single '\$'?
 .for i in ${VALUES}
 .  info $i
 .endfor
@@ -59,8 +59,9 @@ VALUES=		$${UNDEF:U\$$\$$ {{}} end}
 #
 # XXX: It is wrong that for_var_len requires the braces to be balanced.
 # Each variable modifier has its own inconsistent way of parsing nested
-# variable expressions, braces and parentheses.  The only sensible thing
-# to do is therefore to let Var_Parse do all the parsing work.
+# variable expressions, braces and parentheses.  (Compare ':M', ':S', and
+# ':D' for details.)  The only sensible thing to do is therefore to let
+# Var_Parse do all the parsing work.
 VALUES=		begin<$${UNDEF:Ufallback:N{{{}}}}>end
 .for i in ${VALUES}
 .  info $i

Reply via email to