Module Name:    src
Committed By:   rillig
Date:           Tue Aug 23 17:40:43 UTC 2022

Modified Files:
        src/usr.bin/make/unit-tests: varmod-loop.exp varmod-loop.mk

Log Message:
tests/make: demonstrate parse error in ':@' modifier (since 2022-08-08)

Reported by sjg via private mail.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/make/unit-tests/varmod-loop.exp
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/make/unit-tests/varmod-loop.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-loop.exp
diff -u src/usr.bin/make/unit-tests/varmod-loop.exp:1.15 src/usr.bin/make/unit-tests/varmod-loop.exp:1.16
--- src/usr.bin/make/unit-tests/varmod-loop.exp:1.15	Thu Mar  3 19:36:35 2022
+++ src/usr.bin/make/unit-tests/varmod-loop.exp	Tue Aug 23 17:40:43 2022
@@ -13,4 +13,6 @@ mod-loop-dollar:$3$:
 mod-loop-dollar:$${word}$$:
 mod-loop-dollar:$$5$$:
 mod-loop-dollar:$$${word}$$$:
+make: Unknown modifier "-0"
+:  t=$(( ${t:-0} + 1 ))
 exit status 0

Index: src/usr.bin/make/unit-tests/varmod-loop.mk
diff -u src/usr.bin/make/unit-tests/varmod-loop.mk:1.18 src/usr.bin/make/unit-tests/varmod-loop.mk:1.19
--- src/usr.bin/make/unit-tests/varmod-loop.mk:1.18	Sun Dec  5 15:20:13 2021
+++ src/usr.bin/make/unit-tests/varmod-loop.mk	Tue Aug 23 17:40:43 2022
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-loop.mk,v 1.18 2021/12/05 15:20:13 rillig Exp $
+# $NetBSD: varmod-loop.mk,v 1.19 2022/08/23 17:40:43 rillig Exp $
 #
 # Tests for the :@var@...${var}...@ variable modifier.
 
@@ -186,4 +186,16 @@ CMDLINE=	global		# needed for deleting t
 .  error			# 'CMDLINE' is gone now from all scopes
 .endif
 
+
+# In the loop body text of the ':@' modifier, a literal '$' is written as '$$',
+# not '\$'.  In the following example, each '$$' turns into a single '$',
+# except for '$i', which is replaced with the then-current value '1' of the
+# iteration variable.
+#
+# FIXME: broken since var.c 1.1028 from 2022-08-08.
+all: varmod-loop-literal-dollar
+varmod-loop-literal-dollar: .PHONY
+	: ${:U1:@i@ t=$$(( $${t:-0} + $i ))@}
+
+
 all: .PHONY

Reply via email to