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 unintended e...
details: https://anonhg.NetBSD.org/src/rev/aea9c2cb0d8e
branches: trunk
changeset: 1019576:aea9c2cb0d8e
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Mar 14 17:14:15 2021 +0000
description:
tests/make: demonstrate unintended edge case for the ':_' modifier
diffstat:
usr.bin/make/unit-tests/varmod-remember.mk | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diffs (26 lines):
diff -r c635ef3dc64a -r aea9c2cb0d8e usr.bin/make/unit-tests/varmod-remember.mk
--- a/usr.bin/make/unit-tests/varmod-remember.mk Sun Mar 14 17:07:11 2021 +0000
+++ b/usr.bin/make/unit-tests/varmod-remember.mk Sun Mar 14 17:14:15 2021 +0000
@@ -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:
Home |
Main Index |
Thread Index |
Old Index