Module Name:    src
Committed By:   rillig
Date:           Sat Nov 21 15:48:05 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: varparse-dynamic.mk

Log Message:
make(1): add test for dynamic variable with modifiers in global context


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varparse-dynamic.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/varparse-dynamic.mk
diff -u src/usr.bin/make/unit-tests/varparse-dynamic.mk:1.2 src/usr.bin/make/unit-tests/varparse-dynamic.mk:1.3
--- src/usr.bin/make/unit-tests/varparse-dynamic.mk:1.2	Sun Sep 13 21:00:34 2020
+++ src/usr.bin/make/unit-tests/varparse-dynamic.mk	Sat Nov 21 15:48:05 2020
@@ -1,4 +1,4 @@
-# $NetBSD: varparse-dynamic.mk,v 1.2 2020/09/13 21:00:34 rillig Exp $
+# $NetBSD: varparse-dynamic.mk,v 1.3 2020/11/21 15:48:05 rillig Exp $
 
 # Before 2020-07-27, there was an off-by-one error in Var_Parse that skipped
 # the last character in the variable name.
@@ -21,5 +21,15 @@
 .  error
 .endif
 
+# If a dynamic variable is expanded in a non-local context, the expression
+# based on this variable is not expanded.  But there may be nested variable
+# expressions in the modifiers, and these are kept unexpanded as well.
+.if ${.TARGET:M${:Ufallback}} != "\${.TARGET:M\${:Ufallback}}"
+.  error
+.endif
+.if ${.TARGET:M${UNDEF}} != "\${.TARGET:M\${UNDEF}}"
+.  error
+.endif
+
 all:
 	@:

Reply via email to