diff options
author | Simon J. Gerraty <sjg@FreeBSD.org> | 2020-11-20 03:54:37 +0000 |
---|---|---|
committer | Simon J. Gerraty <sjg@FreeBSD.org> | 2020-11-20 03:54:37 +0000 |
commit | 1b65f0bd2bda7121a90f8cb4c1cacaa20f1b681d (patch) | |
tree | 90c374b8513ec5109e1ec4e2228e2edf648e8756 /unit-tests/var-op-expand.mk | |
parent | 302da1a3d35c15cb29d76e0a939f8bcb13f7ad80 (diff) | |
download | src-test2-9ea923884d3be654375c298dcc5124391ec21db5.tar.gz src-test2-9ea923884d3be654375c298dcc5124391ec21db5.zip |
Diffstat (limited to 'unit-tests/var-op-expand.mk')
-rw-r--r-- | unit-tests/var-op-expand.mk | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/unit-tests/var-op-expand.mk b/unit-tests/var-op-expand.mk index 07c5fb647759..0b5ddbbc0386 100644 --- a/unit-tests/var-op-expand.mk +++ b/unit-tests/var-op-expand.mk @@ -1,9 +1,27 @@ -# $NetBSD: var-op-expand.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $ +# $NetBSD: var-op-expand.mk,v 1.4 2020/11/08 14:00:52 rillig Exp $ # # Tests for the := variable assignment operator, which expands its # right-hand side. # TODO: Implementation +# XXX: edge case: When a variable name refers to an undefined variable, the +# behavior differs between the '=' and the ':=' assignment operators. +# This bug exists since var.c 1.42 from 2000-05-11. +# +# The '=' operator expands the undefined variable to an empty string, thus +# assigning to VAR_ASSIGN_. In the name of variables to be set, it should +# really be forbidden to refer to undefined variables. +# +# The ':=' operator expands the variable name twice. In one of these +# expansions, the undefined variable expression is preserved (controlled by +# preserveUndefined in VarAssign_EvalSubst), in the other expansion it expands +# to an empty string. This way, 2 variables are created using a single +# variable assignment. It's magic. :-/ +.MAKEFLAGS: -dv +VAR_ASSIGN_${UNDEF}= undef value +VAR_SUBST_${UNDEF}:= undef value +.MAKEFLAGS: -d0 + all: @:; |