1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-01 08:27:59 +00:00
freebsd/unit-tests/varmod-remember.mk
Simon J. Gerraty ee914ef902 Import bmake-20210621
Lots more unit tests and code cleanup

Relevant changes from ChangeLog

	o job.c: Print -de error information when running multiple jobs
	o var.c: only report error for unmatched regex subexpression
	when linting (-dL) since we cannot tell when an unmatched
	subexpression is an expected result.
	reduce memory allocations in the modifiers ':D' and ':U'
	reduce memory allocation and strlen calls in modifier ':from=to'
	in the ':Q' modifier, only allocate memory if necessary
	improve performance for LazyBuf
	reduce debug logging and memory allocation for ${:U...}
	reduce verbosity of the -dv debug logging for standard cases
	fix double varname expansion in the variable modifier '::='
	o var.c: avoid evaluating many modifiers in parse only mode
	in strict mode (-dL) many variable references are parsed twice,
	the first time just to report parse errors early, so we want to
	avoid side effects and wasted effort to the extent possible.
2021-06-25 11:16:24 -07:00

36 lines
1.2 KiB
Makefile

# $NetBSD: varmod-remember.mk,v 1.6 2021/03/14 17:27:27 rillig Exp $
#
# Tests for the :_ modifier, which saves the current variable value
# in the _ variable or another, to be used later again.
.if ${1 2 3:L:_:@var@${_}@} != "1 2 3 1 2 3 1 2 3"
. error
.endif
# In the parameterized form, having the variable name on the right side of
# the = assignment operator is confusing. In almost all other situations
# the variable name is on the left-hand side of the = operator. Luckily
# this modifier is only rarely needed.
.if ${1 2 3:L:@var@${var:_=SAVED:}@} != "1 2 3"
. error
.elif ${SAVED} != "3"
. 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.
#
# Because of all these edge-casey conditions, this "feature" has been removed
# in var.c 1.867 from 2021-03-14.
S= INDIRECT_VARNAME
.if ${value:L:@var@${var:_=$S}@} != "value"
. error
.elif defined(INDIRECT_VARNAME)
. error
.endif
all: