opnsense-src/unit-tests/varparse-errors.mk
Simon J. Gerraty 507951f550 Import bmake-20240430
Intersting/relevant changes since bmake-20240309

ChangeLog since bmake-20240309

2024-04-30  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240430
	Merge with NetBSD make, pick up
	o main.c: ensure '.include <makefile>' respects MAKESYSPATH.
	Dir_FindFile will search .CURDIR first unless ".DOTLAST" is seen.

2024-04-28  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240428
	Merge with NetBSD make, pick up
	o simplify freeing of lists
	o arch.c: trim pointless comments
	o var.c: delay variable assignments until actually needed
	don't reallocate memory after evaluating an expression, result is
	almost always short-lived.

2024-04-26  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240426
	Merge with NetBSD make, pick up
	o job.c: in debug output, print the directory in which a job
	failed at same time as failed target so it is more easily found in
	build log.

2024-04-24  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240424
	Merge with NetBSD make, pick up
	o clean up comments, code and tests

2024-04-23  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240422
	Merge with NetBSD make, pick up
	o var.c: avoid LazyBuf for :*time modifiers.
	LazyBuf's are not nul terminated so not suitable for passing to
	functions that expect that. These modifiers are used sparingly so
	an extra allocation is not a problem.

2024-04-20  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240420
	Merge with NetBSD make, pick up
	o provide more context information for parse/evaluate errors

2024-04-14  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240414
	Merge with NetBSD make, pick up
	o parse.c: print -dp debug info earlier so we see which
	.if or .for line is being parsed.

2024-04-04  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240404
	Merge with NetBSD make, pick up
	o fix some unit tests for Cygwin
	o parse.c: exit immediately after reading a null byte from a makefile

	* fix generation of bmake.cat1

2024-03-19  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240314
	Add/Improve support for Cygwin
	o uname -s output isn't useful so allow configure to
	set FORCE_MAKE_OS - to force the value of .MAKE.OS
	and use Cygwin which matches uname -o
	o fix some unit-tests for Cygwin

	* configure.in: use_makefile=no for Cygwin et al.
	NOTE: bmake does not support Cygwin and likely never will,

mk/ChangeLog since bmake-20240309

2024-04-24  Simon J Gerraty  <sjg@beast.crufty.net>

	* meta.autodep.mk: do not override start_utc

2024-04-18  Simon J Gerraty  <sjg@beast.crufty.net>

	* sys.dirdeps.mk: set defaults for DEP_* at level 0 too.
	These help when first include of Makefile.depend happens in a leaf
	dir.

	* install-mk (MK_VERSION): 20240414

2024-04-09  Simon J Gerraty  <sjg@beast.crufty.net>

	* install-mk (MK_VERSION): 20240408

	* init.mk: allow for _ as well as . to join V
	and Q from QUALIFIED_VAR_LIST and VAR_QUALIFIER_LIST.

	* progs.mk: avoid overlap between PROG_VARS and
	init.mk's QUALIFIED_VAR_LIST since PROG would also
	match its VAR_QUALIFIER_LIST,
	libs.mk does not have the same issue.

	* subdir.mk: _SUBDIRUSE for realinstall should run install
	remove include of ${.CURDIR}/Makefile.inc that can be done via
	local.subdir.mk where needed

	* own.mk: do not conflict with man.mk

2024-03-19  Simon J Gerraty  <sjg@beast.crufty.net>

	* install-mk (MK_VERSION): 20240314

	* add sys/Cygwin.mk from Christian Franke
2024-05-03 15:43:12 -07:00

91 lines
3.1 KiB
Makefile

# $NetBSD: varparse-errors.mk,v 1.12 2024/04/20 10:18:56 rillig Exp $
# Tests for parsing and evaluating all kinds of expressions.
#
# This is the basis for redesigning the error handling in Var_Parse and
# Var_Subst, collecting typical and not so typical use cases.
#
# See also:
# Var_Parse
# Var_Subst
PLAIN= plain value
LITERAL_DOLLAR= To get a dollar, double $$ it.
INDIRECT= An ${:Uindirect} value.
REF_UNDEF= A reference to an ${UNDEF}undefined variable.
ERR_UNCLOSED= An ${UNCLOSED expression.
ERR_BAD_MOD= An ${:Uindirect:Z} expression with an unknown modifier.
ERR_EVAL= An evaluation error ${:Uvalue:C,.,\3,}.
# In a conditional, an expression that is not enclosed in quotes is
# expanded using the mode VARE_UNDEFERR.
# The variable itself must be defined.
# It may refer to undefined variables though.
.if ${REF_UNDEF} != "A reference to an undefined variable."
. error
.endif
# As of 2020-12-01, errors in the variable name are silently ignored.
# Since var.c 1.754 from 2020-12-20, unknown modifiers at parse time result
# in an error message and a non-zero exit status.
# expect+1: while evaluating "${:U:Z}": Unknown modifier "Z"
VAR.${:U:Z}= unknown modifier in the variable name
.if ${VAR.} != "unknown modifier in the variable name"
. error
.endif
# As of 2020-12-01, errors in the variable name are silently ignored.
# Since var.c 1.754 from 2020-12-20, unknown modifiers at parse time result
# in an error message and a non-zero exit status.
# expect+1: while evaluating "${:U:Z}post": Unknown modifier "Z"
VAR.${:U:Z}post= unknown modifier with text in the variable name
.if ${VAR.post} != "unknown modifier with text in the variable name"
. error
.endif
# Demonstrate an edge case in which the 'static' for 'errorReported' in
# Var_Subst actually makes a difference, preventing "a plethora of messages".
# Given that this is an edge case and the error message is wrong and thus
# misleading anyway, that piece of code is probably not necessary. The wrong
# condition was added in var.c 1.185 from 2014-05-19.
#
# To trigger this difference, the variable assignment must use the assignment
# operator ':=' to make VarEvalMode_ShouldKeepUndef return true. There must
# be 2 expressions that create a parse error, which in this case is ':OX'.
# These expressions must be nested in some way. The below expressions are
# minimal, that is, removing any part of it destroys the effect.
#
# Without the 'static', there would be one more message like this:
# Undefined variable "${:U:OX"
#
#.MAKEFLAGS: -dv
IND= ${:OX}
# expect+2: Undefined variable "${:U:OX"
# expect+1: Undefined variable "${:U:OX"
_:= ${:U:OX:U${IND}} ${:U:OX:U${IND}}
#.MAKEFLAGS: -d0
# Before var.c 1.032 from 2022-08-24, make complained about 'Unknown modifier'
# or 'Bad modifier' when in fact the modifier was entirely correct, it was
# just not delimited by either ':' or '}' but instead by '\0'.
UNCLOSED:= ${:U:Q
UNCLOSED:= ${:U:sh
UNCLOSED:= ${:U:tA
UNCLOSED:= ${:U:tsX
UNCLOSED:= ${:U:ts
UNCLOSED:= ${:U:ts\040
UNCLOSED:= ${:U:u
UNCLOSED:= ${:U:H
UNCLOSED:= ${:U:[1]
UNCLOSED:= ${:U:hash
UNCLOSED:= ${:U:range
UNCLOSED:= ${:U:_
UNCLOSED:= ${:U:gmtime
UNCLOSED:= ${:U:localtime