"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "unit-tests/varname.mk" between
bmake-20201101.tar.gz and bmake-20201117.tar.gz

About: bmake a BSD make tool (derived from NetBSD’s make).

varname.mk  (bmake-20201101):varname.mk  (bmake-20201117)
# $NetBSD: varname.mk,v 1.4 2020/10/18 08:47:54 rillig Exp $ # $NetBSD: varname.mk,v 1.8 2020/11/02 22:59:48 rillig Exp $
# #
# Tests for special variables, such as .MAKE or .PARSEDIR. # Tests for special variables, such as .MAKE or .PARSEDIR.
# And for variable names in general.
# TODO: Implementation .MAKEFLAGS: -dv
# In variable names, braces are allowed, but they must be balanced.
# Parentheses and braces may be mixed.
VAR{{{}}}= 3 braces
.if "${VAR{{{}}}}" != "3 braces"
. error
.endif
# In variable expressions, the parser works differently. It doesn't treat
# braces and parentheses equally, therefore the first closing brace already
# marks the end of the variable name.
VARNAME= VAR(((
${VARNAME}= 3 open parentheses
.if "${VAR(((}}}}" != "3 open parentheses}}}"
. error
.endif
# In the above test, the variable name is constructed indirectly. Neither
# of the following expressions produces the intended effect.
#
# This is not a variable assignment since the parentheses and braces are not
# balanced. At the end of the line, there are still 3 levels open, which
# means the variable name is not finished.
${:UVAR(((}= try1
# On the left-hand side of a variable assignments, the backslash is not parsed
# as an escape character, therefore the parentheses still count to the nesting
# level, which at the end of the line is still 3. Therefore this is not a
# variable assignment as well.
${:UVAR\(\(\(}= try2
# To assign to a variable with an arbitrary name, the variable name has to
# come from an external source, not the text that is parsed in the assignment
# itself. This is exactly the reason why further above, the indirect
# ${VARNAME} works, while all other attempts fail.
${VARNAME}= try3
.MAKEFLAGS: -d0
all: all:
@:;
 End of changes. 4 change blocks. 
2 lines changed or deleted 39 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)