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 tests/make: demonstrate parse error ...



details:   https://anonhg.NetBSD.org/src/rev/8cef8305bde8
branches:  trunk
changeset: 369613:8cef8305bde8
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Aug 23 17:40:43 2022 +0000

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

Reported by sjg via private mail.

diffstat:

 usr.bin/make/unit-tests/varmod-loop.exp |   2 ++
 usr.bin/make/unit-tests/varmod-loop.mk  |  14 +++++++++++++-
 2 files changed, 15 insertions(+), 1 deletions(-)

diffs (36 lines):

diff -r 74289a0828c6 -r 8cef8305bde8 usr.bin/make/unit-tests/varmod-loop.exp
--- a/usr.bin/make/unit-tests/varmod-loop.exp   Tue Aug 23 16:36:02 2022 +0000
+++ b/usr.bin/make/unit-tests/varmod-loop.exp   Tue Aug 23 17:40:43 2022 +0000
@@ -13,4 +13,6 @@
 mod-loop-dollar:$${word}$$:
 mod-loop-dollar:$$5$$:
 mod-loop-dollar:$$${word}$$$:
+make: Unknown modifier "-0"
+:  t=$(( ${t:-0} + 1 ))
 exit status 0
diff -r 74289a0828c6 -r 8cef8305bde8 usr.bin/make/unit-tests/varmod-loop.mk
--- a/usr.bin/make/unit-tests/varmod-loop.mk    Tue Aug 23 16:36:02 2022 +0000
+++ b/usr.bin/make/unit-tests/varmod-loop.mk    Tue Aug 23 17:40:43 2022 +0000
@@ -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 @@
 .  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



Home | Main Index | Thread Index | Old Index