Module Name: src
Committed By: rillig
Date: Sat Jul 25 20:37:46 UTC 2020
Modified Files:
src/usr.bin/make/unit-tests: cond-late.exp cond-late.mk
Log Message:
make(1): add test for undefined (or empty) variable in :? modifier
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/cond-late.exp
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/cond-late.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/cond-late.exp
diff -u src/usr.bin/make/unit-tests/cond-late.exp:1.2 src/usr.bin/make/unit-tests/cond-late.exp:1.3
--- src/usr.bin/make/unit-tests/cond-late.exp:1.2 Fri May 1 16:26:41 2020
+++ src/usr.bin/make/unit-tests/cond-late.exp Sat Jul 25 20:37:46 2020
@@ -1,3 +1,4 @@
+make: Bad conditional expression ` != "no"' in != "no"?:
yes
no
exit status 0
Index: src/usr.bin/make/unit-tests/cond-late.mk
diff -u src/usr.bin/make/unit-tests/cond-late.mk:1.1 src/usr.bin/make/unit-tests/cond-late.mk:1.2
--- src/usr.bin/make/unit-tests/cond-late.mk:1.1 Wed Apr 29 23:15:21 2020
+++ src/usr.bin/make/unit-tests/cond-late.mk Sat Jul 25 20:37:46 2020
@@ -1,4 +1,4 @@
-# $NetBSD: cond-late.mk,v 1.1 2020/04/29 23:15:21 rillig Exp $
+# $NetBSD: cond-late.mk,v 1.2 2020/07/25 20:37:46 rillig Exp $
#
# Using the :? modifier, variable expressions can contain conditional
# expressions that are evaluated late. Any variables appearing in these
@@ -15,9 +15,15 @@
# and then expand the variables, the output would change from the
# current "yes no" to "yes yes", since both variables are non-empty.
+all: cond-literal
+
COND.true= "yes" == "yes"
COND.false= "yes" != "yes"
-all:
+cond-literal:
@echo ${ ${COND.true} :?yes:no}
@echo ${ ${COND.false} :?yes:no}
+
+VAR+= ${${UNDEF} != "no":?:}
+.if empty(VAR:Mpattern)
+.endif