Module Name:    src
Committed By:   rillig
Date:           Sun Mar 14 17:14:16 UTC 2021

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

Log Message:
tests/make: demonstrate unintended edge case for the ':_' modifier


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/varmod-remember.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-remember.mk
diff -u src/usr.bin/make/unit-tests/varmod-remember.mk:1.4 src/usr.bin/make/unit-tests/varmod-remember.mk:1.5
--- src/usr.bin/make/unit-tests/varmod-remember.mk:1.4	Sun Mar 14 17:07:11 2021
+++ src/usr.bin/make/unit-tests/varmod-remember.mk	Sun Mar 14 17:14:15 2021
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-remember.mk,v 1.4 2021/03/14 17:07:11 rillig Exp $
+# $NetBSD: varmod-remember.mk,v 1.5 2021/03/14 17:14:15 rillig Exp $
 #
 # Tests for the :_ modifier, which saves the current variable value
 # in the _ variable or another, to be used later again.
@@ -17,4 +17,16 @@
 .  error
 .endif
 
+# The ':_' modifier takes a variable name as optional argument.  This variable
+# name can refer to other variables, though this was rather an implementation
+# oversight than an intended feature.  The variable name stops at the first
+# '}' or ')' and thus cannot use the usual form ${VARNAME} of long variable
+# names.
+S=	INDIRECT_VARNAME
+.if ${value:L:@var@${var:_=$S}@} != "value"
+.  error
+.elif ${INDIRECT_VARNAME} != "value"
+.  error
+.endif
+
 all:

Reply via email to