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 make(1): try to set the variable nam...
details: https://anonhg.NetBSD.org/src/rev/ae5f8a812998
branches: trunk
changeset: 1013209:ae5f8a812998
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Aug 22 21:22:24 2020 +0000
description:
make(1): try to set the variable named "" using the command line
Before 2020-08-22, the command line argument '=cmline-plain' triggered
undefined behavior, just like the assignment '=assigned' in the Makefile.
diffstat:
usr.bin/make/unit-tests/Makefile | 4 +++-
usr.bin/make/unit-tests/varname-empty.exp | 12 ++++++++++--
usr.bin/make/unit-tests/varname-empty.mk | 8 ++++----
3 files changed, 17 insertions(+), 7 deletions(-)
diffs (68 lines):
diff -r 9129d774e111 -r ae5f8a812998 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile Sat Aug 22 21:12:29 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile Sat Aug 22 21:22:24 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.111 2020/08/22 20:50:43 sjg Exp $
+# $NetBSD: Makefile,v 1.112 2020/08/22 21:22:24 rillig Exp $
#
# Unit tests for make(1)
#
@@ -323,6 +323,7 @@
FLAGS.recursive= -dL
FLAGS.vardebug= -k -dv FROM_CMDLINE=
FLAGS.varmod-match-escape= -dv
+FLAGS.varname-empty= -dv '$${:U}=cmdline-u' '=cmline-plain'
# Some tests need extra post-processing.
SED_CMDS.sh-dots+= -e 's,^${.SHELL}: ,,'
@@ -336,6 +337,7 @@
POSTPROC.counter= ${TOOL_SED} -n -e '/:RELEVANT = yes/,/:RELEVANT = no/p'
POSTPROC.vardebug= ${TOOL_SED} -n -e '/:RELEVANT = yes/,/:RELEVANT = no/p'
POSTPROC.varmod-match-escape= ${TOOL_SED} -n -e '/^Pattern/p'
+POSTPROC.varname-empty= ${TOOL_SED} -n -e '/^Var_Set/p' -e '/^out:/p'
# Some tests reuse other tests, which makes them unnecessarily fragile.
export-all.rawout: export.mk
diff -r 9129d774e111 -r ae5f8a812998 usr.bin/make/unit-tests/varname-empty.exp
--- a/usr.bin/make/unit-tests/varname-empty.exp Sat Aug 22 21:12:29 2020 +0000
+++ b/usr.bin/make/unit-tests/varname-empty.exp Sat Aug 22 21:22:24 2020 +0000
@@ -1,3 +1,11 @@
-fallback
-1 2 3
+Var_Set("${:U}", "cmdline-u", ...) name expands to empty string - ignored
+Var_Set("", "cmline-plain", ...) name expands to empty string - ignored
+Var_Set("", "default", ...) name expands to empty string - ignored
+Var_Set("", "assigned", ...) name expands to empty string - ignored
+Var_Set("", "appended", ...) name expands to empty string - ignored
+Var_Set("", "", ...) name expands to empty string - ignored
+Var_Set("", "subst", ...) name expands to empty string - ignored
+Var_Set("", "shell-output", ...) name expands to empty string - ignored
+out: fallback
+out: 1 2 3
exit status 0
diff -r 9129d774e111 -r ae5f8a812998 usr.bin/make/unit-tests/varname-empty.mk
--- a/usr.bin/make/unit-tests/varname-empty.mk Sat Aug 22 21:12:29 2020 +0000
+++ b/usr.bin/make/unit-tests/varname-empty.mk Sat Aug 22 21:22:24 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: varname-empty.mk,v 1.4 2020/08/22 21:12:29 rillig Exp $
+# $NetBSD: varname-empty.mk,v 1.5 2020/08/22 21:22:24 rillig Exp $
#
# Tests for the special variable with the empty name.
#
@@ -12,7 +12,7 @@
= assigned # undefined behavior until 2020-08-22
+= appended
:= subst
-!= echo 'value'
+!= echo 'shell-output'
# The .for loop expands the expression ${i} to ${:U1}, ${:U2} and so on.
# This only works if the variable with the empty name is guaranteed to
@@ -22,5 +22,5 @@
.endfor
all:
- @echo ${:Ufallback}
- @echo ${NUMBERS}
+ @echo out: ${:Ufallback}
+ @echo out: ${NUMBERS}
Home |
Main Index |
Thread Index |
Old Index