mirror of
https://github.com/freebsd/freebsd-src
synced 2024-07-22 10:48:02 +00:00
![Simon J. Gerraty](/assets/img/avatar_default.png)
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.
36 lines
1.2 KiB
Makefile
36 lines
1.2 KiB
Makefile
# $NetBSD: varparse-dynamic.mk,v 1.5 2021/02/22 20:38:55 rillig Exp $
|
|
|
|
# Before 2020-07-27, there was an off-by-one error in Var_Parse that skipped
|
|
# the last character in the variable name.
|
|
# To trigger the bug, the variable must not be defined.
|
|
.if ${.TARGET} # exact match, may be undefined
|
|
.endif
|
|
.if ${.TARGEX} # 1 character difference, must be defined
|
|
.endif
|
|
.if ${.TARGXX} # 2 characters difference, must be defined
|
|
.endif
|
|
|
|
# When a dynamic variable (such as .TARGET) is evaluated in the global
|
|
# scope, it is not yet ready to be expanded. Therefore the complete
|
|
# expression is returned as the variable value, hoping that it can be
|
|
# resolved at a later point.
|
|
#
|
|
# This test covers the code in Var_Parse that deals with DEF_UNDEF but not
|
|
# DEF_DEFINED for dynamic variables.
|
|
.if ${.TARGET:S,^,,} != "\${.TARGET:S,^,,}"
|
|
. error
|
|
.endif
|
|
|
|
# If a dynamic variable is expanded in a non-local scope, the expression
|
|
# based on this variable is not expanded. But there may be nested variable
|
|
# expressions in the modifiers, and these are kept unexpanded as well.
|
|
.if ${.TARGET:M${:Ufallback}} != "\${.TARGET:M\${:Ufallback}}"
|
|
. error
|
|
.endif
|
|
.if ${.TARGET:M${UNDEF}} != "\${.TARGET:M\${UNDEF}}"
|
|
. error
|
|
.endif
|
|
|
|
all:
|
|
@:
|