aboutsummaryrefslogtreecommitdiff
path: root/contrib/bmake/unit-tests
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bmake/unit-tests')
-rw-r--r--contrib/bmake/unit-tests/Makefile32
-rw-r--r--contrib/bmake/unit-tests/cmd-errors-jobs.exp6
-rw-r--r--contrib/bmake/unit-tests/cmd-errors-jobs.mk17
-rw-r--r--contrib/bmake/unit-tests/cmd-errors-lint.exp4
-rw-r--r--contrib/bmake/unit-tests/cmd-errors-lint.mk23
-rw-r--r--contrib/bmake/unit-tests/cmd-errors.exp6
-rw-r--r--contrib/bmake/unit-tests/cmd-errors.mk21
-rw-r--r--contrib/bmake/unit-tests/compat-error.exp2
-rw-r--r--contrib/bmake/unit-tests/cond-cmp-numeric.exp2
-rw-r--r--contrib/bmake/unit-tests/cond-func-defined.exp2
-rw-r--r--contrib/bmake/unit-tests/cond-func.exp12
-rw-r--r--contrib/bmake/unit-tests/cond-func.mk13
-rw-r--r--contrib/bmake/unit-tests/cond-late.exp5
-rw-r--r--contrib/bmake/unit-tests/cond-late.mk14
-rw-r--r--contrib/bmake/unit-tests/cond-op-and.exp12
-rw-r--r--contrib/bmake/unit-tests/cond-op-and.mk27
-rw-r--r--contrib/bmake/unit-tests/cond-op-not.exp2
-rw-r--r--contrib/bmake/unit-tests/cond-op-or.exp12
-rw-r--r--contrib/bmake/unit-tests/cond-op-or.mk53
-rw-r--r--contrib/bmake/unit-tests/cond-op-parentheses.exp2
-rw-r--r--contrib/bmake/unit-tests/cond-op.exp2
-rw-r--r--contrib/bmake/unit-tests/cond-short.exp2
-rw-r--r--contrib/bmake/unit-tests/cond-token-number.exp2
-rw-r--r--contrib/bmake/unit-tests/cond-token-string.exp4
-rw-r--r--contrib/bmake/unit-tests/cond-token-string.mk4
-rw-r--r--contrib/bmake/unit-tests/dep-op-missing.exp1
-rw-r--r--contrib/bmake/unit-tests/dep-percent.exp2
-rwxr-xr-xcontrib/bmake/unit-tests/dep-var.exp2
-rw-r--r--contrib/bmake/unit-tests/dep.exp2
-rw-r--r--contrib/bmake/unit-tests/depsrc-ignore.exp2
-rw-r--r--contrib/bmake/unit-tests/deptgt-begin-fail-indirect.exp2
-rw-r--r--contrib/bmake/unit-tests/deptgt-begin-fail.exp2
-rw-r--r--contrib/bmake/unit-tests/deptgt-delete_on_error.exp14
-rw-r--r--contrib/bmake/unit-tests/deptgt-end-fail-all.exp2
-rw-r--r--contrib/bmake/unit-tests/deptgt-end-fail-indirect.exp2
-rw-r--r--contrib/bmake/unit-tests/deptgt-end-fail.exp30
-rw-r--r--contrib/bmake/unit-tests/deptgt-error.exp2
-rw-r--r--contrib/bmake/unit-tests/deptgt-ignore.exp2
-rw-r--r--contrib/bmake/unit-tests/deptgt-path-suffix.exp2
-rw-r--r--contrib/bmake/unit-tests/deptgt.exp5
-rw-r--r--contrib/bmake/unit-tests/deptgt.mk21
-rwxr-xr-xcontrib/bmake/unit-tests/directive-dinclude.exp3
-rw-r--r--contrib/bmake/unit-tests/directive-elif.exp2
-rw-r--r--contrib/bmake/unit-tests/directive-else.exp2
-rw-r--r--contrib/bmake/unit-tests/directive-export-gmake.exp1
-rw-r--r--contrib/bmake/unit-tests/directive-for-break.exp1
-rw-r--r--contrib/bmake/unit-tests/directive-for-errors.exp16
-rw-r--r--contrib/bmake/unit-tests/directive-for-errors.mk18
-rw-r--r--contrib/bmake/unit-tests/directive-for-escape.exp114
-rw-r--r--contrib/bmake/unit-tests/directive-for-escape.mk96
-rwxr-xr-xcontrib/bmake/unit-tests/directive-for-generating-endif.exp5
-rw-r--r--contrib/bmake/unit-tests/directive-for-if.exp5
-rw-r--r--contrib/bmake/unit-tests/directive-for-null.exp3
-rwxr-xr-xcontrib/bmake/unit-tests/directive-for.exp42
-rwxr-xr-xcontrib/bmake/unit-tests/directive-for.mk42
-rwxr-xr-xcontrib/bmake/unit-tests/directive-hyphen-include.exp3
-rw-r--r--contrib/bmake/unit-tests/directive-ifmake.exp2
-rwxr-xr-xcontrib/bmake/unit-tests/directive-include-fatal.exp2
-rwxr-xr-xcontrib/bmake/unit-tests/directive-include.exp4
-rwxr-xr-xcontrib/bmake/unit-tests/directive-include.mk4
-rw-r--r--contrib/bmake/unit-tests/directive-info.exp2
-rwxr-xr-xcontrib/bmake/unit-tests/directive-sinclude.exp3
-rw-r--r--contrib/bmake/unit-tests/directive-undef.exp4
-rw-r--r--contrib/bmake/unit-tests/directive-undef.mk4
-rw-r--r--contrib/bmake/unit-tests/directive-unexport-env.exp2
-rw-r--r--contrib/bmake/unit-tests/directive-warning.exp2
-rw-r--r--contrib/bmake/unit-tests/directive.exp2
-rw-r--r--contrib/bmake/unit-tests/doterror.exp2
-rw-r--r--contrib/bmake/unit-tests/jobs-empty-commands-error.exp2
-rw-r--r--contrib/bmake/unit-tests/jobs-error-indirect.exp4
-rw-r--r--contrib/bmake/unit-tests/jobs-error-nested-make.exp6
-rw-r--r--contrib/bmake/unit-tests/jobs-error-nested.exp8
-rwxr-xr-xcontrib/bmake/unit-tests/lint.exp2
-rw-r--r--contrib/bmake/unit-tests/moderrs.exp110
-rw-r--r--contrib/bmake/unit-tests/moderrs.mk78
-rw-r--r--contrib/bmake/unit-tests/opt-debug-errors-jobs.exp12
-rw-r--r--contrib/bmake/unit-tests/opt-debug-errors.exp2
-rw-r--r--contrib/bmake/unit-tests/opt-debug-file.exp8
-rw-r--r--contrib/bmake/unit-tests/opt-debug-file.mk15
-rw-r--r--contrib/bmake/unit-tests/opt-debug-graph2.exp2
-rw-r--r--contrib/bmake/unit-tests/opt-debug-graph3.exp2
-rw-r--r--contrib/bmake/unit-tests/opt-debug-hash.exp4
-rw-r--r--contrib/bmake/unit-tests/opt-debug-lint.exp6
-rw-r--r--contrib/bmake/unit-tests/opt-debug-lint.mk8
-rw-r--r--contrib/bmake/unit-tests/opt-file.exp3
-rw-r--r--contrib/bmake/unit-tests/opt-keep-going-indirect.exp8
-rw-r--r--contrib/bmake/unit-tests/opt-keep-going-multiple.exp2
-rw-r--r--contrib/bmake/unit-tests/opt-keep-going.exp2
-rw-r--r--contrib/bmake/unit-tests/opt-warnings-as-errors.exp2
-rw-r--r--contrib/bmake/unit-tests/opt.exp2
-rw-r--r--contrib/bmake/unit-tests/parse.exp2
-rw-r--r--contrib/bmake/unit-tests/posix.exp2
-rw-r--r--contrib/bmake/unit-tests/sh-jobs.exp2
-rw-r--r--contrib/bmake/unit-tests/suff-add-later.exp2
-rw-r--r--contrib/bmake/unit-tests/suff-clear-regular.exp2
-rw-r--r--contrib/bmake/unit-tests/suff-clear-single.exp2
-rw-r--r--contrib/bmake/unit-tests/suff-main-several.exp2
-rw-r--r--contrib/bmake/unit-tests/suff-self.exp2
-rw-r--r--contrib/bmake/unit-tests/suff-transform-endless.exp2
-rw-r--r--contrib/bmake/unit-tests/suff-transform-expand.exp2
-rw-r--r--contrib/bmake/unit-tests/suff-transform-select.exp2
-rw-r--r--contrib/bmake/unit-tests/suff-use.exp2
-rw-r--r--contrib/bmake/unit-tests/use-inference.exp2
-rw-r--r--contrib/bmake/unit-tests/var-eval-short.exp4
-rw-r--r--contrib/bmake/unit-tests/var-eval-short.mk4
-rw-r--r--contrib/bmake/unit-tests/var-op-assign.exp2
-rw-r--r--contrib/bmake/unit-tests/var-op-expand.exp6
-rw-r--r--contrib/bmake/unit-tests/var-op-expand.mk6
-rw-r--r--contrib/bmake/unit-tests/var-op-shell.exp6
-rw-r--r--contrib/bmake/unit-tests/var-op-shell.mk16
-rw-r--r--contrib/bmake/unit-tests/var-recursive.exp5
-rw-r--r--contrib/bmake/unit-tests/vardebug.exp2
-rw-r--r--contrib/bmake/unit-tests/vardebug.mk4
-rw-r--r--contrib/bmake/unit-tests/varmisc.exp8
-rw-r--r--contrib/bmake/unit-tests/varmisc.mk13
-rw-r--r--contrib/bmake/unit-tests/varmod-assign-shell.exp12
-rw-r--r--contrib/bmake/unit-tests/varmod-assign-shell.mk18
-rw-r--r--contrib/bmake/unit-tests/varmod-assign.exp12
-rw-r--r--contrib/bmake/unit-tests/varmod-assign.mk7
-rw-r--r--contrib/bmake/unit-tests/varmod-edge.exp33
-rw-r--r--contrib/bmake/unit-tests/varmod-edge.mk231
-rw-r--r--contrib/bmake/unit-tests/varmod-gmtime.exp12
-rw-r--r--contrib/bmake/unit-tests/varmod-gmtime.mk12
-rw-r--r--contrib/bmake/unit-tests/varmod-hash.exp8
-rw-r--r--contrib/bmake/unit-tests/varmod-ifelse.exp52
-rw-r--r--contrib/bmake/unit-tests/varmod-ifelse.mk22
-rw-r--r--contrib/bmake/unit-tests/varmod-indirect.exp8
-rw-r--r--contrib/bmake/unit-tests/varmod-indirect.mk10
-rw-r--r--contrib/bmake/unit-tests/varmod-localtime.exp12
-rw-r--r--contrib/bmake/unit-tests/varmod-localtime.mk12
-rw-r--r--contrib/bmake/unit-tests/varmod-loop-delete.exp4
-rw-r--r--contrib/bmake/unit-tests/varmod-loop-delete.mk4
-rw-r--r--contrib/bmake/unit-tests/varmod-loop-varname.exp10
-rw-r--r--contrib/bmake/unit-tests/varmod-loop-varname.mk10
-rwxr-xr-xcontrib/bmake/unit-tests/varmod-match-escape.exp10
-rwxr-xr-xcontrib/bmake/unit-tests/varmod-match-escape.mk8
-rw-r--r--contrib/bmake/unit-tests/varmod-match.exp20
-rw-r--r--contrib/bmake/unit-tests/varmod-match.mk22
-rw-r--r--contrib/bmake/unit-tests/varmod-mtime.exp12
-rw-r--r--contrib/bmake/unit-tests/varmod-mtime.mk14
-rw-r--r--contrib/bmake/unit-tests/varmod-order.exp48
-rw-r--r--contrib/bmake/unit-tests/varmod-order.mk32
-rw-r--r--contrib/bmake/unit-tests/varmod-range.exp12
-rw-r--r--contrib/bmake/unit-tests/varmod-range.mk12
-rw-r--r--contrib/bmake/unit-tests/varmod-select-words.exp26
-rw-r--r--contrib/bmake/unit-tests/varmod-shell.exp14
-rw-r--r--contrib/bmake/unit-tests/varmod-shell.mk14
-rw-r--r--contrib/bmake/unit-tests/varmod-subst-regex.exp30
-rw-r--r--contrib/bmake/unit-tests/varmod-subst.exp4
-rw-r--r--contrib/bmake/unit-tests/varmod-sun-shell.exp16
-rw-r--r--contrib/bmake/unit-tests/varmod-sun-shell.mk14
-rw-r--r--contrib/bmake/unit-tests/varmod-sysv.exp10
-rw-r--r--contrib/bmake/unit-tests/varmod-sysv.mk10
-rw-r--r--contrib/bmake/unit-tests/varmod-to-separator.exp44
-rw-r--r--contrib/bmake/unit-tests/varmod-to-separator.mk23
-rw-r--r--contrib/bmake/unit-tests/varmod-to-title.exp1
-rw-r--r--contrib/bmake/unit-tests/varmod-to-title.mk31
-rw-r--r--contrib/bmake/unit-tests/varmod.exp54
-rw-r--r--contrib/bmake/unit-tests/varmod.mk38
-rw-r--r--contrib/bmake/unit-tests/varname-dot-newline.exp5
-rw-r--r--contrib/bmake/unit-tests/varname-make_print_var_on_error-jobs.exp2
-rw-r--r--contrib/bmake/unit-tests/varname-make_print_var_on_error.exp2
-rw-r--r--contrib/bmake/unit-tests/varname.exp2
-rw-r--r--contrib/bmake/unit-tests/varparse-errors.exp44
-rw-r--r--contrib/bmake/unit-tests/varparse-errors.mk26
165 files changed, 1205 insertions, 1034 deletions
diff --git a/contrib/bmake/unit-tests/Makefile b/contrib/bmake/unit-tests/Makefile
index 1b073af009db..319643b135a0 100644
--- a/contrib/bmake/unit-tests/Makefile
+++ b/contrib/bmake/unit-tests/Makefile
@@ -1,6 +1,6 @@
-# $Id: Makefile,v 1.219 2024/06/01 16:14:47 sjg Exp $
+# $Id: Makefile,v 1.224 2024/07/13 05:27:35 sjg Exp $
#
-# $NetBSD: Makefile,v 1.347 2024/06/01 15:54:40 sjg Exp $
+# $NetBSD: Makefile,v 1.350 2024/07/07 09:37:00 rillig Exp $
#
# Unit tests for make(1)
#
@@ -398,6 +398,7 @@ TESTS+= varmod-to-lower
TESTS+= varmod-to-many-words
TESTS+= varmod-to-one-word
TESTS+= varmod-to-separator
+TESTS+= varmod-to-title
TESTS+= varmod-to-upper
TESTS+= varmod-undefined
TESTS+= varmod-unique
@@ -465,8 +466,23 @@ _shell := ${.SHELL:tA:T}
.if ${_shell} == "dash"
# dash fails -x output
BROKEN_TESTS+= opt-debug-x-trace
-.elif ${_shell} == "ksh"
-BROKEN_TESTS+= sh-flags
+.elif ${_shell:N*ksh*} == ""
+BROKEN_TESTS+= \
+ deptgt-silent-jobs \
+ job-flags \
+ job-output-long-lines \
+ opt-debug-x-trace \
+ sh-flags \
+ var-op-shell \
+
+.if ${_shell:Nmksh} == ""
+# more broken that pdksh
+BROKEN_TESTS+= \
+ opt-jobs-no-action \
+ sh-errctl \
+ sh-leading-hyphen \
+
+.endif
.endif
.if ${UTC_1:Uno} == ""
@@ -591,7 +607,7 @@ SED_CMDS.meta-ignore= -e 's,\(\.meta:\) [1-9][0-9]*:,\1 <line>:,'
SED_CMDS.opt-debug-graph1= ${STD_SED_CMDS.dg1}
SED_CMDS.opt-debug-graph2= ${STD_SED_CMDS.dg2}
SED_CMDS.opt-debug-graph3= ${STD_SED_CMDS.dg3}
-SED_CMDS.opt-debug-hash= -e 's,\(numEntries\)=[1-9][0-9],\1=<entries>,'
+SED_CMDS.opt-debug-hash= -e 's,\(entries\)=[1-9][0-9],\1=<entries>,'
SED_CMDS.opt-debug-jobs= -e 's,([0-9][0-9]*),(<pid>),'
SED_CMDS.opt-debug-jobs+= -e 's,pid [0-9][0-9]*,pid <pid>,'
SED_CMDS.opt-debug-jobs+= -e 's,Process [0-9][0-9]*,Process <pid>,'
@@ -807,7 +823,7 @@ LIMIT_RESOURCES?= :
# Postprocess the test output to make the output platform-independent.
#
# Replace anything after 'stopped in' with unit-tests
-_SED_CMDS+= -e '/stopped/s, /.*, unit-tests,'
+_SED_CMDS+= -e '/stopped/s, in /.*, in unit-tests,'
# Allow the test files to be placed anywhere.
_SED_CMDS+= -e 's,\(\.PARSEDIR}\) = `'"/[^']*'"',\1 = <some-dir>,'
_SED_CMDS+= -e 's,\(\.INCLUDEDFROMDIR}\) = `'"/[^']*'"',\1 = <some-dir>,'
@@ -833,8 +849,10 @@ _SED_CMDS+= -e '/EGREP=/d'
.if ${.MAKE.OS:N*BSD} != ""
_SED_CMDS+= -e 's,\(Error code\) 255,\1 1,'
.endif
-.if ${.SHELL:T} == "ksh"
+.if ${_shell:N*ksh*} == ""
_SED_CMDS+= -e '/^set [+-]v/d'
+SED_CMDS.opt-debug-jobs+= -e 's,Command: ksh -v,Command: <shell>,'
+SED_CMDS.opt-debug-jobs+= -e 's,Command: <shell> -v,Command: <shell>,'
.endif
.rawout.out:
diff --git a/contrib/bmake/unit-tests/cmd-errors-jobs.exp b/contrib/bmake/unit-tests/cmd-errors-jobs.exp
index c8e483a9609b..074ceb3bcf28 100644
--- a/contrib/bmake/unit-tests/cmd-errors-jobs.exp
+++ b/contrib/bmake/unit-tests/cmd-errors-jobs.exp
@@ -1,9 +1,9 @@
: undefined--eol
make: in target "unclosed-expression": Unclosed variable "UNCLOSED"
: unclosed-expression-
-make: Unclosed expression, expecting '}' for "UNCLOSED"
+make: in target "unclosed-modifier": while evaluating variable "UNCLOSED" with value "": Unclosed expression, expecting '}'
: unclosed-modifier-
-make: in target "unknown-modifier": while evaluating variable "UNKNOWN": Unknown modifier "Z"
+make: in target "unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z"
: unknown-modifier--eol
: end-eol
-exit status 0
+exit status 2
diff --git a/contrib/bmake/unit-tests/cmd-errors-jobs.mk b/contrib/bmake/unit-tests/cmd-errors-jobs.mk
index 7a82c0b416e8..c24aa51907a2 100644
--- a/contrib/bmake/unit-tests/cmd-errors-jobs.mk
+++ b/contrib/bmake/unit-tests/cmd-errors-jobs.mk
@@ -1,4 +1,4 @@
-# $NetBSD: cmd-errors-jobs.mk,v 1.4 2024/04/23 22:51:28 rillig Exp $
+# $NetBSD: cmd-errors-jobs.mk,v 1.8 2024/07/09 19:43:01 rillig Exp $
#
# Demonstrate how errors in expressions affect whether the commands
# are actually executed in jobs mode.
@@ -13,27 +13,26 @@ all: undefined unclosed-expression unclosed-modifier unknown-modifier end
undefined:
: $@-${UNDEFINED}-eol
-# XXX: This command is executed even though it contains parse errors.
+unclosed-expression:
# expect: make: in target "unclosed-expression": Unclosed variable "UNCLOSED"
+# XXX: This command is executed even though it contains parse errors.
# expect: : unclosed-expression-
-unclosed-expression:
: $@-${UNCLOSED
+unclosed-modifier:
+# expect: make: in target "unclosed-modifier": while evaluating variable "UNCLOSED" with value "": Unclosed expression, expecting '}'
# XXX: This command is executed even though it contains parse errors.
-# expect: make: Unclosed expression, expecting '}' for "UNCLOSED"
# expect: : unclosed-modifier-
-unclosed-modifier:
: $@-${UNCLOSED:
+unknown-modifier:
+# expect: make: in target "unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z"
# XXX: This command is executed even though it contains parse errors.
-# expect: make: in target "unknown-modifier": while evaluating variable "UNKNOWN": Unknown modifier "Z"
# expect: : unknown-modifier--eol
-unknown-modifier:
: $@-${UNKNOWN:Z}-eol
# expect: : end-eol
end:
: $@-eol
-# XXX: Despite the parse errors, the exit status is 0.
-# expect: exit status 0
+# expect: exit status 2
diff --git a/contrib/bmake/unit-tests/cmd-errors-lint.exp b/contrib/bmake/unit-tests/cmd-errors-lint.exp
index d489c6be57c9..a5b129c78f92 100644
--- a/contrib/bmake/unit-tests/cmd-errors-lint.exp
+++ b/contrib/bmake/unit-tests/cmd-errors-lint.exp
@@ -1,9 +1,9 @@
: undefined
make: in target "unclosed-expression": Unclosed variable "UNCLOSED"
: unclosed-expression
-make: Unclosed expression, expecting '}' for "UNCLOSED"
+make: in target "unclosed-modifier": while evaluating variable "UNCLOSED" with value "": Unclosed expression, expecting '}'
: unclosed-modifier
-make: in target "unknown-modifier": while evaluating variable "UNKNOWN": Unknown modifier "Z"
+make: in target "unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z"
: unknown-modifier
: end
exit status 2
diff --git a/contrib/bmake/unit-tests/cmd-errors-lint.mk b/contrib/bmake/unit-tests/cmd-errors-lint.mk
index 2e7d537f5f1f..f870fceaa5cb 100644
--- a/contrib/bmake/unit-tests/cmd-errors-lint.mk
+++ b/contrib/bmake/unit-tests/cmd-errors-lint.mk
@@ -1,4 +1,4 @@
-# $NetBSD: cmd-errors-lint.mk,v 1.2 2024/04/23 22:51:28 rillig Exp $
+# $NetBSD: cmd-errors-lint.mk,v 1.4 2024/07/05 18:59:33 rillig Exp $
#
# Demonstrate how errors in expressions affect whether the commands
# are actually executed.
@@ -10,24 +10,29 @@ all: undefined unclosed-expression unclosed-modifier unknown-modifier end
# Undefined variables in expressions are not an error. They expand to empty
# strings.
undefined:
+# expect: : undefined
: $@ ${UNDEFINED}
-# XXX: As of 2020-11-01, this obvious syntax error is not detected.
-# XXX: As of 2020-11-01, this command is executed even though it contains
-# parse errors.
unclosed-expression:
+# expect: make: in target "unclosed-expression": Unclosed variable "UNCLOSED"
+# XXX: This command is executed even though it contains parse errors.
+# expect: : unclosed-expression
: $@ ${UNCLOSED
-# XXX: As of 2020-11-01, this obvious syntax error is not detected.
-# XXX: As of 2020-11-01, this command is executed even though it contains
-# parse errors.
unclosed-modifier:
+# expect: make: in target "unclosed-modifier": while evaluating variable "UNCLOSED" with value "": Unclosed expression, expecting '}'
+# XXX: This command is executed even though it contains parse errors.
+# expect: : unclosed-modifier
: $@ ${UNCLOSED:
-# XXX: As of 2020-11-01, this command is executed even though it contains
-# parse errors.
unknown-modifier:
+# expect: make: in target "unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z"
+# XXX: This command is executed even though it contains parse errors.
+# expect: : unknown-modifier
: $@ ${UNKNOWN:Z}
end:
+# expect: : end
: $@
+
+# expect: exit status 2
diff --git a/contrib/bmake/unit-tests/cmd-errors.exp b/contrib/bmake/unit-tests/cmd-errors.exp
index c8e483a9609b..074ceb3bcf28 100644
--- a/contrib/bmake/unit-tests/cmd-errors.exp
+++ b/contrib/bmake/unit-tests/cmd-errors.exp
@@ -1,9 +1,9 @@
: undefined--eol
make: in target "unclosed-expression": Unclosed variable "UNCLOSED"
: unclosed-expression-
-make: Unclosed expression, expecting '}' for "UNCLOSED"
+make: in target "unclosed-modifier": while evaluating variable "UNCLOSED" with value "": Unclosed expression, expecting '}'
: unclosed-modifier-
-make: in target "unknown-modifier": while evaluating variable "UNKNOWN": Unknown modifier "Z"
+make: in target "unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z"
: unknown-modifier--eol
: end-eol
-exit status 0
+exit status 2
diff --git a/contrib/bmake/unit-tests/cmd-errors.mk b/contrib/bmake/unit-tests/cmd-errors.mk
index d1125d444fcd..d9525df6064e 100644
--- a/contrib/bmake/unit-tests/cmd-errors.mk
+++ b/contrib/bmake/unit-tests/cmd-errors.mk
@@ -1,4 +1,4 @@
-# $NetBSD: cmd-errors.mk,v 1.6 2024/04/23 22:51:28 rillig Exp $
+# $NetBSD: cmd-errors.mk,v 1.9 2024/07/09 19:43:01 rillig Exp $
#
# Demonstrate how errors in expressions affect whether the commands
# are actually executed in compat mode.
@@ -8,24 +8,29 @@ all: undefined unclosed-expression unclosed-modifier unknown-modifier end
# Undefined variables in expressions are not an error. They expand to empty
# strings.
undefined:
+# expect: : undefined--eol
: $@-${UNDEFINED}-eol
-# XXX: As of 2020-11-01, this command is executed even though it contains
-# parse errors.
unclosed-expression:
+# expect: make: in target "unclosed-expression": Unclosed variable "UNCLOSED"
+# XXX: This command is executed even though it contains parse errors.
+# expect: : unclosed-expression-
: $@-${UNCLOSED
-# XXX: As of 2020-11-01, this command is executed even though it contains
-# parse errors.
unclosed-modifier:
+# expect: make: in target "unclosed-modifier": while evaluating variable "UNCLOSED" with value "": Unclosed expression, expecting '}'
+# XXX: This command is executed even though it contains parse errors.
+# expect: : unclosed-modifier-
: $@-${UNCLOSED:
-# XXX: As of 2020-11-01, this command is executed even though it contains
-# parse errors.
unknown-modifier:
+# expect: make: in target "unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z"
+# XXX: This command is executed even though it contains parse errors.
+# expect: : unknown-modifier--eol
: $@-${UNKNOWN:Z}-eol
end:
+# expect: : end-eol
: $@-eol
-# XXX: As of 2020-11-02, despite the parse errors, the exit status is 0.
+# expect: exit status 2
diff --git a/contrib/bmake/unit-tests/compat-error.exp b/contrib/bmake/unit-tests/compat-error.exp
index 256cb6d4361c..e06265e887d6 100644
--- a/contrib/bmake/unit-tests/compat-error.exp
+++ b/contrib/bmake/unit-tests/compat-error.exp
@@ -9,7 +9,7 @@ false 'fail2' '${.TARGET}' '$${.TARGET}'
: Making success3 out of nothing.
Stop.
-make: stopped in unit-tests
+make: stopped making "success1 fail1 success2 fail2 success3" in unit-tests
.ERROR target: <fail1>
.ERROR command: <>
exit status 1
diff --git a/contrib/bmake/unit-tests/cond-cmp-numeric.exp b/contrib/bmake/unit-tests/cond-cmp-numeric.exp
index 69a8a1e4fca0..77c0154ca29b 100644
--- a/contrib/bmake/unit-tests/cond-cmp-numeric.exp
+++ b/contrib/bmake/unit-tests/cond-cmp-numeric.exp
@@ -11,5 +11,5 @@ Comparing 123.000000 < 124.000000
CondParser_Eval: ${:U123 } < 124
make: "cond-cmp-numeric.mk" line 54: Comparison with '<' requires both operands '123 ' and '124' to be numeric
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/cond-func-defined.exp b/contrib/bmake/unit-tests/cond-func-defined.exp
index 1d4243f9eddd..b9563ac1fa91 100644
--- a/contrib/bmake/unit-tests/cond-func-defined.exp
+++ b/contrib/bmake/unit-tests/cond-func-defined.exp
@@ -1,5 +1,5 @@
make: "cond-func-defined.mk" line 24: Missing closing parenthesis for defined()
make: "cond-func-defined.mk" line 34: Missing closing parenthesis for defined()
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/cond-func.exp b/contrib/bmake/unit-tests/cond-func.exp
index eeaa89445887..c2c5e94fe7e2 100644
--- a/contrib/bmake/unit-tests/cond-func.exp
+++ b/contrib/bmake/unit-tests/cond-func.exp
@@ -1,12 +1,12 @@
make: "cond-func.mk" line 37: Missing closing parenthesis for defined()
make: "cond-func.mk" line 53: Missing closing parenthesis for defined()
make: "cond-func.mk" line 57: Missing closing parenthesis for defined()
-make: "cond-func.mk" line 98: The empty variable is never defined.
-make: "cond-func.mk" line 108: A plain function name is parsed as defined(...).
-make: "cond-func.mk" line 116: A plain function name is parsed as defined(...).
-make: "cond-func.mk" line 127: Symbols may start with a function name.
-make: "cond-func.mk" line 133: Symbols may start with a function name.
-make: "cond-func.mk" line 139: Missing closing parenthesis for defined()
+make: "cond-func.mk" line 91: Unknown operator '&'
+make: "cond-func.mk" line 107: A plain function name is parsed as defined(...).
+make: "cond-func.mk" line 115: A plain function name is parsed as defined(...).
+make: "cond-func.mk" line 126: Symbols may start with a function name.
+make: "cond-func.mk" line 132: Symbols may start with a function name.
+make: "cond-func.mk" line 138: Missing closing parenthesis for defined()
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/cond-func.mk b/contrib/bmake/unit-tests/cond-func.mk
index aabd31b4db46..7ed6f6f5570d 100644
--- a/contrib/bmake/unit-tests/cond-func.mk
+++ b/contrib/bmake/unit-tests/cond-func.mk
@@ -1,4 +1,4 @@
-# $NetBSD: cond-func.mk,v 1.14 2023/11/19 21:47:52 rillig Exp $
+# $NetBSD: cond-func.mk,v 1.15 2024/07/06 21:21:10 rillig Exp $
#
# Tests for those parts of the functions in .if conditions that are common
# among several functions.
@@ -83,19 +83,18 @@ ${VARNAME_UNBALANCED_BRACES}= variable name with unbalanced braces
. error
.endif
-# The following condition is interpreted as defined(A) && defined(B).
-# In lack of a function call expression, each kind of .if directive has a
+# Before cond.c 1.366 from 2024-07-06, the following condition was
+# interpreted as defined(A) && defined(B). Each kind of .if directive has a
# default function that is called when a bare word is parsed. For the plain
-# .if directive, this function is defined(); see "struct If ifs" in cond.c.
+# .if directive, this function is 'defined'; see "struct If ifs" in cond.c.
+# expect+1: Unknown operator '&'
.if A&B
. error
.endif
+# The empty variable is never defined.
.if defined()
. error
-.else
-# expect+1: The empty variable is never defined.
-. info The empty variable is never defined.
.endif
# The plain word 'defined' is interpreted as 'defined(defined)', see
diff --git a/contrib/bmake/unit-tests/cond-late.exp b/contrib/bmake/unit-tests/cond-late.exp
index 703677da634c..e97fd3789381 100644
--- a/contrib/bmake/unit-tests/cond-late.exp
+++ b/contrib/bmake/unit-tests/cond-late.exp
@@ -1,4 +1,7 @@
-make: Bad conditional expression ' != "no"' before '?:'
+make: "cond-late.mk" line 38: while evaluating variable "VAR" with value "${${UNDEF} != "no":?:}": while evaluating condition " != "no"": Bad condition
+ in directory <curdir>
+make: Fatal errors encountered -- cannot continue
+make: stopped making "do-parse-time" in unit-tests
yes
no
exit status 0
diff --git a/contrib/bmake/unit-tests/cond-late.mk b/contrib/bmake/unit-tests/cond-late.mk
index 8e3d41f60001..4d8c4fbd5d98 100644
--- a/contrib/bmake/unit-tests/cond-late.mk
+++ b/contrib/bmake/unit-tests/cond-late.mk
@@ -1,4 +1,4 @@
-# $NetBSD: cond-late.mk,v 1.6 2023/12/10 20:12:28 rillig Exp $
+# $NetBSD: cond-late.mk,v 1.8 2024/07/04 17:47:54 rillig Exp $
#
# Using the :? modifier, expressions can contain conditional
# expressions that are evaluated late, at expansion time.
@@ -15,7 +15,10 @@
# actually interpreted as these operators. This is demonstrated below.
#
-all: cond-literal
+all: parse-time cond-literal
+
+parse-time: .PHONY
+ @${MAKE} -f ${MAKEFILE} do-parse-time || true
COND.true= "yes" == "yes"
COND.false= "yes" != "yes"
@@ -29,8 +32,9 @@ cond-literal:
@echo ${ ${COND.true} :?yes:no}
@echo ${ ${COND.false} :?yes:no}
+.if make(do-parse-time)
VAR= ${${UNDEF} != "no":?:}
-# expect-reset
-# expect: make: Bad conditional expression ' != "no"' before '?:'
-.if empty(VAR:Mpattern)
+# expect+1: while evaluating variable "VAR" with value "${${UNDEF} != "no":?:}": while evaluating condition " != "no"": Bad condition
+. if empty(VAR:Mpattern)
+. endif
.endif
diff --git a/contrib/bmake/unit-tests/cond-op-and.exp b/contrib/bmake/unit-tests/cond-op-and.exp
index 6d5a14b211cc..6d2263dc5d56 100644
--- a/contrib/bmake/unit-tests/cond-op-and.exp
+++ b/contrib/bmake/unit-tests/cond-op-and.exp
@@ -1,7 +1,11 @@
-make: "cond-op-and.mk" line 37: Malformed conditional (0 || (${DEF} && ${UNDEF}))
-make: "cond-op-and.mk" line 42: Malformed conditional (0 || (${UNDEF} && ${UNDEF}))
-make: "cond-op-and.mk" line 45: Malformed conditional (0 || (!${UNDEF} && ${UNDEF}))
-make: "cond-op-and.mk" line 75: Malformed conditional (0 &&& 0)
+make: "cond-op-and.mk" line 36: Malformed conditional (0 || (${DEF} && ${UNDEF}))
+make: "cond-op-and.mk" line 41: Malformed conditional (0 || (${UNDEF} && ${UNDEF}))
+make: "cond-op-and.mk" line 44: Malformed conditional (0 || (!${UNDEF} && ${UNDEF}))
+make: "cond-op-and.mk" line 60: Unknown operator '&'
+make: "cond-op-and.mk" line 66: Unknown operator '&'
+make: "cond-op-and.mk" line 72: Unknown operator '&'
+make: "cond-op-and.mk" line 78: Unknown operator '&'
+make: "cond-op-and.mk" line 87: Unknown operator '&'
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/cond-op-and.mk b/contrib/bmake/unit-tests/cond-op-and.mk
index 19a0672ba44e..b49fb079b3cf 100644
--- a/contrib/bmake/unit-tests/cond-op-and.mk
+++ b/contrib/bmake/unit-tests/cond-op-and.mk
@@ -1,4 +1,4 @@
-# $NetBSD: cond-op-and.mk,v 1.9 2023/12/17 09:44:00 rillig Exp $
+# $NetBSD: cond-op-and.mk,v 1.10 2024/07/06 21:21:10 rillig Exp $
#
# Tests for the && operator in .if conditions.
@@ -25,8 +25,7 @@
.endif
# When an outer condition makes the inner '&&' condition irrelevant, neither
-# of its operands must be evaluated.
-#
+# of its operands is evaluated.
.if 1 || (${UNDEF} && ${UNDEF})
.endif
@@ -57,27 +56,43 @@ DEF= defined
# The && operator may be abbreviated as &. This is not widely known though
# and is also not documented in the manual page.
+# expect+1: Unknown operator '&'
.if 0 & 0
. error
+.else
+. error
.endif
+# expect+1: Unknown operator '&'
.if 1 & 0
. error
+.else
+. error
.endif
+# expect+1: Unknown operator '&'
.if 0 & 1
. error
+.else
+. error
.endif
+# expect+1: Unknown operator '&'
.if !(1 & 1)
. error
+.else
+. error
.endif
-# There is no operator &&&.
-# expect+1: Malformed conditional (0 &&& 0)
+# There is no operator '&&&'. The first two '&&' form an operator, the third
+# '&' forms the next (incomplete) token.
+# expect+1: Unknown operator '&'
.if 0 &&& 0
. error
+.else
+. error
.endif
# The '&&' operator must be preceded by whitespace, otherwise it becomes part
-# of the preceding bare word. The condition is parsed as '"1&&" != "" && 1'.
+# of the preceding bare word. The condition starts with a digit and is thus
+# parsed as '"1&&" != "" && 1'.
.if 1&& && 1
.else
. error
diff --git a/contrib/bmake/unit-tests/cond-op-not.exp b/contrib/bmake/unit-tests/cond-op-not.exp
index fcdceee9af21..86d8289d9233 100644
--- a/contrib/bmake/unit-tests/cond-op-not.exp
+++ b/contrib/bmake/unit-tests/cond-op-not.exp
@@ -5,5 +5,5 @@ make: "cond-op-not.mk" line 53: Not 1 evaluates to false.
make: "cond-op-not.mk" line 60: Not word evaluates to false.
make: "cond-op-not.mk" line 65: Malformed conditional (!)
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/cond-op-or.exp b/contrib/bmake/unit-tests/cond-op-or.exp
index b10bc4bf7c52..dddd29d5bca0 100644
--- a/contrib/bmake/unit-tests/cond-op-or.exp
+++ b/contrib/bmake/unit-tests/cond-op-or.exp
@@ -1,7 +1,11 @@
-make: "cond-op-or.mk" line 47: Malformed conditional (1 && (!${DEF} || ${UNDEF}))
-make: "cond-op-or.mk" line 50: Malformed conditional (1 && (${UNDEF} || ${UNDEF}))
-make: "cond-op-or.mk" line 53: Malformed conditional (1 && (!${UNDEF} || ${UNDEF}))
-make: "cond-op-or.mk" line 75: Malformed conditional (0 ||| 0)
+make: "cond-op-or.mk" line 36: Malformed conditional (1 && (!${DEF} || ${UNDEF}))
+make: "cond-op-or.mk" line 41: Malformed conditional (1 && (!${UNDEF} || ${UNDEF}))
+make: "cond-op-or.mk" line 44: Malformed conditional (1 && (${UNDEF} || ${UNDEF}))
+make: "cond-op-or.mk" line 60: Unknown operator '|'
+make: "cond-op-or.mk" line 66: Unknown operator '|'
+make: "cond-op-or.mk" line 72: Unknown operator '|'
+make: "cond-op-or.mk" line 78: Unknown operator '|'
+make: "cond-op-or.mk" line 87: Unknown operator '|'
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/cond-op-or.mk b/contrib/bmake/unit-tests/cond-op-or.mk
index 165408f3c130..b01fcaf04a28 100644
--- a/contrib/bmake/unit-tests/cond-op-or.mk
+++ b/contrib/bmake/unit-tests/cond-op-or.mk
@@ -1,4 +1,4 @@
-# $NetBSD: cond-op-or.mk,v 1.11 2023/12/17 09:44:00 rillig Exp $
+# $NetBSD: cond-op-or.mk,v 1.12 2024/07/06 21:21:10 rillig Exp $
#
# Tests for the || operator in .if conditions.
@@ -25,60 +25,75 @@
.endif
# When an outer condition makes the inner '||' condition irrelevant, neither
-# of its operands must be evaluated. This had been wrong in cond.c 1.283 from
-# 2021-12-09 and was reverted in cond.c 1.284 an hour later.
+# of its operands is evaluated.
.if 0 && (!defined(UNDEF) || ${UNDEF})
.endif
# Test combinations of outer '&&' with inner '||', to ensure that the operands
-# of the inner '||' is only evaluated if necessary.
+# of the inner '||' are only evaluated if necessary.
DEF= defined
-.if 0 && (${DEF} || ${UNDEF})
-.endif
-.if 0 && (!${DEF} || ${UNDEF})
-.endif
-.if 0 && (${UNDEF} || ${UNDEF})
-.endif
-.if 0 && (!${UNDEF} || ${UNDEF})
+# expect+1: Malformed conditional (1 && (!${DEF} || ${UNDEF}))
+.if 1 && (!${DEF} || ${UNDEF})
.endif
.if 1 && (${DEF} || ${UNDEF})
.endif
-# expect+1: Malformed conditional (1 && (!${DEF} || ${UNDEF}))
-.if 1 && (!${DEF} || ${UNDEF})
+# expect+1: Malformed conditional (1 && (!${UNDEF} || ${UNDEF}))
+.if 1 && (!${UNDEF} || ${UNDEF})
.endif
# expect+1: Malformed conditional (1 && (${UNDEF} || ${UNDEF}))
.if 1 && (${UNDEF} || ${UNDEF})
.endif
-# expect+1: Malformed conditional (1 && (!${UNDEF} || ${UNDEF}))
-.if 1 && (!${UNDEF} || ${UNDEF})
+.if 0 && (!${DEF} || ${UNDEF})
+.endif
+.if 0 && (${DEF} || ${UNDEF})
+.endif
+.if 0 && (!${UNDEF} || ${UNDEF})
+.endif
+.if 0 && (${UNDEF} || ${UNDEF})
.endif
# The || operator may be abbreviated as |. This is not widely known though
# and is also not documented in the manual page.
+# expect+1: Unknown operator '|'
.if 0 | 0
. error
+.else
+. error
.endif
+# expect+1: Unknown operator '|'
.if !(1 | 0)
. error
+.else
+. error
.endif
+# expect+1: Unknown operator '|'
.if !(0 | 1)
. error
+.else
+. error
.endif
+# expect+1: Unknown operator '|'
.if !(1 | 1)
. error
+.else
+. error
.endif
-# There is no operator |||.
-# expect+1: Malformed conditional (0 ||| 0)
+# There is no operator '|||'. The first two '||' form an operator, the third
+# '|' forms the next (incomplete) token.
+# expect+1: Unknown operator '|'
.if 0 ||| 0
. error
+.else
+. error
.endif
# The '||' operator must be preceded by whitespace, otherwise it becomes part
-# of the preceding bare word. The condition is parsed as '"1||" != "" || 0'.
-.if 1|| || 0
+# of the preceding bare word. The condition starts with a digit and is thus
+# parsed as '"0||" != "" || 0'.
+.if 0|| || 0
.else
. error
.endif
diff --git a/contrib/bmake/unit-tests/cond-op-parentheses.exp b/contrib/bmake/unit-tests/cond-op-parentheses.exp
index 1daad92b2682..f14e62b6d4e3 100644
--- a/contrib/bmake/unit-tests/cond-op-parentheses.exp
+++ b/contrib/bmake/unit-tests/cond-op-parentheses.exp
@@ -3,5 +3,5 @@ make: "cond-op-parentheses.mk" line 25: Malformed conditional ((3) > 2)
make: "cond-op-parentheses.mk" line 44: Malformed conditional (()
make: "cond-op-parentheses.mk" line 58: Malformed conditional ())
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/cond-op.exp b/contrib/bmake/unit-tests/cond-op.exp
index 33bab484a6c8..1ce5436f023a 100644
--- a/contrib/bmake/unit-tests/cond-op.exp
+++ b/contrib/bmake/unit-tests/cond-op.exp
@@ -17,5 +17,5 @@ make: "cond-op.mk" line 129: Malformed conditional (0 &&)
make: "cond-op.mk" line 138: Malformed conditional (1 ||)
make: "cond-op.mk" line 148: Malformed conditional (0 ||)
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/cond-short.exp b/contrib/bmake/unit-tests/cond-short.exp
index 44681b57ebc1..e9c13d979233 100644
--- a/contrib/bmake/unit-tests/cond-short.exp
+++ b/contrib/bmake/unit-tests/cond-short.exp
@@ -9,5 +9,5 @@ expected or exists
expected or empty
make: "cond-short.mk" line 231: Comparison with '<' requires both operands '' and '42' to be numeric
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/cond-token-number.exp b/contrib/bmake/unit-tests/cond-token-number.exp
index d05833b4e01b..aaa4ec7fe184 100644
--- a/contrib/bmake/unit-tests/cond-token-number.exp
+++ b/contrib/bmake/unit-tests/cond-token-number.exp
@@ -3,5 +3,5 @@ make: "cond-token-number.mk" line 27: Malformed conditional (+0)
make: "cond-token-number.mk" line 38: Malformed conditional (!-1)
make: "cond-token-number.mk" line 49: Malformed conditional (!+1)
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/cond-token-string.exp b/contrib/bmake/unit-tests/cond-token-string.exp
index 4fbafc5e1986..f970a21bf69f 100644
--- a/contrib/bmake/unit-tests/cond-token-string.exp
+++ b/contrib/bmake/unit-tests/cond-token-string.exp
@@ -1,4 +1,4 @@
-make: "cond-token-string.mk" line 15: while evaluating "${:Uvalue:Z}"": Unknown modifier "Z"
+make: "cond-token-string.mk" line 15: while evaluating "${:Uvalue:Z}"" with value "value": Unknown modifier "Z"
make: "cond-token-string.mk" line 15: Malformed conditional ("" != "${:Uvalue:Z}")
make: "cond-token-string.mk" line 25: xvalue is not defined.
make: "cond-token-string.mk" line 32: Malformed conditional (x${:Uvalue} == "")
@@ -17,5 +17,5 @@ CondParser_Eval: ("${VAR}")
CondParser_Eval: "quoted" == quoted
Comparing "quoted" == "quoted"
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/cond-token-string.mk b/contrib/bmake/unit-tests/cond-token-string.mk
index edc9936b7d53..d24645748233 100644
--- a/contrib/bmake/unit-tests/cond-token-string.mk
+++ b/contrib/bmake/unit-tests/cond-token-string.mk
@@ -1,4 +1,4 @@
-# $NetBSD: cond-token-string.mk,v 1.10 2024/04/20 10:18:55 rillig Exp $
+# $NetBSD: cond-token-string.mk,v 1.11 2024/07/05 19:47:22 rillig Exp $
#
# Tests for quoted string literals in .if conditions.
#
@@ -11,7 +11,7 @@
# Cover the code in CondParser_String that frees the memory after parsing
# an expression based on an undefined variable.
# expect+2: Malformed conditional ("" != "${:Uvalue:Z}")
-# expect+1: while evaluating "${:Uvalue:Z}"": Unknown modifier "Z"
+# expect+1: while evaluating "${:Uvalue:Z}"" with value "value": Unknown modifier "Z"
.if "" != "${:Uvalue:Z}"
. error
.else
diff --git a/contrib/bmake/unit-tests/dep-op-missing.exp b/contrib/bmake/unit-tests/dep-op-missing.exp
index 9b42c5080122..2a25286aa407 100644
--- a/contrib/bmake/unit-tests/dep-op-missing.exp
+++ b/contrib/bmake/unit-tests/dep-op-missing.exp
@@ -1,4 +1,5 @@
make: "dep-op-missing.tmp" line 1: Invalid line 'target'
+ in directory <curdir>
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 0
diff --git a/contrib/bmake/unit-tests/dep-percent.exp b/contrib/bmake/unit-tests/dep-percent.exp
index 1e6c04d2e167..fd3748d42d0f 100644
--- a/contrib/bmake/unit-tests/dep-percent.exp
+++ b/contrib/bmake/unit-tests/dep-percent.exp
@@ -2,5 +2,5 @@ make: don't know how to make dep-percent.o (continuing)
`all' not remade because of errors.
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/dep-var.exp b/contrib/bmake/unit-tests/dep-var.exp
index a12c2e7a8e96..194c723fc1a8 100755
--- a/contrib/bmake/unit-tests/dep-var.exp
+++ b/contrib/bmake/unit-tests/dep-var.exp
@@ -27,4 +27,4 @@ def2
a-def2-b
1-2-NDIRECT_2-2-1
)
-exit status 0
+exit status 2
diff --git a/contrib/bmake/unit-tests/dep.exp b/contrib/bmake/unit-tests/dep.exp
index 6b7f0fabb12b..c12fa3f90b3e 100644
--- a/contrib/bmake/unit-tests/dep.exp
+++ b/contrib/bmake/unit-tests/dep.exp
@@ -1,5 +1,5 @@
make: "dep.mk" line 11: Inconsistent operator for only-colon
make: "dep.mk" line 13: Inconsistent operator for only-colon
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/depsrc-ignore.exp b/contrib/bmake/unit-tests/depsrc-ignore.exp
index 608671f58ed8..1fc45d3d7239 100644
--- a/contrib/bmake/unit-tests/depsrc-ignore.exp
+++ b/contrib/bmake/unit-tests/depsrc-ignore.exp
@@ -7,5 +7,5 @@ false all
*** Error code 1 (continuing)
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/deptgt-begin-fail-indirect.exp b/contrib/bmake/unit-tests/deptgt-begin-fail-indirect.exp
index 59575e839a4a..46ae9ff95ff9 100644
--- a/contrib/bmake/unit-tests/deptgt-begin-fail-indirect.exp
+++ b/contrib/bmake/unit-tests/deptgt-begin-fail-indirect.exp
@@ -2,5 +2,5 @@ false
*** Error code 1 (continuing)
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/deptgt-begin-fail.exp b/contrib/bmake/unit-tests/deptgt-begin-fail.exp
index 59575e839a4a..46ae9ff95ff9 100644
--- a/contrib/bmake/unit-tests/deptgt-begin-fail.exp
+++ b/contrib/bmake/unit-tests/deptgt-begin-fail.exp
@@ -2,5 +2,5 @@ false
*** Error code 1 (continuing)
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/deptgt-delete_on_error.exp b/contrib/bmake/unit-tests/deptgt-delete_on_error.exp
index e60aa01351e2..9171c9931972 100644
--- a/contrib/bmake/unit-tests/deptgt-delete_on_error.exp
+++ b/contrib/bmake/unit-tests/deptgt-delete_on_error.exp
@@ -15,7 +15,7 @@ make: *** deptgt-delete_on_error-regular-delete removed
*** Error code 1 (continuing)
Stop.
-make: stopped in unit-tests
+make: stopped making "deptgt-delete_on_error-regular deptgt-delete_on_error-regular-delete deptgt-delete_on_error-phony deptgt-delete_on_error-phony-delete deptgt-delete_on_error-precious deptgt-delete_on_error-precious-delete" in unit-tests
*** Error code 1 (ignored)
Parallel mode
@@ -23,27 +23,27 @@ Parallel mode
*** [deptgt-delete_on_error-regular] Error code 1
make: *** deptgt-delete_on_error-regular removed
-make: stopped in unit-tests
+make: stopped making "deptgt-delete_on_error-regular deptgt-delete_on_error-regular-delete deptgt-delete_on_error-phony deptgt-delete_on_error-phony-delete deptgt-delete_on_error-precious deptgt-delete_on_error-precious-delete" in unit-tests
> deptgt-delete_on_error-regular-delete; false
*** [deptgt-delete_on_error-regular-delete] Error code 1
make: *** deptgt-delete_on_error-regular-delete removed
-make: stopped in unit-tests
+make: stopped making "deptgt-delete_on_error-regular deptgt-delete_on_error-regular-delete deptgt-delete_on_error-phony deptgt-delete_on_error-phony-delete deptgt-delete_on_error-precious deptgt-delete_on_error-precious-delete" in unit-tests
> deptgt-delete_on_error-phony; false
*** [deptgt-delete_on_error-phony] Error code 1
-make: stopped in unit-tests
+make: stopped making "deptgt-delete_on_error-regular deptgt-delete_on_error-regular-delete deptgt-delete_on_error-phony deptgt-delete_on_error-phony-delete deptgt-delete_on_error-precious deptgt-delete_on_error-precious-delete" in unit-tests
> deptgt-delete_on_error-phony-delete; false
*** [deptgt-delete_on_error-phony-delete] Error code 1
-make: stopped in unit-tests
+make: stopped making "deptgt-delete_on_error-regular deptgt-delete_on_error-regular-delete deptgt-delete_on_error-phony deptgt-delete_on_error-phony-delete deptgt-delete_on_error-precious deptgt-delete_on_error-precious-delete" in unit-tests
> deptgt-delete_on_error-precious; false
*** [deptgt-delete_on_error-precious] Error code 1
-make: stopped in unit-tests
+make: stopped making "deptgt-delete_on_error-regular deptgt-delete_on_error-regular-delete deptgt-delete_on_error-phony deptgt-delete_on_error-phony-delete deptgt-delete_on_error-precious deptgt-delete_on_error-precious-delete" in unit-tests
> deptgt-delete_on_error-precious-delete; false
*** [deptgt-delete_on_error-precious-delete] Error code 1
-make: stopped in unit-tests
+make: stopped making "deptgt-delete_on_error-regular deptgt-delete_on_error-regular-delete deptgt-delete_on_error-phony deptgt-delete_on_error-phony-delete deptgt-delete_on_error-precious deptgt-delete_on_error-precious-delete" in unit-tests
*** Error code 1 (ignored)
exit status 0
diff --git a/contrib/bmake/unit-tests/deptgt-end-fail-all.exp b/contrib/bmake/unit-tests/deptgt-end-fail-all.exp
index 2e2ee11f481a..39209f9709ce 100644
--- a/contrib/bmake/unit-tests/deptgt-end-fail-all.exp
+++ b/contrib/bmake/unit-tests/deptgt-end-fail-all.exp
@@ -3,5 +3,5 @@ false
*** Error code 1 (continuing)
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/deptgt-end-fail-indirect.exp b/contrib/bmake/unit-tests/deptgt-end-fail-indirect.exp
index 17e509600617..e0733527e59d 100644
--- a/contrib/bmake/unit-tests/deptgt-end-fail-indirect.exp
+++ b/contrib/bmake/unit-tests/deptgt-end-fail-indirect.exp
@@ -3,5 +3,5 @@ false
*** Error code 1 (continuing)
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/deptgt-end-fail.exp b/contrib/bmake/unit-tests/deptgt-end-fail.exp
index 9db907c209d5..8f4e22059829 100644
--- a/contrib/bmake/unit-tests/deptgt-end-fail.exp
+++ b/contrib/bmake/unit-tests/deptgt-end-fail.exp
@@ -13,7 +13,7 @@ Test case all=ok all-dep=ok end=ok end-dep=ERR.
*** Error code 1 (continuing)
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
@@ -25,7 +25,7 @@ Test case all=ok all-dep=ok end=ERR end-dep=ok.
*** Error code 1 (continuing)
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
@@ -36,7 +36,7 @@ Test case all=ok all-dep=ok end=ERR end-dep=ERR.
*** Error code 1 (continuing)
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
@@ -46,7 +46,7 @@ Test case all=ok all-dep=ERR end=ok end-dep=ok.
`all' not remade because of errors.
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
@@ -56,7 +56,7 @@ Test case all=ok all-dep=ERR end=ok end-dep=ERR.
`all' not remade because of errors.
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
@@ -66,7 +66,7 @@ Test case all=ok all-dep=ERR end=ERR end-dep=ok.
`all' not remade because of errors.
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
@@ -76,7 +76,7 @@ Test case all=ok all-dep=ERR end=ERR end-dep=ERR.
`all' not remade because of errors.
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
@@ -86,7 +86,7 @@ Test case all=ERR all-dep=ok end=ok end-dep=ok.
*** Error code 1 (continuing)
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
@@ -96,7 +96,7 @@ Test case all=ERR all-dep=ok end=ok end-dep=ERR.
*** Error code 1 (continuing)
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
@@ -106,7 +106,7 @@ Test case all=ERR all-dep=ok end=ERR end-dep=ok.
*** Error code 1 (continuing)
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
@@ -116,7 +116,7 @@ Test case all=ERR all-dep=ok end=ERR end-dep=ERR.
*** Error code 1 (continuing)
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
@@ -126,7 +126,7 @@ Test case all=ERR all-dep=ERR end=ok end-dep=ok.
`all' not remade because of errors.
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
@@ -136,7 +136,7 @@ Test case all=ERR all-dep=ERR end=ok end-dep=ERR.
`all' not remade because of errors.
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
@@ -146,7 +146,7 @@ Test case all=ERR all-dep=ERR end=ERR end-dep=ok.
`all' not remade because of errors.
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
@@ -156,7 +156,7 @@ Test case all=ERR all-dep=ERR end=ERR end-dep=ERR.
`all' not remade because of errors.
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/deptgt-error.exp b/contrib/bmake/unit-tests/deptgt-error.exp
index 48e2f90954cf..cc518aaa1b84 100644
--- a/contrib/bmake/unit-tests/deptgt-error.exp
+++ b/contrib/bmake/unit-tests/deptgt-error.exp
@@ -2,7 +2,7 @@ false fails
*** Error code 1 (continuing)
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
ERROR_INFO='This information is printed on 'errors'.'
Making sub-error as prerequisite.
Making .ERROR out of nothing.
diff --git a/contrib/bmake/unit-tests/deptgt-ignore.exp b/contrib/bmake/unit-tests/deptgt-ignore.exp
index 2aa1311c8ff7..8679b83af0d5 100644
--- a/contrib/bmake/unit-tests/deptgt-ignore.exp
+++ b/contrib/bmake/unit-tests/deptgt-ignore.exp
@@ -7,5 +7,5 @@ Making depends-on-ignored from error-ignored.
`all' not remade because of errors.
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/deptgt-path-suffix.exp b/contrib/bmake/unit-tests/deptgt-path-suffix.exp
index 228a29851f48..8c2437f3010f 100644
--- a/contrib/bmake/unit-tests/deptgt-path-suffix.exp
+++ b/contrib/bmake/unit-tests/deptgt-path-suffix.exp
@@ -1,4 +1,4 @@
make: "deptgt-path-suffix.mk" line 8: Suffix '.c' not defined (yet)
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/deptgt.exp b/contrib/bmake/unit-tests/deptgt.exp
index 90213fe44fb5..ae7315716d8c 100644
--- a/contrib/bmake/unit-tests/deptgt.exp
+++ b/contrib/bmake/unit-tests/deptgt.exp
@@ -8,10 +8,11 @@ ParseDependency(: empty-source)
Parsing line 39: : command for empty targets list
Parsing line 40: .MAKEFLAGS: -d0
ParseDependency(.MAKEFLAGS: -d0)
-make: "deptgt.mk" line 49: while evaluating "${:U:Z}:": Unknown modifier "Z"
+make: "deptgt.mk" line 45: while evaluating "${:U:Z}:" with value "": Unknown modifier "Z"
+make: "deptgt.mk" line 49: while parsing "${:U:Z}:": Unknown modifier "Z"
make: "deptgt.mk" line 52: warning: Extra target 'ordinary' ignored
make: "deptgt.mk" line 55: warning: Extra target (ordinary) ignored
make: "deptgt.mk" line 58: warning: Special and mundane targets don't mix. Mundane ones ignored
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "target1" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/deptgt.mk b/contrib/bmake/unit-tests/deptgt.mk
index eb948918abb7..2e6845b88038 100644
--- a/contrib/bmake/unit-tests/deptgt.mk
+++ b/contrib/bmake/unit-tests/deptgt.mk
@@ -1,4 +1,4 @@
-# $NetBSD: deptgt.mk,v 1.17 2024/04/20 10:18:55 rillig Exp $
+# $NetBSD: deptgt.mk,v 1.20 2024/07/06 10:14:35 rillig Exp $
#
# Tests for special targets like .BEGIN or .SUFFIXES in dependency
# declarations.
@@ -39,14 +39,14 @@ ${:U}: empty-source
: command for empty targets list
.MAKEFLAGS: -d0
-# Just to show that a malformed expression is only expanded once in
-# ParseDependencyTargetWord. The only way to produce an expression that
-# is well-formed on the first expansion and ill-formed on the second
-# expansion would be to use the variable modifier '::=' to modify the
-# targets. This in turn would be such an extreme and unreliable edge case
-# that nobody uses it.
-# expect+1: while evaluating "${:U:Z}:": Unknown modifier "Z"
-$$$$$$$${:U:Z}:
+# In a dependency declaration, the whole line is expanded before interpreting
+# the line.
+# expect+1: while evaluating "${:U:Z}:" with value "": Unknown modifier "Z"
+${:U:Z}:
+# After expanding the line as a whole, each target is parsed but not
+# evaluated, separately, in ParseDependencyTargetWord.
+# expect+1: while parsing "${:U:Z}:": Unknown modifier "Z"
+$${:U:Z}:
# expect+1: warning: Extra target 'ordinary' ignored
.END ordinary:
@@ -56,6 +56,3 @@ $$$$$$$${:U:Z}:
# expect+1: warning: Special and mundane targets don't mix. Mundane ones ignored
ordinary .PATH:
-
-all:
- @:;
diff --git a/contrib/bmake/unit-tests/directive-dinclude.exp b/contrib/bmake/unit-tests/directive-dinclude.exp
index 8f71e42c0515..58bcb105b829 100755
--- a/contrib/bmake/unit-tests/directive-dinclude.exp
+++ b/contrib/bmake/unit-tests/directive-dinclude.exp
@@ -1,4 +1,5 @@
make: "directive-dinclude-error.inc" line 1: Invalid line 'syntax error'
+ in directive-dinclude.mk:21
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/directive-elif.exp b/contrib/bmake/unit-tests/directive-elif.exp
index 15dd6bf1430b..fc0e749ed61a 100644
--- a/contrib/bmake/unit-tests/directive-elif.exp
+++ b/contrib/bmake/unit-tests/directive-elif.exp
@@ -17,5 +17,5 @@ make: "directive-elif.mk" line 143: 2-elsif
make: "directive-elif.mk" line 149: if-less elif
make: "directive-elif.mk" line 154: warning: extra elif
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/directive-else.exp b/contrib/bmake/unit-tests/directive-else.exp
index 992b60e9308b..8d34f94aa12f 100644
--- a/contrib/bmake/unit-tests/directive-else.exp
+++ b/contrib/bmake/unit-tests/directive-else.exp
@@ -7,5 +7,5 @@ make: "directive-else.mk" line 36: ok
make: "directive-else.mk" line 38: warning: extra else
make: "directive-else.mk" line 51: The .else directive does not take arguments
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/directive-export-gmake.exp b/contrib/bmake/unit-tests/directive-export-gmake.exp
index c37d3b2d8591..fe966893f4a9 100644
--- a/contrib/bmake/unit-tests/directive-export-gmake.exp
+++ b/contrib/bmake/unit-tests/directive-export-gmake.exp
@@ -1,4 +1,5 @@
make: "directive-export-gmake.mk" line 71: Invalid line 'export VAR=${:U1}', expanded to 'export VAR=1'
+ in .for loop from directive-export-gmake.mk:67 with value = 1
make: "directive-export-gmake.mk" line 85: 16:00:00
make: "directive-export-gmake.mk" line 92: Variable/Value missing from "export"
make: Fatal errors encountered -- cannot continue
diff --git a/contrib/bmake/unit-tests/directive-for-break.exp b/contrib/bmake/unit-tests/directive-for-break.exp
index 64941448141c..df2064a4eca0 100644
--- a/contrib/bmake/unit-tests/directive-for-break.exp
+++ b/contrib/bmake/unit-tests/directive-for-break.exp
@@ -1,5 +1,6 @@
make: "directive-for-break.mk" line 45: break outside of for loop
make: "directive-for-break.mk" line 65: The .break directive does not take arguments
+ in .for loop from directive-for-break.mk:63 with i = 1
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/directive-for-errors.exp b/contrib/bmake/unit-tests/directive-for-errors.exp
index 9c1aa5c0b1ed..463f5a376997 100644
--- a/contrib/bmake/unit-tests/directive-for-errors.exp
+++ b/contrib/bmake/unit-tests/directive-for-errors.exp
@@ -1,17 +1,17 @@
make: "directive-for-errors.mk" line 9: Unknown directive "fori"
-make: "directive-for-errors.mk" line 10: warning: <>
-make: "directive-for-errors.mk" line 11: for-less endfor
+make: "directive-for-errors.mk" line 11: warning: <>
+make: "directive-for-errors.mk" line 13: for-less endfor
make: "directive-for-errors.mk" line 25: Unknown directive "for"
-make: "directive-for-errors.mk" line 26: warning: <>
-make: "directive-for-errors.mk" line 27: for-less endfor
+make: "directive-for-errors.mk" line 27: warning: <>
+make: "directive-for-errors.mk" line 29: for-less endfor
make: "directive-for-errors.mk" line 44: invalid character '$' in .for loop variable name
make: "directive-for-errors.mk" line 52: no iteration variables in for
make: "directive-for-errors.mk" line 64: Wrong number of words (5) in .for substitution list with 3 variables
make: "directive-for-errors.mk" line 78: missing `in' in for
-make: "directive-for-errors.mk" line 89: while evaluating "${:U3:Z} 4": Unknown modifier "Z"
-make: "directive-for-errors.mk" line 90: warning: Should not be reached.
-make: "directive-for-errors.mk" line 90: warning: Should not be reached.
-make: "directive-for-errors.mk" line 90: warning: Should not be reached.
+make: "directive-for-errors.mk" line 89: while evaluating "${:U3:Z} 4" with value "3": Unknown modifier "Z"
+make: "directive-for-errors.mk" line 93: warning: Should not be reached.
+make: "directive-for-errors.mk" line 93: warning: Should not be reached.
+make: "directive-for-errors.mk" line 93: warning: Should not be reached.
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/directive-for-errors.mk b/contrib/bmake/unit-tests/directive-for-errors.mk
index e64bb97b6560..3cbf457622e8 100644
--- a/contrib/bmake/unit-tests/directive-for-errors.mk
+++ b/contrib/bmake/unit-tests/directive-for-errors.mk
@@ -1,4 +1,4 @@
-# $NetBSD: directive-for-errors.mk,v 1.11 2024/06/01 11:24:11 rillig Exp $
+# $NetBSD: directive-for-errors.mk,v 1.13 2024/07/06 10:14:35 rillig Exp $
#
# Tests for error handling in .for loops.
@@ -7,10 +7,10 @@
# in a parse error.
# expect+1: Unknown directive "fori"
.fori in 1 2 3
+# expect+1: warning: <>
. warning <${i}>
+# expect+1: for-less endfor
.endfor
-# expect-2: warning: <>
-# expect-2: for-less endfor
# A slash is not whitespace, therefore this is not parsed as a .for loop.
@@ -23,10 +23,10 @@
# name is parsed a bit differently.
# expect+1: Unknown directive "for"
.for/i in 1 2 3
+# expect+1: warning: <>
. warning <${i}>
+# expect+1: for-less endfor
.endfor
-# expect-2: warning: <>
-# expect-2: for-less endfor
# Before for.c 1.173 from 2023-05-08, the variable name could be an arbitrary
@@ -85,10 +85,10 @@ ${:U\\}= backslash # see whether the "variable" '\' is local
#
# XXX: As of 2020-12-31, Var_Subst doesn't report any errors, therefore
# the loop body is expanded as if no error had happened.
-# expect+1: while evaluating "${:U3:Z} 4": Unknown modifier "Z"
+# expect+1: while evaluating "${:U3:Z} 4" with value "3": Unknown modifier "Z"
.for i in 1 2 ${:U3:Z} 4
+# expect+3: warning: Should not be reached.
+# expect+2: warning: Should not be reached.
+# expect+1: warning: Should not be reached.
. warning Should not be reached.
.endfor
-# expect-2: warning: Should not be reached.
-# expect-3: warning: Should not be reached.
-# expect-4: warning: Should not be reached.
diff --git a/contrib/bmake/unit-tests/directive-for-escape.exp b/contrib/bmake/unit-tests/directive-for-escape.exp
index 1f4305185d65..6dfea5e79bb6 100644
--- a/contrib/bmake/unit-tests/directive-for-escape.exp
+++ b/contrib/bmake/unit-tests/directive-for-escape.exp
@@ -1,45 +1,47 @@
For: end for 1
For: loop body with chars = !"#$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~:
. info ${:U!"#$%&'()*+,-./0-9\:;<=>?@A-Z[\\]_^a-z{|\}~}
-make: Unclosed expression, expecting '}' for modifier "U!"" of variable "" with value "!""
-make: "directive-for-escape.mk" line 19: !"
+make: "directive-for-escape.mk" line 21: while evaluating "${:U!"" with value "!"": Unclosed expression, expecting '}' for modifier "U!""
+ in .for loop from directive-for-escape.mk:20 with chars = !"#$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~
+make: "directive-for-escape.mk" line 21: !"
For: end for 1
For: loop body with chars = !"\\#$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~:
. info ${:U!"\\\\#$%&'()*+,-./0-9\:;<=>?@A-Z[\\]_^a-z{|\}~}
-make: Unclosed expression, expecting '}' for modifier "U!"\\\\" of variable "" with value "!"\\"
-make: "directive-for-escape.mk" line 30: !"\\
+make: "directive-for-escape.mk" line 33: while evaluating "${:U!"\\\\" with value "!"\\": Unclosed expression, expecting '}' for modifier "U!"\\\\"
+ in .for loop from directive-for-escape.mk:32 with chars = !"\\#$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~
+make: "directive-for-escape.mk" line 33: !"\\
For: end for 1
For: loop body with i = $:
. info ${:U\$}
-make: "directive-for-escape.mk" line 45: $
+make: "directive-for-escape.mk" line 57: $
For: loop body with i = ${V}:
. info ${:U${V}}
-make: "directive-for-escape.mk" line 45: value
+make: "directive-for-escape.mk" line 57: value
For: loop body with i = ${V:=-with-modifier}:
. info ${:U${V:=-with-modifier}}
-make: "directive-for-escape.mk" line 45: value-with-modifier
+make: "directive-for-escape.mk" line 57: value-with-modifier
For: loop body with i = $(V):
. info ${:U$(V)}
-make: "directive-for-escape.mk" line 45: value
+make: "directive-for-escape.mk" line 57: value
For: loop body with i = $(V:=-with-modifier):
. info ${:U$(V:=-with-modifier)}
-make: "directive-for-escape.mk" line 45: value-with-modifier
+make: "directive-for-escape.mk" line 57: value-with-modifier
For: end for 1
For: loop body with i = $:
. info ${:U\$}
-make: "directive-for-escape.mk" line 60: $
+make: "directive-for-escape.mk" line 69: $
For: loop body with i = ${V}:
. info ${:U${V}}
-make: "directive-for-escape.mk" line 60: value
+make: "directive-for-escape.mk" line 69: value
For: loop body with i = ${V:=-with-modifier}:
. info ${:U${V:=-with-modifier}}
-make: "directive-for-escape.mk" line 60: value-with-modifier
+make: "directive-for-escape.mk" line 69: value-with-modifier
For: loop body with i = $(V):
. info ${:U$(V)}
-make: "directive-for-escape.mk" line 60: value
+make: "directive-for-escape.mk" line 69: value
For: loop body with i = $(V:=-with-modifier):
. info ${:U$(V:=-with-modifier)}
-make: "directive-for-escape.mk" line 60: value-with-modifier
+make: "directive-for-escape.mk" line 69: value-with-modifier
For: end for 1
For: loop body with i = ${UNDEF:U\$\$:
# ${:U\${UNDEF\:U\\$\\$}
@@ -50,77 +52,73 @@ For: loop body with i = end}:
For: end for 1
For: loop body with i = ${UNDEF:U\$\$:
. info ${:U\${UNDEF\:U\\$\\$}
-make: "directive-for-escape.mk" line 115: ${UNDEF:U\backslash$
+make: "directive-for-escape.mk" line 120: ${UNDEF:U\backslash$
For: loop body with i = {{}}:
. info ${:U{{\}\}}
-make: "directive-for-escape.mk" line 115: {{}}
+make: "directive-for-escape.mk" line 120: {{}}
For: loop body with i = end}:
. info ${:Uend\}}
-make: "directive-for-escape.mk" line 115: end}
+make: "directive-for-escape.mk" line 120: end}
For: end for 1
For: loop body with i = begin<${UNDEF:Ufallback:N{{{}}}}>end:
. info ${:Ubegin<${UNDEF:Ufallback:N{{{}}}}>end}
-make: "directive-for-escape.mk" line 136: begin<fallback>end
+make: "directive-for-escape.mk" line 138: begin<fallback>end
For: end for 1
For: loop body with i = $:
. info ${:U\$}
-make: "directive-for-escape.mk" line 145: $
-make: "directive-for-escape.mk" line 154: invalid character ':' in .for loop variable name
+make: "directive-for-escape.mk" line 147: $
+make: "directive-for-escape.mk" line 155: invalid character ':' in .for loop variable name
For: end for 1
-make: "directive-for-escape.mk" line 164: invalid character '}' in .for loop variable name
+make: "directive-for-escape.mk" line 165: invalid character '}' in .for loop variable name
For: end for 1
For: end for 1
For: loop body with i = inner:
-. info . $$i: ${:Uinner}
-. info . $${i}: ${:Uinner}
-. info . $${i:M*}: ${:Uinner:M*}
-. info . $$(i): $(:Uinner)
-. info . $$(i:M*): $(:Uinner:M*)
-. info . $${i$${:U}}: ${i${:U}}
-. info . $${i\}}: ${:Uinner\}} # XXX: unclear why ForLoop_SubstVarLong needs this
-. info . $${i2}: ${i2}
-. info . $${i,}: ${i,}
-. info . adjacent: ${:Uinner}${:Uinner}${:Uinner:M*}${:Uinner}
-make: "directive-for-escape.mk" line 173: . $i: inner
-make: "directive-for-escape.mk" line 174: . ${i}: inner
-make: "directive-for-escape.mk" line 175: . ${i:M*}: inner
-make: "directive-for-escape.mk" line 176: . $(i): inner
-make: "directive-for-escape.mk" line 177: . $(i:M*): inner
-make: "directive-for-escape.mk" line 178: . ${i${:U}}: outer
-make: "directive-for-escape.mk" line 179: . ${i\}}: inner}
-make: "directive-for-escape.mk" line 180: . ${i2}: two
-make: "directive-for-escape.mk" line 181: . ${i,}: comma
-make: "directive-for-escape.mk" line 182: . adjacent: innerinnerinnerinner
-make: "directive-for-escape.mk" line 201: invalid character '$' in .for loop variable name
-For: end for 1
-make: "directive-for-escape.mk" line 213: eight and no cents.
-For: end for 1
-make: "directive-for-escape.mk" line 226: newline in .for value
-make: "directive-for-escape.mk" line 226: newline in .for value
+. info ${:Uinner} ${:Uinner} ${:Uinner:M*} $(:Uinner) $(:Uinner:M*)
+make: "directive-for-escape.mk" line 175: inner inner inner inner inner
+For: end for 1
+For: loop body with i = inner:
+. info ${i${:U}}
+make: "directive-for-escape.mk" line 179: outer
+For: end for 1
+For: loop body with i = inner:
+. info ${:Uinner\}} # XXX: unclear why ForLoop_SubstVarLong needs this
+make: "directive-for-escape.mk" line 183: inner}
+For: end for 1
+For: loop body with i = inner:
+. info ${i2} ${i,} ${:Uinner}${:Uinner}${:Uinner:M*}${:Uinner}
+make: "directive-for-escape.mk" line 187: two comma innerinnerinnerinner
+make: "directive-for-escape.mk" line 196: invalid character '$' in .for loop variable name
+For: end for 1
+make: "directive-for-escape.mk" line 208: eight and no cents.
+For: end for 1
+make: "directive-for-escape.mk" line 222: newline in .for value
+ in .for loop from directive-for-escape.mk:222 with i = "
+"
+make: "directive-for-escape.mk" line 222: newline in .for value
+ in .for loop from directive-for-escape.mk:222 with i = "
+"
For: loop body with i = "
":
-. info short: ${:U" "}
-. info long: ${:U" "}
-make: "directive-for-escape.mk" line 227: short: " "
-make: "directive-for-escape.mk" line 228: long: " "
+. info short: ${:U" "}, long: ${:U" "}
+make: "directive-for-escape.mk" line 223: short: " ", long: " "
For: end for 1
For: loop body with i = "
":
-Parsing line 244: .for i in "${.newline}"
+Parsing line 236: .for i in "${.newline}"
For: end for 1
-Parse_PushInput: .for loop in directive-for-escape.mk, line 244
-make: "directive-for-escape.mk" line 244: newline in .for value
- in .for loop from directive-for-escape.mk:244 with i = "
+Parse_PushInput: .for loop in directive-for-escape.mk, line 236
+make: "directive-for-escape.mk" line 236: newline in .for value
+ in .for loop from directive-for-escape.mk:236 with i = "
"
For: loop body with i = "
":
: ${:U" "}
SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `directive-for-escape.mk'
-Parsing line 245: : ${:U" "}
+Parsing line 237: : ${:U" "}
ParseDependency(: " ")
-ParseEOF: returning to file directive-for-escape.mk, line 247
+ParseEOF: returning to file directive-for-escape.mk, line 239
SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `directive-for-escape.mk'
-Parsing line 247: .MAKEFLAGS: -d0
+Parsing line 239: .MAKEFLAGS: -d0
ParseDependency(.MAKEFLAGS: -d0)
For: end for 1
For: loop body with i = #:
diff --git a/contrib/bmake/unit-tests/directive-for-escape.mk b/contrib/bmake/unit-tests/directive-for-escape.mk
index 16df5b1db4e3..dcd13e1392c0 100644
--- a/contrib/bmake/unit-tests/directive-for-escape.mk
+++ b/contrib/bmake/unit-tests/directive-for-escape.mk
@@ -1,4 +1,4 @@
-# $NetBSD: directive-for-escape.mk,v 1.23 2023/11/19 22:32:44 rillig Exp $
+# $NetBSD: directive-for-escape.mk,v 1.28 2024/07/07 11:20:10 rillig Exp $
#
# Test escaping of special characters in the iteration values of a .for loop.
# These values get expanded later using the :U variable modifier, and this
@@ -15,10 +15,11 @@ ASCII= !"\#$$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~
# XXX: As of 2020-12-31, the '#' is not preserved in the expanded body of
# the loop. Not only would it need the escaping for the variable modifier
# ':U' but also the escaping for the line-end comment.
+# expect+3: while evaluating "${:U!"" with value "!"": Unclosed expression, expecting '}' for modifier "U!""
+# expect+2: !"
.for chars in ${ASCII}
. info ${chars}
.endfor
-# expect-2: !"
# As of 2020-12-31, using 2 backslashes before be '#' would treat the '#'
# as comment character. Using 3 backslashes doesn't help either since
@@ -26,10 +27,11 @@ ASCII= !"\#$$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~
# This means that a '#' sign cannot be passed in the value of a .for loop
# at all.
ASCII.2020-12-31= !"\\\#$$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~
+# expect+3: while evaluating "${:U!"\\\\" with value "!"\\": Unclosed expression, expecting '}' for modifier "U!"\\\\"
+# expect+2: !"\\
.for chars in ${ASCII.2020-12-31}
. info ${chars}
.endfor
-# expect-2: !"\\
# Cover the code in ExprLen.
#
@@ -41,31 +43,31 @@ ASCII.2020-12-31= !"\\\#$$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~
# See for.c, function ExprLen.
V= value
VALUES= $$ $${V} $${V:=-with-modifier} $$(V) $$(V:=-with-modifier)
-.for i in ${VALUES}
-. info $i
-.endfor
# expect: . info ${:U\$}
-# expect-3: $
+# expect+10: $
# expect: . info ${:U${V}}
-# expect-5: value
+# expect+8: value
# expect: . info ${:U${V:=-with-modifier}}
-# expect-7: value-with-modifier
+# expect+6: value-with-modifier
# expect: . info ${:U$(V)}
-# expect-9: value
+# expect+4: value
# expect: . info ${:U$(V:=-with-modifier)}
-# expect-11: value-with-modifier
+# expect+2: value-with-modifier
+.for i in ${VALUES}
+. info $i
+.endfor
#
# Providing the loop items directly has the same effect.
+# expect: . info ${:U\$}
+# expect+7: $
+# expect: . info ${:U${V}}
+# expect+5: value
+# expect+4: value-with-modifier
+# expect+3: value
+# expect+2: value-with-modifier
.for i in $$ $${V} $${V:=-with-modifier} $$(V) $$(V:=-with-modifier)
. info $i
.endfor
-# expect: . info ${:U\$}
-# expect-3: $
-# expect: . info ${:U${V}}
-# expect-5: value
-# expect-6: value-with-modifier
-# expect-7: value
-# expect-8: value-with-modifier
# Try to cover the code for nested '{}' in ExprLen, without success.
#
@@ -111,19 +113,18 @@ VALUES= $${UNDEF:U\$$\$$ {{}} end}
#
# To make the expression '$\' visible, define it to an actual word:
${:U\\}= backslash
+# expect+4: ${UNDEF:U\backslash$
+# expect+3: {{}}
+# expect+2: end}
.for i in ${VALUES}
. info $i
.endfor
#
-# expect-3: ${UNDEF:U\backslash$
-# expect-4: {{}}
-# expect-5: end}
-#
# FIXME: There was no expression '$\' in the original text of the variable
# 'VALUES', that's a surprise in the parser.
-# Second try to cover the code for nested '{}' in ExprLen.
+# The second attempt to cover the code for nested '{}' in ExprLen.
#
# XXX: It is not the job of ExprLen to parse an expression, it is naive to
# expect ExprLen to get all the details right in just a few lines of code.
@@ -132,19 +133,19 @@ ${:U\\}= backslash
# ':D' for details.) The only sensible thing to do is therefore to let
# Var_Parse do all the parsing work.
VALUES= begin<$${UNDEF:Ufallback:N{{{}}}}>end
+# expect+2: begin<fallback>end
.for i in ${VALUES}
. info $i
.endfor
-# expect-2: begin<fallback>end
# A single trailing dollar doesn't happen in practice.
# The dollar sign is correctly passed through to the body of the .for loop.
# There, it is expanded by the .info directive, but even there a trailing
# dollar sign is kept as-is.
+# expect+2: $
.for i in ${:U\$}
. info ${i}
.endfor
-# expect-2: $
# Before for.c 1.173 from 2023-05-08, the name of the iteration variable
# could contain colons, which affected expressions having this exact
@@ -169,28 +170,22 @@ EXT= .c
i= outer
i2= two
i,= comma
+# expect+2: inner inner inner inner inner
+.for i in inner
+. info $i ${i} ${i:M*} $(i) $(i:M*)
+.endfor
+# expect+2: outer
+.for i in inner
+. info ${i${:U}}
+.endfor
+# expect+2: inner}
.for i in inner
-. info . $$i: $i
-. info . $${i}: ${i}
-. info . $${i:M*}: ${i:M*}
-. info . $$(i): $(i)
-. info . $$(i:M*): $(i:M*)
-. info . $${i$${:U}}: ${i${:U}}
-. info . $${i\}}: ${i\}} # XXX: unclear why ForLoop_SubstVarLong needs this
-. info . $${i2}: ${i2}
-. info . $${i,}: ${i,}
-. info . adjacent: $i${i}${i:M*}$i
+. info ${i\}} # XXX: unclear why ForLoop_SubstVarLong needs this
+.endfor
+# expect+2: two comma innerinnerinnerinner
+.for i in inner
+. info ${i2} ${i,} $i${i}${i:M*}$i
.endfor
-# expect-11: . $i: inner
-# expect-11: . ${i}: inner
-# expect-11: . ${i:M*}: inner
-# expect-11: . $(i): inner
-# expect-11: . $(i:M*): inner
-# expect-11: . ${i${:U}}: outer
-# expect-11: . ${i\}}: inner}
-# expect-11: . ${i2}: two
-# expect-11: . ${i,}: comma
-# expect-11: . adjacent: innerinnerinnerinner
# Before for.c 1.173 from 2023-05-08, the variable name could be a single '$'
# since there was no check on valid variable names. ForLoop_SubstVarShort
@@ -221,16 +216,13 @@ ${closing-brace}= <closing-brace> # alternative interpretation
# The error message occurs in the line of the .for loop since that's the place
# where the body of the .for loop is constructed, and at this point the
# newline character gets replaced with a plain space.
+# expect+3: newline in .for value
# expect+2: newline in .for value
-# expect+1: newline in .for value
+# expect+2: short: " ", long: " "
.for i in "${.newline}"
-. info short: $i
-. info long: ${i}
+. info short: $i, long: ${i}
.endfor
-# expect-3: short: " "
-# expect-3: long: " "
-
-# No error since the newline character is not actually used.
+# No error since the newline character is not actually used in the body.
.for i in "${.newline}"
.endfor
diff --git a/contrib/bmake/unit-tests/directive-for-generating-endif.exp b/contrib/bmake/unit-tests/directive-for-generating-endif.exp
index ecdeb0962202..142189f70579 100755
--- a/contrib/bmake/unit-tests/directive-for-generating-endif.exp
+++ b/contrib/bmake/unit-tests/directive-for-generating-endif.exp
@@ -1,7 +1,10 @@
make: "directive-for-generating-endif.mk" line 24: if-less endif
+ in .for loop from directive-for-generating-endif.mk:20 with i = 3
make: "directive-for-generating-endif.mk" line 24: if-less endif
+ in .for loop from directive-for-generating-endif.mk:20 with i = 2
make: "directive-for-generating-endif.mk" line 24: if-less endif
+ in .for loop from directive-for-generating-endif.mk:20 with i = 1
make: "directive-for-generating-endif.mk" line 30: 3 open conditionals
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/directive-for-if.exp b/contrib/bmake/unit-tests/directive-for-if.exp
index f30171f4db87..71ea8ae63569 100644
--- a/contrib/bmake/unit-tests/directive-for-if.exp
+++ b/contrib/bmake/unit-tests/directive-for-if.exp
@@ -1,8 +1,11 @@
make: "directive-for-if.mk" line 51: if-less endif
+ in .for loop from directive-for-if.mk:46 with directive = if
make: "directive-for-if.mk" line 51: if-less endif
+ in .for loop from directive-for-if.mk:46 with directive = ifdef
make: "directive-for-if.mk" line 51: if-less endif
+ in .for loop from directive-for-if.mk:46 with directive = ifndef
VAR1
VAR3
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "." in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/directive-for-null.exp b/contrib/bmake/unit-tests/directive-for-null.exp
index d6198c644817..8aa36598550d 100644
--- a/contrib/bmake/unit-tests/directive-for-null.exp
+++ b/contrib/bmake/unit-tests/directive-for-null.exp
@@ -1,6 +1,7 @@
make: "(stdin)" line 2: Zero byte read from file
+ in directory <curdir>
*** Error code 2 (continuing)
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/directive-for.exp b/contrib/bmake/unit-tests/directive-for.exp
index 3e346dfab4ea..62b51aa406bf 100755
--- a/contrib/bmake/unit-tests/directive-for.exp
+++ b/contrib/bmake/unit-tests/directive-for.exp
@@ -1,31 +1,33 @@
make: "directive-for.mk" line 117: outer
-make: "directive-for.mk" line 135: a:\ a:\file.txt
-make: "directive-for.mk" line 135: d:\\
-make: "directive-for.mk" line 135: d:\\file.txt
-make: "directive-for.mk" line 146: ( ( (
-make: "directive-for.mk" line 146: [ [ [
-make: "directive-for.mk" line 146: { { {
-make: "directive-for.mk" line 146: ) ) )
-make: "directive-for.mk" line 146: ] ] ]
-make: "directive-for.mk" line 146: } } }
-make: "directive-for.mk" line 146: (()) (()) (())
-make: "directive-for.mk" line 146: [[]] [[]] [[]]
-make: "directive-for.mk" line 146: {{}} {{}} {{}}
-make: "directive-for.mk" line 146: )( )( )(
-make: "directive-for.mk" line 146: ][ ][ ][
-make: "directive-for.mk" line 146: }{ }{ }{
+make: "directive-for.mk" line 138: a:\ a:\file.txt
+make: "directive-for.mk" line 138: d:\\
+make: "directive-for.mk" line 138: d:\\file.txt
+make: "directive-for.mk" line 158: ( ( (
+make: "directive-for.mk" line 158: [ [ [
+make: "directive-for.mk" line 158: { { {
+make: "directive-for.mk" line 158: ) ) )
+make: "directive-for.mk" line 158: ] ] ]
+make: "directive-for.mk" line 158: } } }
+make: "directive-for.mk" line 158: (()) (()) (())
+make: "directive-for.mk" line 158: [[]] [[]] [[]]
+make: "directive-for.mk" line 158: {{}} {{}} {{}}
+make: "directive-for.mk" line 158: )( )( )(
+make: "directive-for.mk" line 158: ][ ][ ][
+make: "directive-for.mk" line 158: }{ }{ }{
make: "directive-for.mk" line 166: invalid character ':' in .for loop variable name
make: "directive-for.mk" line 173: invalid character '$' in .for loop variable name
make: "directive-for.mk" line 185: invalid character '$' in .for loop variable name
-make: "directive-for.mk" line 210: while evaluating "${:Uword2:Z}-after word3": Unknown modifier "Z"
-make: "directive-for.mk" line 211: XXX: Should not reach word1
-make: "directive-for.mk" line 211: XXX: Should not reach before--after
-make: "directive-for.mk" line 211: XXX: Should not reach word3
+make: "directive-for.mk" line 210: while evaluating "${:Uword2:Z}-after word3" with value "word2": Unknown modifier "Z"
+make: "directive-for.mk" line 214: XXX: Should not reach word1
+make: "directive-for.mk" line 214: XXX: Should not reach before--after
+make: "directive-for.mk" line 214: XXX: Should not reach word3
make: "directive-for.mk" line 219: no iteration variables in for
make: "directive-for.mk" line 245: 1 open conditional
+ in .for loop from directive-for.mk:243 with var = value
make: "directive-for.mk" line 261: for-less endfor
make: "directive-for.mk" line 262: if-less endif
make: "directive-for.mk" line 270: if-less endif
+ in .for loop from directive-for.mk:269 with var = value
For: new loop 2
For: end for 2
For: end for 1
@@ -36,7 +38,7 @@ For: loop body with outer = o:
endfor
For: end for 1
For: loop body with inner = i:
-make: "directive-for.mk" line 318: newline-item=(a)
+make: "directive-for.mk" line 319: newline-item=(a)
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/directive-for.mk b/contrib/bmake/unit-tests/directive-for.mk
index d777c3921556..96c1a492a5f7 100755
--- a/contrib/bmake/unit-tests/directive-for.mk
+++ b/contrib/bmake/unit-tests/directive-for.mk
@@ -1,4 +1,4 @@
-# $NetBSD: directive-for.mk,v 1.25 2024/04/20 10:18:55 rillig Exp $
+# $NetBSD: directive-for.mk,v 1.27 2024/07/06 10:14:35 rillig Exp $
#
# Tests for the .for directive.
#
@@ -132,31 +132,31 @@ EXPANSION${plus}= value
# variable values have been replaced with expressions of the form ${:U...},
# which are not interpreted as code anymore.
.for path in a:\ a:\file.txt d:\\ d:\\file.txt
+# expect+3: a:\ a:\file.txt
+# expect+2: d:\\
+# expect+1: d:\\file.txt
. info ${path}
.endfor
-# expect-2: a:\ a:\file.txt
-# expect-3: d:\\
-# expect-4: d:\\file.txt
# Ensure that braces and parentheses are properly escaped by the .for loop.
# Each line must print the same word 3 times.
# See ForLoop_SubstBody.
.for v in ( [ { ) ] } (()) [[]] {{}} )( ][ }{
+# expect+12: ( ( (
+# expect+11: [ [ [
+# expect+10: { { {
+# expect+9: ) ) )
+# expect+8: ] ] ]
+# expect+7: } } }
+# expect+6: (()) (()) (())
+# expect+5: [[]] [[]] [[]]
+# expect+4: {{}} {{}} {{}}
+# expect+3: )( )( )(
+# expect+2: ][ ][ ][
+# expect+1: }{ }{ }{
. info $v ${v} $(v)
.endfor
-# expect-02: ( ( (
-# expect-03: [ [ [
-# expect-04: { { {
-# expect-05: ) ) )
-# expect-06: ] ] ]
-# expect-07: } } }
-# expect-08: (()) (()) (())
-# expect-09: [[]] [[]] [[]]
-# expect-10: {{}} {{}} {{}}
-# expect-11: )( )( )(
-# expect-12: ][ ][ ][
-# expect-13: }{ }{ }{
# Before 2023-05-09, the variable names could contain arbitrary characters,
# except for whitespace, allowing for creative side effects, as usual for
@@ -206,13 +206,13 @@ INDIRECT= ${DIRECT}
# XXX: A parse error or evaluation error in the items of the .for loop
# should skip the whole loop. As of 2023-05-09, the loop is expanded as
# usual.
-# expect+1: while evaluating "${:Uword2:Z}-after word3": Unknown modifier "Z"
+# expect+1: while evaluating "${:Uword2:Z}-after word3" with value "word2": Unknown modifier "Z"
.for var in word1 before-${:Uword2:Z}-after word3
+# expect+3: XXX: Should not reach word1
+# expect+2: XXX: Should not reach before--after
+# expect+1: XXX: Should not reach word3
. info XXX: Should not reach ${var}
.endfor
-# expect-2: XXX: Should not reach word1
-# expect-3: XXX: Should not reach before--after
-# expect-4: XXX: Should not reach word3
# An empty list of variables to the left of the 'in' is a parse error.
@@ -315,6 +315,6 @@ INDIRECT= ${DIRECT}
# Back then, the .newline variable didn't exist, therefore it was unlikely
# that a newline ever occurred.
.for var in a${.newline}b${.newline}c
+# expect+1: newline-item=(a)
. info newline-item=(${var})
.endfor
-# expect-2: newline-item=(a)
diff --git a/contrib/bmake/unit-tests/directive-hyphen-include.exp b/contrib/bmake/unit-tests/directive-hyphen-include.exp
index 308a444890d5..d840a247102d 100755
--- a/contrib/bmake/unit-tests/directive-hyphen-include.exp
+++ b/contrib/bmake/unit-tests/directive-hyphen-include.exp
@@ -1,4 +1,5 @@
make: "directive-hyphen-include-error.inc" line 1: Invalid line 'syntax error'
+ in directive-hyphen-include.mk:20
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/directive-ifmake.exp b/contrib/bmake/unit-tests/directive-ifmake.exp
index e607726fd87c..53727e4449e0 100644
--- a/contrib/bmake/unit-tests/directive-ifmake.exp
+++ b/contrib/bmake/unit-tests/directive-ifmake.exp
@@ -11,5 +11,5 @@ make: "directive-ifmake.mk" line 82: ok
make: don't know how to make !edge (continuing)
Stop.
-make: stopped in unit-tests
+make: stopped making "first second late-target !edge" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/directive-include-fatal.exp b/contrib/bmake/unit-tests/directive-include-fatal.exp
index cae0fc97a59d..edb32df1a59b 100755
--- a/contrib/bmake/unit-tests/directive-include-fatal.exp
+++ b/contrib/bmake/unit-tests/directive-include-fatal.exp
@@ -1,4 +1,4 @@
make: "directive-include-fatal.mk" line 14: Malformed conditional (${UNDEF})
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/directive-include.exp b/contrib/bmake/unit-tests/directive-include.exp
index 6454b6835edf..4c395d7532aa 100755
--- a/contrib/bmake/unit-tests/directive-include.exp
+++ b/contrib/bmake/unit-tests/directive-include.exp
@@ -4,10 +4,10 @@ CondParser_Eval: ${.MAKE.MAKEFILES:T} != "${.PARSEFILE} null"
Comparing "directive-include.mk null" != "directive-include.mk null"
make: "directive-include.mk" line 26: Could not find nonexistent.mk
make: "directive-include.mk" line 49: Could not find "
-make: "directive-include.mk" line 56: while evaluating "${:U123:Z}.mk": Unknown modifier "Z"
+make: "directive-include.mk" line 56: while evaluating "${:U123:Z}.mk" with value "123": Unknown modifier "Z"
make: "directive-include.mk" line 56: Could not find nonexistent.mk
make: "directive-include.mk" line 61: Cannot open /nonexistent
make: "directive-include.mk" line 66: Invalid line 'include'
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/directive-include.mk b/contrib/bmake/unit-tests/directive-include.mk
index 14d00600cb8f..e2ef8dc55e3c 100755
--- a/contrib/bmake/unit-tests/directive-include.mk
+++ b/contrib/bmake/unit-tests/directive-include.mk
@@ -1,4 +1,4 @@
-# $NetBSD: directive-include.mk,v 1.14 2024/04/20 10:18:55 rillig Exp $
+# $NetBSD: directive-include.mk,v 1.15 2024/07/05 19:47:22 rillig Exp $
#
# Tests for the .include directive, which includes another file.
@@ -52,7 +52,7 @@ DQUOT= "
# expression is skipped and the file is included nevertheless.
# FIXME: Add proper error handling, no file must be included here.
# expect+2: Could not find nonexistent.mk
-# expect+1: while evaluating "${:U123:Z}.mk": Unknown modifier "Z"
+# expect+1: while evaluating "${:U123:Z}.mk" with value "123": Unknown modifier "Z"
.include "nonexistent${:U123:Z}.mk"
# The traditional include directive is seldom used.
diff --git a/contrib/bmake/unit-tests/directive-info.exp b/contrib/bmake/unit-tests/directive-info.exp
index 397d9d31ef38..17c72caf1b23 100644
--- a/contrib/bmake/unit-tests/directive-info.exp
+++ b/contrib/bmake/unit-tests/directive-info.exp
@@ -11,5 +11,5 @@ make: "directive-info.mk" line 36: Unknown directive "info-message"
make: "directive-info.mk" line 38: no-target: no-source
make: "directive-info.mk" line 47: expect line 35 for multi-line message
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making ".info.man" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/directive-sinclude.exp b/contrib/bmake/unit-tests/directive-sinclude.exp
index 5e8ecd710dc6..5b5560542c5a 100755
--- a/contrib/bmake/unit-tests/directive-sinclude.exp
+++ b/contrib/bmake/unit-tests/directive-sinclude.exp
@@ -1,4 +1,5 @@
make: "directive-include-error.inc" line 1: Invalid line 'syntax error'
+ in directive-sinclude.mk:20
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/directive-undef.exp b/contrib/bmake/unit-tests/directive-undef.exp
index 329dc8d6282a..c3d01fc480c6 100644
--- a/contrib/bmake/unit-tests/directive-undef.exp
+++ b/contrib/bmake/unit-tests/directive-undef.exp
@@ -1,6 +1,6 @@
make: "directive-undef.mk" line 30: The .undef directive requires an argument
-make: "directive-undef.mk" line 88: while evaluating variable "VARNAMES": Unknown modifier "Z"
+make: "directive-undef.mk" line 88: while evaluating variable "VARNAMES" with value "VARNAMES": Unknown modifier "Z"
make: "directive-undef.mk" line 105: warning: UT_EXPORTED is still listed in .MAKE.EXPORTED even though spaceit is not exported anymore.
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/directive-undef.mk b/contrib/bmake/unit-tests/directive-undef.mk
index ac4b20d3e858..43938e3170ea 100644
--- a/contrib/bmake/unit-tests/directive-undef.mk
+++ b/contrib/bmake/unit-tests/directive-undef.mk
@@ -1,4 +1,4 @@
-# $NetBSD: directive-undef.mk,v 1.14 2024/04/20 10:18:55 rillig Exp $
+# $NetBSD: directive-undef.mk,v 1.15 2024/07/04 17:47:54 rillig Exp $
#
# Tests for the .undef directive.
#
@@ -84,7 +84,7 @@ ${DOLLAR}= dollar
#
# As of var.c 1.762, this doesn't happen though because the error handling
# in Var_Parse and Var_Subst is not done properly.
-# expect+1: while evaluating variable "VARNAMES": Unknown modifier "Z"
+# expect+1: while evaluating variable "VARNAMES" with value "VARNAMES": Unknown modifier "Z"
.undef ${VARNAMES:L:Z}
diff --git a/contrib/bmake/unit-tests/directive-unexport-env.exp b/contrib/bmake/unit-tests/directive-unexport-env.exp
index 663034cee12c..57cf2d4b1dd9 100644
--- a/contrib/bmake/unit-tests/directive-unexport-env.exp
+++ b/contrib/bmake/unit-tests/directive-unexport-env.exp
@@ -14,5 +14,5 @@ Global: delete .MAKE.EXPORTED
Global: .MAKEFLAGS = -r -k -d v -d
Global: .MAKEFLAGS = -r -k -d v -d 0
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/directive-warning.exp b/contrib/bmake/unit-tests/directive-warning.exp
index 6fbeed91df0f..82bc06c55072 100644
--- a/contrib/bmake/unit-tests/directive-warning.exp
+++ b/contrib/bmake/unit-tests/directive-warning.exp
@@ -7,5 +7,5 @@ make: "directive-warning.mk" line 19: warning: message
make: "directive-warning.mk" line 21: Unknown directive "warnings"
make: "directive-warning.mk" line 23: Unknown directive "warnings"
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/directive.exp b/contrib/bmake/unit-tests/directive.exp
index cad8a9bb97e0..a1532ee564dc 100644
--- a/contrib/bmake/unit-tests/directive.exp
+++ b/contrib/bmake/unit-tests/directive.exp
@@ -10,5 +10,5 @@ Global: .MAKEFLAGS = -r -k -d v -d 0
make: "directive.mk" line 40: Invalid line 'target-without-colon'
make: "directive.mk" line 43: Invalid line 'target-without-colon another-target'
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making ".target" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/doterror.exp b/contrib/bmake/unit-tests/doterror.exp
index 5655644c32e2..1d7e41961c48 100644
--- a/contrib/bmake/unit-tests/doterror.exp
+++ b/contrib/bmake/unit-tests/doterror.exp
@@ -4,6 +4,6 @@ and now: sad
*** Error code 1
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
.ERROR: Looks like 'sad' is upset.
exit status 1
diff --git a/contrib/bmake/unit-tests/jobs-empty-commands-error.exp b/contrib/bmake/unit-tests/jobs-empty-commands-error.exp
index 1639425d9013..22acf79be242 100644
--- a/contrib/bmake/unit-tests/jobs-empty-commands-error.exp
+++ b/contrib/bmake/unit-tests/jobs-empty-commands-error.exp
@@ -1,5 +1,5 @@
: 'Making existing-target out of nothing.'
make: don't know how to make nonexistent-target (continuing)
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 2
diff --git a/contrib/bmake/unit-tests/jobs-error-indirect.exp b/contrib/bmake/unit-tests/jobs-error-indirect.exp
index 79843a235666..989d80c99cee 100644
--- a/contrib/bmake/unit-tests/jobs-error-indirect.exp
+++ b/contrib/bmake/unit-tests/jobs-error-indirect.exp
@@ -1,8 +1,8 @@
false
*** [indirect] Error code 1
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
make: 1 error
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 2
diff --git a/contrib/bmake/unit-tests/jobs-error-nested-make.exp b/contrib/bmake/unit-tests/jobs-error-nested-make.exp
index 2baf893c6623..cd9c8d17336f 100644
--- a/contrib/bmake/unit-tests/jobs-error-nested-make.exp
+++ b/contrib/bmake/unit-tests/jobs-error-nested-make.exp
@@ -2,10 +2,10 @@ make -f jobs-error-nested-make.mk nested
false
*** [nested] Error code 1
-make: stopped in unit-tests
+make: stopped making "nested" in unit-tests
make: 1 error
-make: stopped in unit-tests
+make: stopped making "nested" in unit-tests
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 2
diff --git a/contrib/bmake/unit-tests/jobs-error-nested.exp b/contrib/bmake/unit-tests/jobs-error-nested.exp
index 873613d40d48..5f5f8029ffd9 100644
--- a/contrib/bmake/unit-tests/jobs-error-nested.exp
+++ b/contrib/bmake/unit-tests/jobs-error-nested.exp
@@ -2,14 +2,14 @@ make -f jobs-error-nested.mk nested
false
*** [nested] Error code 1
-make: stopped in unit-tests
+make: stopped making "nested" in unit-tests
make: 1 error
-make: stopped in unit-tests
+make: stopped making "nested" in unit-tests
*** [all] Error code 2
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
make: 1 error
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 2
diff --git a/contrib/bmake/unit-tests/lint.exp b/contrib/bmake/unit-tests/lint.exp
index 78761c862298..714093ca2b7d 100755
--- a/contrib/bmake/unit-tests/lint.exp
+++ b/contrib/bmake/unit-tests/lint.exp
@@ -1,4 +1,4 @@
-make: in target "mod-loop-varname": while evaluating variable "VAR": In the :@ modifier, the variable name "${:Ubar:S,b,v,}" must not contain a dollar
+make: in target "mod-loop-varname": while evaluating variable "VAR" with value "value": In the :@ modifier, the variable name "${:Ubar:S,b,v,}" must not contain a dollar
y@:Q}
xvaluey
exit status 2
diff --git a/contrib/bmake/unit-tests/moderrs.exp b/contrib/bmake/unit-tests/moderrs.exp
index 0d1bcdc5b0f9..05a5108935cd 100644
--- a/contrib/bmake/unit-tests/moderrs.exp
+++ b/contrib/bmake/unit-tests/moderrs.exp
@@ -1,137 +1,115 @@
-mod-unknown-direct:
-want: Unknown modifier 'Z'
-make: in target "mod-unknown-direct": while evaluating variable "VAR": Unknown modifier "Z"
+make: in target "mod-unknown-direct": while evaluating variable "VAR" with value "TheVariable": Unknown modifier "Z"
VAR:Z=before--after
-mod-unknown-indirect:
-want: Unknown modifier 'Z'
-make: in target "mod-unknown-indirect": while evaluating variable "VAR": Unknown modifier "Z"
+make: in target "mod-unknown-indirect": while evaluating variable "VAR" with value "TheVariable": Unknown modifier "Z"
VAR:Z=before-inner}-after
unclosed-direct:
-want: Unclosed expression, expecting '}' for modifier "S,V,v," of variable "VAR" with value "Thevariable"
-make: Unclosed expression, expecting '}' for modifier "S,V,v," of variable "VAR" with value "Thevariable"
+make: in target "unclosed-direct": while evaluating variable "VAR" with value "Thevariable": Unclosed expression, expecting '}' for modifier "S,V,v,"
VAR:S,V,v,=Thevariable
unclosed-indirect:
-want: Unclosed expression after indirect modifier, expecting '}' for variable "VAR"
-make: Unclosed expression after indirect modifier, expecting '}' for variable "VAR"
+make: in target "unclosed-indirect": while evaluating variable "VAR" with value "Thevariable": Unclosed expression after indirect modifier, expecting '}'
VAR:S,V,v,=Thevariable
-unfinished-indirect:
-want: Unfinished modifier for VAR (',' missing)
-make: Unfinished modifier for "VAR" (',' missing)
+make: in target "unfinished-indirect": while evaluating variable "VAR" with value "TheVariable": Unfinished modifier (',' missing)
VAR:S,V,v=
-unfinished-loop:
-want: Unfinished modifier for UNDEF ('@' missing)
-make: Unfinished modifier for "UNDEF" ('@' missing)
+make: in target "unfinished-loop": while evaluating variable "UNDEF" with value "1 2 3": Unfinished modifier ('@' missing)
-want: Unfinished modifier for UNDEF ('@' missing)
-make: Unfinished modifier for "UNDEF" ('@' missing)
+make: in target "unfinished-loop": while evaluating variable "UNDEF" with value "1 2 3": Unfinished modifier ('@' missing)
1 2 3
loop-close:
-make: Unclosed expression, expecting '}' for modifier "@var@${var}}...@" of variable "UNDEF" with value "1}... 2}... 3}..."
+make: in target "loop-close": while evaluating variable "UNDEF" with value "1}... 2}... 3}...": Unclosed expression, expecting '}' for modifier "@var@${var}}...@"
1}... 2}... 3}...
1}... 2}... 3}...
-words:
-want: Unfinished modifier for UNDEF (']' missing)
-make: Unfinished modifier for "UNDEF" (']' missing)
+make: in target "words": while evaluating variable "UNDEF" with value "1 2 3": Unfinished modifier (']' missing)
-want: Unfinished modifier for UNDEF (']' missing)
-make: Unfinished modifier for "UNDEF" (']' missing)
+make: in target "words": while evaluating variable "UNDEF" with value "1 2 3": Unfinished modifier (']' missing)
13=
-make: Bad modifier ":[123451234512345123451234512345]" for variable "UNDEF"
+make: in target "words": while evaluating variable "UNDEF" with value "1 2 3": Bad modifier ":[123451234512345123451234512345]"
12345=S,^ok,:S,^3ok,}
-exclam:
-want: Unfinished modifier for VARNAME ('!' missing)
-make: Unfinished modifier for "VARNAME" ('!' missing)
+make: in target "exclam": while evaluating variable "VARNAME" with value "": Unfinished modifier ('!' missing)
-want: Unfinished modifier for ! ('!' missing)
-make: Unfinished modifier for "!" ('!' missing)
+make: in target "exclam": while evaluating variable "!" with value "!": Unfinished modifier ('!' missing)
-mod-subst-delimiter:
-make: Missing delimiter for modifier ':S'
+make: in target "mod-subst-delimiter": while evaluating variable "VAR" with value "TheVariable": Missing delimiter for modifier ':S'
1:
-make: Unfinished modifier for "VAR" (',' missing)
+make: in target "mod-subst-delimiter": while evaluating variable "VAR" with value "TheVariable": Unfinished modifier (',' missing)
2:
-make: Unfinished modifier for "VAR" (',' missing)
+make: in target "mod-subst-delimiter": while evaluating variable "VAR" with value "TheVariable": Unfinished modifier (',' missing)
3:
-make: Unfinished modifier for "VAR" (',' missing)
+make: in target "mod-subst-delimiter": while evaluating variable "VAR" with value "TheVariable": Unfinished modifier (',' missing)
4:
-make: Unfinished modifier for "VAR" (',' missing)
+make: in target "mod-subst-delimiter": while evaluating variable "VAR" with value "TheVariable": Unfinished modifier (',' missing)
5:
-make: Unclosed expression, expecting '}' for modifier "S,from,to," of variable "VAR" with value "TheVariable"
+make: in target "mod-subst-delimiter": while evaluating variable "VAR" with value "TheVariable": Unclosed expression, expecting '}' for modifier "S,from,to,"
6: TheVariable
7: TheVariable
-mod-regex-delimiter:
-make: Missing delimiter for :C modifier
+make: in target "mod-regex-delimiter": while evaluating variable "VAR" with value "TheVariable": Missing delimiter for modifier ':C'
1:
-make: Unfinished modifier for "VAR" (',' missing)
+make: in target "mod-regex-delimiter": while evaluating variable "VAR" with value "TheVariable": Unfinished modifier (',' missing)
2:
-make: Unfinished modifier for "VAR" (',' missing)
+make: in target "mod-regex-delimiter": while evaluating variable "VAR" with value "TheVariable": Unfinished modifier (',' missing)
3:
-make: Unfinished modifier for "VAR" (',' missing)
+make: in target "mod-regex-delimiter": while evaluating variable "VAR" with value "TheVariable": Unfinished modifier (',' missing)
4:
-make: Unfinished modifier for "VAR" (',' missing)
+make: in target "mod-regex-delimiter": while evaluating variable "VAR" with value "TheVariable": Unfinished modifier (',' missing)
5:
-make: Unclosed expression, expecting '}' for modifier "C,from,to," of variable "VAR" with value "TheVariable"
+make: in target "mod-regex-delimiter": while evaluating variable "VAR" with value "TheVariable": Unclosed expression, expecting '}' for modifier "C,from,to,"
6: TheVariable
7: TheVariable
mod-ts-parse:
112358132134
15152535558513521534
-make: Bad modifier ":ts\65oct" for variable "FIB"
+make: in target "mod-ts-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Bad modifier ":ts\65oct"
65oct}
-make: Bad modifier ":ts\65oct" for variable ""
+make: in target "mod-ts-parse": while evaluating "${:U${FIB}:ts\65oct} # bad modifier, variable name is """ with value "1 1 2 3 5 8 13 21 34": Bad modifier ":ts\65oct"
65oct}
-make: Bad modifier ":tsxy" for variable "FIB"
+make: in target "mod-ts-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Bad modifier ":tsxy"
xy}
mod-t-parse:
-make: Bad modifier ":t" for variable "FIB"
+make: in target "mod-t-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Bad modifier ":t"
-make: Bad modifier ":txy" for variable "FIB"
+make: in target "mod-t-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Bad modifier ":txy"
y}
-make: Bad modifier ":t" for variable "FIB"
+make: in target "mod-t-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Bad modifier ":t"
-make: Bad modifier ":t" for variable "FIB"
+make: in target "mod-t-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Bad modifier ":t"
M*}
-mod-ifelse-parse:
-make: Unfinished modifier for "FIB" (':' missing)
+make: in target "mod-ifelse-parse": while evaluating then-branch of condition "FIB": Unfinished modifier (':' missing)
-make: Unfinished modifier for "FIB" (':' missing)
+make: in target "mod-ifelse-parse": while evaluating then-branch of condition "FIB": Unfinished modifier (':' missing)
-make: Unfinished modifier for "FIB" ('}' missing)
+make: in target "mod-ifelse-parse": while evaluating else-branch of condition "FIB": Unfinished modifier ('}' missing)
-make: Unfinished modifier for "FIB" ('}' missing)
+make: in target "mod-ifelse-parse": while evaluating else-branch of condition "FIB": Unfinished modifier ('}' missing)
then
-mod-remember-parse:
1 1 2 3 5 8 13 21 34
-make: in target "mod-remember-parse": while evaluating variable "FIB": Unknown modifier "__"
+make: in target "mod-remember-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Unknown modifier "__"
-mod-sysv-parse:
-make: in target "mod-sysv-parse": while evaluating variable "FIB": Unknown modifier "3"
-make: Unclosed expression, expecting '}' for modifier "3" of variable "FIB" with value ""
+make: in target "mod-sysv-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Unknown modifier "3"
+make: in target "mod-sysv-parse": while evaluating variable "FIB" with value "": Unclosed expression, expecting '}' for modifier "3"
-make: in target "mod-sysv-parse": while evaluating variable "FIB": Unknown modifier "3="
-make: Unclosed expression, expecting '}' for modifier "3=" of variable "FIB" with value ""
+make: in target "mod-sysv-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Unknown modifier "3="
+make: in target "mod-sysv-parse": while evaluating variable "FIB" with value "": Unclosed expression, expecting '}' for modifier "3="
-make: in target "mod-sysv-parse": while evaluating variable "FIB": Unknown modifier "3=x3"
-make: Unclosed expression, expecting '}' for modifier "3=x3" of variable "FIB" with value ""
+make: in target "mod-sysv-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Unknown modifier "3=x3"
+make: in target "mod-sysv-parse": while evaluating variable "FIB" with value "": Unclosed expression, expecting '}' for modifier "3=x3"
1 1 2 x3 5 8 1x3 21 34
-exit status 0
+exit status 2
diff --git a/contrib/bmake/unit-tests/moderrs.mk b/contrib/bmake/unit-tests/moderrs.mk
index bde263af4079..66af52c14a65 100644
--- a/contrib/bmake/unit-tests/moderrs.mk
+++ b/contrib/bmake/unit-tests/moderrs.mk
@@ -1,8 +1,7 @@
-# $NetBSD: moderrs.mk,v 1.31 2023/11/19 22:32:44 rillig Exp $
+# $NetBSD: moderrs.mk,v 1.38 2024/07/05 19:47:22 rillig Exp $
#
# various modifier error tests
-'= '\''
VAR= TheVariable
# in case we have to change it ;-)
MOD_UNKN= Z
@@ -25,30 +24,30 @@ all: mod-ifelse-parse
all: mod-remember-parse
all: mod-sysv-parse
-mod-unknown-direct: print-header print-footer
- @echo 'want: Unknown modifier $'Z$''
+mod-unknown-direct: print-footer
+# expect: make: in target "mod-unknown-direct": while evaluating variable "VAR" with value "TheVariable": Unknown modifier "Z"
@echo 'VAR:Z=before-${VAR:Z}-after'
-mod-unknown-indirect: print-header print-footer
- @echo 'want: Unknown modifier $'Z$''
+mod-unknown-indirect: print-footer
+# expect: make: in target "mod-unknown-indirect": while evaluating variable "VAR" with value "TheVariable": Unknown modifier "Z"
@echo 'VAR:${MOD_UNKN}=before-${VAR:${MOD_UNKN}:inner}-after'
unclosed-direct: print-header print-footer
- @echo 'want: Unclosed expression, expecting $'}$' for modifier "S,V,v," of variable "VAR" with value "Thevariable"'
+# expect: make: in target "unclosed-direct": while evaluating variable "VAR" with value "Thevariable": Unclosed expression, expecting '}' for modifier "S,V,v,"
@echo VAR:S,V,v,=${VAR:S,V,v,
unclosed-indirect: print-header print-footer
- @echo 'want: Unclosed expression after indirect modifier, expecting $'}$' for variable "VAR"'
+# expect: make: in target "unclosed-indirect": while evaluating variable "VAR" with value "Thevariable": Unclosed expression after indirect modifier, expecting '}'
@echo VAR:${MOD_TERM},=${VAR:${MOD_S}
-unfinished-indirect: print-header print-footer
- @echo 'want: Unfinished modifier for VAR ($',$' missing)'
+unfinished-indirect: print-footer
+# expect: make: in target "unfinished-indirect": while evaluating variable "VAR" with value "TheVariable": Unfinished modifier (',' missing)
-@echo "VAR:${MOD_TERM}=${VAR:${MOD_TERM}}"
-unfinished-loop: print-header print-footer
- @echo 'want: Unfinished modifier for UNDEF ($'@$' missing)'
+unfinished-loop: print-footer
+# expect: make: in target "unfinished-loop": while evaluating variable "UNDEF" with value "1 2 3": Unfinished modifier ('@' missing)
@echo ${UNDEF:U1 2 3:@var}
- @echo 'want: Unfinished modifier for UNDEF ($'@$' missing)'
+# expect: make: in target "unfinished-loop": while evaluating variable "UNDEF" with value "1 2 3": Unfinished modifier ('@' missing)
@echo ${UNDEF:U1 2 3:@var@...}
@echo ${UNDEF:U1 2 3:@var@${var}@}
@@ -59,13 +58,14 @@ unfinished-loop: print-header print-footer
# This is also contrary to the SysV modifier, where only the actually
# used delimiter (either braces or parentheses) must be balanced.
loop-close: print-header print-footer
+# expect: make: in target "loop-close": while evaluating variable "UNDEF" with value "1}... 2}... 3}...": Unclosed expression, expecting '}' for modifier "@var@${var}}...@"
@echo ${UNDEF:U1 2 3:@var@${var}}...@
@echo ${UNDEF:U1 2 3:@var@${var}}...@}
-words: print-header print-footer
- @echo 'want: Unfinished modifier for UNDEF ($']$' missing)'
+words: print-footer
+# expect: make: in target "words": while evaluating variable "UNDEF" with value "1 2 3": Unfinished modifier (']' missing)
@echo ${UNDEF:U1 2 3:[}
- @echo 'want: Unfinished modifier for UNDEF ($']$' missing)'
+# expect: make: in target "words": while evaluating variable "UNDEF" with value "1 2 3": Unfinished modifier (']' missing)
@echo ${UNDEF:U1 2 3:[#}
# out of bounds => empty
@@ -90,61 +90,91 @@ words: print-header print-footer
# That variable is undefined, resulting in an empty string.
@echo 12345=${UNDEF:U1 2 3:[123451234512345123451234512345]:S,^$,ok,:S,^3$,ok,}
-exclam: print-header print-footer
- @echo 'want: Unfinished modifier for VARNAME ($'!$' missing)'
+exclam: print-footer
+# expect: make: in target "exclam": while evaluating variable "VARNAME" with value "": Unfinished modifier ('!' missing)
@echo ${VARNAME:!echo}
# When the final exclamation mark is missing, there is no
# fallback to the SysV substitution modifier.
# If there were a fallback, the output would be "exclam",
# and the above would have produced an "Unknown modifier '!'".
- @echo 'want: Unfinished modifier for ! ($'!$' missing)'
+# expect: make: in target "exclam": while evaluating variable "!" with value "!": Unfinished modifier ('!' missing)
@echo ${!:L:!=exclam}
-mod-subst-delimiter: print-header print-footer
+mod-subst-delimiter: print-footer
+# expect: make: in target "mod-subst-delimiter": while evaluating variable "VAR" with value "TheVariable": Missing delimiter for modifier ':S'
@echo 1: ${VAR:S
+# expect: make: in target "mod-subst-delimiter": while evaluating variable "VAR" with value "TheVariable": Unfinished modifier (',' missing)
@echo 2: ${VAR:S,
+# expect: make: in target "mod-subst-delimiter": while evaluating variable "VAR" with value "TheVariable": Unfinished modifier (',' missing)
@echo 3: ${VAR:S,from
+# expect: make: in target "mod-subst-delimiter": while evaluating variable "VAR" with value "TheVariable": Unfinished modifier (',' missing)
@echo 4: ${VAR:S,from,
+# expect: make: in target "mod-subst-delimiter": while evaluating variable "VAR" with value "TheVariable": Unfinished modifier (',' missing)
@echo 5: ${VAR:S,from,to
+# expect: make: in target "mod-subst-delimiter": while evaluating variable "VAR" with value "TheVariable": Unclosed expression, expecting '}' for modifier "S,from,to,"
@echo 6: ${VAR:S,from,to,
@echo 7: ${VAR:S,from,to,}
-mod-regex-delimiter: print-header print-footer
+mod-regex-delimiter: print-footer
+# expect: make: in target "mod-regex-delimiter": while evaluating variable "VAR" with value "TheVariable": Missing delimiter for modifier ':C'
@echo 1: ${VAR:C
+# expect: make: in target "mod-regex-delimiter": while evaluating variable "VAR" with value "TheVariable": Unfinished modifier (',' missing)
@echo 2: ${VAR:C,
+# expect: make: in target "mod-regex-delimiter": while evaluating variable "VAR" with value "TheVariable": Unfinished modifier (',' missing)
@echo 3: ${VAR:C,from
+# expect: make: in target "mod-regex-delimiter": while evaluating variable "VAR" with value "TheVariable": Unfinished modifier (',' missing)
@echo 4: ${VAR:C,from,
+# expect: make: in target "mod-regex-delimiter": while evaluating variable "VAR" with value "TheVariable": Unfinished modifier (',' missing)
@echo 5: ${VAR:C,from,to
+# expect: make: in target "mod-regex-delimiter": while evaluating variable "VAR" with value "TheVariable": Unclosed expression, expecting '}' for modifier "C,from,to,"
@echo 6: ${VAR:C,from,to,
@echo 7: ${VAR:C,from,to,}
mod-ts-parse: print-header print-footer
@echo ${FIB:ts}
@echo ${FIB:ts\65} # octal 065 == U+0035 == '5'
+# expect: make: in target "mod-ts-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Bad modifier ":ts\65oct"
@echo ${FIB:ts\65oct} # bad modifier
+# expect: make: in target "mod-ts-parse": while evaluating "${:U${FIB}:ts\65oct} # bad modifier, variable name is """ with value "1 1 2 3 5 8 13 21 34": Bad modifier ":ts\65oct"
@echo ${:U${FIB}:ts\65oct} # bad modifier, variable name is ""
+# expect: make: in target "mod-ts-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Bad modifier ":tsxy"
@echo ${FIB:tsxy} # modifier too long
mod-t-parse: print-header print-footer
+# expect: make: in target "mod-t-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Bad modifier ":t"
@echo ${FIB:t
+# expect: make: in target "mod-t-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Bad modifier ":txy"
@echo ${FIB:txy}
+# expect: make: in target "mod-t-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Bad modifier ":t"
@echo ${FIB:t}
+# expect: make: in target "mod-t-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Bad modifier ":t"
@echo ${FIB:t:M*}
-mod-ifelse-parse: print-header print-footer
+mod-ifelse-parse: print-footer
+# expect: make: in target "mod-ifelse-parse": while evaluating then-branch of condition "FIB": Unfinished modifier (':' missing)
@echo ${FIB:?
+# expect: make: in target "mod-ifelse-parse": while evaluating then-branch of condition "FIB": Unfinished modifier (':' missing)
@echo ${FIB:?then
+# expect: make: in target "mod-ifelse-parse": while evaluating else-branch of condition "FIB": Unfinished modifier ('}' missing)
@echo ${FIB:?then:
+# expect: make: in target "mod-ifelse-parse": while evaluating else-branch of condition "FIB": Unfinished modifier ('}' missing)
@echo ${FIB:?then:else
@echo ${FIB:?then:else}
-mod-remember-parse: print-header print-footer
+mod-remember-parse: print-footer
@echo ${FIB:_} # ok
+# expect: make: in target "mod-remember-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Unknown modifier "__"
@echo ${FIB:__} # modifier name too long
-mod-sysv-parse: print-header print-footer
+mod-sysv-parse: print-footer
+# expect: make: in target "mod-sysv-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Unknown modifier "3"
+# expect: make: in target "mod-sysv-parse": while evaluating variable "FIB" with value "": Unclosed expression, expecting '}' for modifier "3"
@echo ${FIB:3
+# expect: make: in target "mod-sysv-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Unknown modifier "3="
+# expect: make: in target "mod-sysv-parse": while evaluating variable "FIB" with value "": Unclosed expression, expecting '}' for modifier "3="
@echo ${FIB:3=
+# expect: make: in target "mod-sysv-parse": while evaluating variable "FIB" with value "1 1 2 3 5 8 13 21 34": Unknown modifier "3=x3"
+# expect: make: in target "mod-sysv-parse": while evaluating variable "FIB" with value "": Unclosed expression, expecting '}' for modifier "3=x3"
@echo ${FIB:3=x3
@echo ${FIB:3=x3} # ok
diff --git a/contrib/bmake/unit-tests/opt-debug-errors-jobs.exp b/contrib/bmake/unit-tests/opt-debug-errors-jobs.exp
index 614bb33b9208..a2ad864ba4e6 100644
--- a/contrib/bmake/unit-tests/opt-debug-errors-jobs.exp
+++ b/contrib/bmake/unit-tests/opt-debug-errors-jobs.exp
@@ -7,7 +7,7 @@ echo '3 spaces'; false
echo '3 spaces'; false
*** [fail-spaces] Error code 1
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
echo \ indented; false
indented
@@ -17,7 +17,7 @@ echo \ indented; false
echo \ indented; false
*** [fail-escaped-space] Error code 1
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
echo 'line1
line2'; false
line1
@@ -31,7 +31,7 @@ line2
line2'; false
*** [fail-newline] Error code 1
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
echo 'line1 line2'; false
line1 line2
@@ -41,7 +41,7 @@ line1 line2
echo 'line1 line2'; false
*** [fail-multiline] Error code 1
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
echo 'word1' 'word2'; false
word1 word2
@@ -51,7 +51,7 @@ word1 word2
echo 'word1' 'word2'; false
*** [fail-multiline-intention] Error code 1
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
*** Failed target: fail-vars
*** In directory: <curdir>
@@ -60,5 +60,5 @@ make: stopped in unit-tests
=> @false c-compiler flag1 -macro="several words"
*** [fail-vars] Error code 1
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/opt-debug-errors.exp b/contrib/bmake/unit-tests/opt-debug-errors.exp
index 859a431f23bb..b0685a3c7126 100644
--- a/contrib/bmake/unit-tests/opt-debug-errors.exp
+++ b/contrib/bmake/unit-tests/opt-debug-errors.exp
@@ -33,5 +33,5 @@ word1 word2
`all' not remade because of errors.
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/opt-debug-file.exp b/contrib/bmake/unit-tests/opt-debug-file.exp
index 8bdaca612310..aa647456baf7 100644
--- a/contrib/bmake/unit-tests/opt-debug-file.exp
+++ b/contrib/bmake/unit-tests/opt-debug-file.exp
@@ -3,10 +3,10 @@ make: "opt-debug-file.mk" line 47: This goes to stderr only, once.
make: "opt-debug-file.mk" line 50: This goes to stderr, and in addition to the debug log.
CondParser_Eval: ${:!cat opt-debug-file.debuglog!:Maddition:[#]} != 1
Comparing 1.000000 != 1.000000
-make: Missing delimiter for modifier ':S'
-make: Missing delimiter for modifier ':S'
-make: Missing delimiter for modifier ':S'
-CondParser_Eval: ${:!cat opt-debug-file.debuglog!:Mdelimiter:[#]} != 1
+make: Unterminated quoted string [make 'This goes to stdout only, once.]
+make: Unterminated quoted string [make 'This goes to stderr only, once.]
+make: Unterminated quoted string [make 'This goes to stderr, and in addition to the debug log.]
+CondParser_Eval: ${:!cat opt-debug-file.debuglog!:MUnterminated:[#]} != 1
Comparing 1.000000 != 1.000000
Cannot open debug file "/nonexistent-6f21c672-a22d-4ef7/opt-debug-file.debuglog"
exit status 2
diff --git a/contrib/bmake/unit-tests/opt-debug-file.mk b/contrib/bmake/unit-tests/opt-debug-file.mk
index e6c23c4faa1a..33a35e0a458a 100644
--- a/contrib/bmake/unit-tests/opt-debug-file.mk
+++ b/contrib/bmake/unit-tests/opt-debug-file.mk
@@ -1,4 +1,4 @@
-# $NetBSD: opt-debug-file.mk,v 1.10 2023/11/19 21:47:52 rillig Exp $
+# $NetBSD: opt-debug-file.mk,v 1.11 2024/06/30 15:21:24 rillig Exp $
#
# Tests for the -dF command line option, which redirects the debug log
# to a file instead of writing it to stderr.
@@ -54,15 +54,18 @@ DEBUG_OUTPUT:= ${:!cat opt-debug-file.debuglog!}
.endif
-# See ApplyModifier_Subst, which calls Error.
+# See Main_ParseArgLine, which calls Error.
.MAKEFLAGS: -dFstdout
-: This goes to stderr only, once. ${:U:S
+# expect: make: Unterminated quoted string [make 'This goes to stdout only, once.]
+.MAKEFLAGS: 'This goes to stdout only, once.
.MAKEFLAGS: -dFstderr
-: This goes to stderr only, once. ${:U:S
+# expect: make: Unterminated quoted string [make 'This goes to stderr only, once.]
+.MAKEFLAGS: 'This goes to stderr only, once.
.MAKEFLAGS: -dFopt-debug-file.debuglog
-: This goes to stderr, and in addition to the debug log. ${:U:S
+# expect: make: Unterminated quoted string [make 'This goes to stderr, and in addition to the debug log.]
+.MAKEFLAGS: 'This goes to stderr, and in addition to the debug log.
.MAKEFLAGS: -dFstderr -d0c
-.if ${:!cat opt-debug-file.debuglog!:Mdelimiter:[#]} != 1
+.if ${:!cat opt-debug-file.debuglog!:MUnterminated:[#]} != 1
. error
.endif
diff --git a/contrib/bmake/unit-tests/opt-debug-graph2.exp b/contrib/bmake/unit-tests/opt-debug-graph2.exp
index d4182650baed..b590e7379ddb 100644
--- a/contrib/bmake/unit-tests/opt-debug-graph2.exp
+++ b/contrib/bmake/unit-tests/opt-debug-graph2.exp
@@ -87,5 +87,5 @@ MFLAGS = -r -k -d g2
#*** Transformations:
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/opt-debug-graph3.exp b/contrib/bmake/unit-tests/opt-debug-graph3.exp
index fea3c658cb72..d1be69f89630 100644
--- a/contrib/bmake/unit-tests/opt-debug-graph3.exp
+++ b/contrib/bmake/unit-tests/opt-debug-graph3.exp
@@ -87,5 +87,5 @@ MFLAGS = -r -k -d g3
#*** Transformations:
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/opt-debug-hash.exp b/contrib/bmake/unit-tests/opt-debug-hash.exp
index d8b60450e222..605161fa797e 100644
--- a/contrib/bmake/unit-tests/opt-debug-hash.exp
+++ b/contrib/bmake/unit-tests/opt-debug-hash.exp
@@ -1,6 +1,6 @@
make: "opt-debug-hash.mk" line 13: Missing argument for ".error"
make: Fatal errors encountered -- cannot continue
-HashTable targets: size=16 numEntries=0 maxchain=0
-HashTable Global variables: size=16 numEntries=<entries> maxchain=3
+HashTable "targets": size=16 entries=0 maxchain=0
+HashTable "Global variables": size=16 entries=<entries> maxchain=4
make: stopped in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/opt-debug-lint.exp b/contrib/bmake/unit-tests/opt-debug-lint.exp
index c6cd748acd5d..eea6c8db5a49 100644
--- a/contrib/bmake/unit-tests/opt-debug-lint.exp
+++ b/contrib/bmake/unit-tests/opt-debug-lint.exp
@@ -2,9 +2,9 @@ make: "opt-debug-lint.mk" line 21: Variable "X" is undefined
make: "opt-debug-lint.mk" line 21: Malformed conditional ($X)
make: "opt-debug-lint.mk" line 45: Variable "UNDEF" is undefined
make: "opt-debug-lint.mk" line 45: Malformed conditional (${UNDEF})
-make: "opt-debug-lint.mk" line 67: while evaluating variable "value": Missing delimiter ':' after modifier "L"
-make: "opt-debug-lint.mk" line 67: while evaluating variable "value": Missing delimiter ':' after modifier "P"
-make: "opt-debug-lint.mk" line 76: while evaluating variable "value": Unknown modifier "${"
+make: "opt-debug-lint.mk" line 67: while evaluating variable "value" with value "value": Missing delimiter ':' after modifier "L"
+make: "opt-debug-lint.mk" line 67: while evaluating variable "value" with value "value": Missing delimiter ':' after modifier "P"
+make: "opt-debug-lint.mk" line 76: while evaluating variable "value" with value "": Unknown modifier "${"
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/opt-debug-lint.mk b/contrib/bmake/unit-tests/opt-debug-lint.mk
index 3e946ac6ad61..cc20694e268c 100644
--- a/contrib/bmake/unit-tests/opt-debug-lint.mk
+++ b/contrib/bmake/unit-tests/opt-debug-lint.mk
@@ -1,4 +1,4 @@
-# $NetBSD: opt-debug-lint.mk,v 1.17 2024/04/20 10:18:55 rillig Exp $
+# $NetBSD: opt-debug-lint.mk,v 1.18 2024/07/04 17:47:54 rillig Exp $
#
# Tests for the -dL command line option, which runs additional checks
# to catch common mistakes, such as unclosed expressions.
@@ -62,8 +62,8 @@ ${UNDEF}: ${UNDEF}
# Since 2020-10-03, in lint mode the variable modifier must be separated
# by colons. See varparse-mod.mk.
-# expect+2: while evaluating variable "value": Missing delimiter ':' after modifier "L"
-# expect+1: while evaluating variable "value": Missing delimiter ':' after modifier "P"
+# expect+2: while evaluating variable "value" with value "value": Missing delimiter ':' after modifier "L"
+# expect+1: while evaluating variable "value" with value "value": Missing delimiter ':' after modifier "P"
.if ${value:LPL} != "value"
. error
.endif
@@ -72,7 +72,7 @@ ${UNDEF}: ${UNDEF}
# variable modifier had to be separated by colons. This was wrong though
# since make always fell back trying to parse the indirect modifier as a
# SysV modifier.
-# expect+1: while evaluating variable "value": Unknown modifier "${"
+# expect+1: while evaluating variable "value" with value "": Unknown modifier "${"
.if ${value:${:UL}PL} != "LPL}" # FIXME: "LPL}" is unexpected here.
. error ${value:${:UL}PL}
.endif
diff --git a/contrib/bmake/unit-tests/opt-file.exp b/contrib/bmake/unit-tests/opt-file.exp
index 9550958fea37..78d1bfd0df4f 100644
--- a/contrib/bmake/unit-tests/opt-file.exp
+++ b/contrib/bmake/unit-tests/opt-file.exp
@@ -2,9 +2,10 @@ value
value
line-with-trailing-whitespace
make: "(stdin)" line 1: Zero byte read from file
+ in directory <curdir>
*** Error code 2 (continuing)
`all' not remade because of errors.
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/opt-keep-going-indirect.exp b/contrib/bmake/unit-tests/opt-keep-going-indirect.exp
index 0c00c75395fa..4ac1b180cabd 100644
--- a/contrib/bmake/unit-tests/opt-keep-going-indirect.exp
+++ b/contrib/bmake/unit-tests/opt-keep-going-indirect.exp
@@ -3,14 +3,14 @@ false
*** Error code 1 (continuing)
Stop.
-make: stopped in unit-tests
+make: stopped making "direct" in unit-tests
exited 1
direct jobs
false
*** [direct] Error code 1
-make: stopped in unit-tests
+make: stopped making "direct" in unit-tests
exited 1
indirect compat
@@ -19,14 +19,14 @@ false
`indirect' not remade because of errors.
Stop.
-make: stopped in unit-tests
+make: stopped making "indirect" in unit-tests
exited 1
indirect jobs
false
*** [direct] Error code 1
-make: stopped in unit-tests
+make: stopped making "indirect" in unit-tests
exited 1
exit status 0
diff --git a/contrib/bmake/unit-tests/opt-keep-going-multiple.exp b/contrib/bmake/unit-tests/opt-keep-going-multiple.exp
index 6d1bec18977b..00f944be735e 100644
--- a/contrib/bmake/unit-tests/opt-keep-going-multiple.exp
+++ b/contrib/bmake/unit-tests/opt-keep-going-multiple.exp
@@ -5,5 +5,5 @@ false fail2
true succeed
Stop.
-make: stopped in unit-tests
+make: stopped making "fail1 fail2 succeed" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/opt-keep-going.exp b/contrib/bmake/unit-tests/opt-keep-going.exp
index 2dbeb9927a30..06332333d355 100644
--- a/contrib/bmake/unit-tests/opt-keep-going.exp
+++ b/contrib/bmake/unit-tests/opt-keep-going.exp
@@ -5,5 +5,5 @@ other 1
`all' not remade because of errors.
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/opt-warnings-as-errors.exp b/contrib/bmake/unit-tests/opt-warnings-as-errors.exp
index 87d1db249a20..8e392f9f9c6d 100644
--- a/contrib/bmake/unit-tests/opt-warnings-as-errors.exp
+++ b/contrib/bmake/unit-tests/opt-warnings-as-errors.exp
@@ -3,5 +3,5 @@ make: parsing warnings being treated as errors
make: "opt-warnings-as-errors.mk" line 15: warning: message 2
parsing continues
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/opt.exp b/contrib/bmake/unit-tests/opt.exp
index 3c96cf25025f..daeecc8ca726 100644
--- a/contrib/bmake/unit-tests/opt.exp
+++ b/contrib/bmake/unit-tests/opt.exp
@@ -13,7 +13,7 @@ make: don't know how to make -f (continuing)
`/dev/null' is up to date.
Stop.
-make: stopped in unit-tests
+make: stopped making "-f /dev/null" in unit-tests
*** Error code 1 (ignored)
make -?
diff --git a/contrib/bmake/unit-tests/parse.exp b/contrib/bmake/unit-tests/parse.exp
index cc8c450d51ac..b55904c4df56 100644
--- a/contrib/bmake/unit-tests/parse.exp
+++ b/contrib/bmake/unit-tests/parse.exp
@@ -2,5 +2,5 @@ make: "parse.mk" line 7: Invalid line '<<<<<< old'
make: "parse.mk" line 14: Invalid line '>>>>>> new'
make: "parse.mk" line 25: Invalid line 'one-target ${:U }', expanded to 'one-target '
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "Try_to_crash_FreeBSD.xxxxxxxxxxxxxxxxxx" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/posix.exp b/contrib/bmake/unit-tests/posix.exp
index 01961f363f59..3af8361b1193 100644
--- a/contrib/bmake/unit-tests/posix.exp
+++ b/contrib/bmake/unit-tests/posix.exp
@@ -22,5 +22,5 @@ Now we expect an error...
`all' not remade because of errors.
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/sh-jobs.exp b/contrib/bmake/unit-tests/sh-jobs.exp
index ef0c574fceed..25568145c049 100644
--- a/contrib/bmake/unit-tests/sh-jobs.exp
+++ b/contrib/bmake/unit-tests/sh-jobs.exp
@@ -2,5 +2,5 @@ comment-with-followup-line: This is printed.
no-comment: This is printed.
*** [no-comment] Error code 1
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/suff-add-later.exp b/contrib/bmake/unit-tests/suff-add-later.exp
index 663016a672c1..ee19c851d57a 100644
--- a/contrib/bmake/unit-tests/suff-add-later.exp
+++ b/contrib/bmake/unit-tests/suff-add-later.exp
@@ -17,5 +17,5 @@ make: don't know how to make issue5e.d (continuing)
`all' not remade because of errors.
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/suff-clear-regular.exp b/contrib/bmake/unit-tests/suff-clear-regular.exp
index 75db9b47a55b..a14c722f35bb 100644
--- a/contrib/bmake/unit-tests/suff-clear-regular.exp
+++ b/contrib/bmake/unit-tests/suff-clear-regular.exp
@@ -4,5 +4,5 @@ make: don't know how to make .b.a (continuing)
`all' not remade because of errors.
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/suff-clear-single.exp b/contrib/bmake/unit-tests/suff-clear-single.exp
index aa46ac75f6da..3a187abca478 100644
--- a/contrib/bmake/unit-tests/suff-clear-single.exp
+++ b/contrib/bmake/unit-tests/suff-clear-single.exp
@@ -2,5 +2,5 @@ make: don't know how to make issue3 (continuing)
`all' not remade because of errors.
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/suff-main-several.exp b/contrib/bmake/unit-tests/suff-main-several.exp
index 8aa1ff4bf17d..99585102029e 100644
--- a/contrib/bmake/unit-tests/suff-main-several.exp
+++ b/contrib/bmake/unit-tests/suff-main-several.exp
@@ -137,5 +137,5 @@ make: don't know how to make suff-main-several.4 (continuing)
`next-main' not remade because of errors.
Stop.
-make: stopped in unit-tests
+make: stopped making "next-main" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/suff-self.exp b/contrib/bmake/unit-tests/suff-self.exp
index 6192c508ab96..2fb3ac493513 100644
--- a/contrib/bmake/unit-tests/suff-self.exp
+++ b/contrib/bmake/unit-tests/suff-self.exp
@@ -2,5 +2,5 @@ make: Graph cycles through suff-self.suff
`all' not remade because of errors.
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/suff-transform-endless.exp b/contrib/bmake/unit-tests/suff-transform-endless.exp
index 620c46626e22..552d77355939 100644
--- a/contrib/bmake/unit-tests/suff-transform-endless.exp
+++ b/contrib/bmake/unit-tests/suff-transform-endless.exp
@@ -42,5 +42,5 @@ make: Graph cycles through issue6.f
`all' not remade because of errors.
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/suff-transform-expand.exp b/contrib/bmake/unit-tests/suff-transform-expand.exp
index c1821852707d..5ad429b8a852 100644
--- a/contrib/bmake/unit-tests/suff-transform-expand.exp
+++ b/contrib/bmake/unit-tests/suff-transform-expand.exp
@@ -4,5 +4,5 @@ make: don't know how to make .first (continuing)
`all' not remade because of errors.
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/suff-transform-select.exp b/contrib/bmake/unit-tests/suff-transform-select.exp
index 29065154c891..df852a603a99 100644
--- a/contrib/bmake/unit-tests/suff-transform-select.exp
+++ b/contrib/bmake/unit-tests/suff-transform-select.exp
@@ -43,5 +43,5 @@ make: don't know how to make issue10.e (continuing)
`all' not remade because of errors.
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/suff-use.exp b/contrib/bmake/unit-tests/suff-use.exp
index 4a9374d8e156..ea6a20ece9e7 100644
--- a/contrib/bmake/unit-tests/suff-use.exp
+++ b/contrib/bmake/unit-tests/suff-use.exp
@@ -3,5 +3,5 @@ make: don't know how to make demo.o (continuing)
`all' not remade because of errors.
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/use-inference.exp b/contrib/bmake/unit-tests/use-inference.exp
index 135deabc918e..12ed67354edd 100644
--- a/contrib/bmake/unit-tests/use-inference.exp
+++ b/contrib/bmake/unit-tests/use-inference.exp
@@ -3,5 +3,5 @@ make: don't know how to make use-inference.to (continuing)
`all' not remade because of errors.
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/var-eval-short.exp b/contrib/bmake/unit-tests/var-eval-short.exp
index 4b553857df29..12e2b78d7a3d 100644
--- a/contrib/bmake/unit-tests/var-eval-short.exp
+++ b/contrib/bmake/unit-tests/var-eval-short.exp
@@ -1,4 +1,4 @@
-make: "var-eval-short.mk" line 46: while evaluating "${:Uword:@${FAIL}@expr@}": In the :@ modifier, the variable name "${FAIL}" must not contain a dollar
+make: "var-eval-short.mk" line 46: while parsing "${:Uword:@${FAIL}@expr@}": In the :@ modifier, the variable name "${FAIL}" must not contain a dollar
make: "var-eval-short.mk" line 46: Malformed conditional (0 && ${:Uword:@${FAIL}@expr@})
Parsing line 159: .if 0 && ${0:?${FAIL}then:${FAIL}else}
CondParser_Eval: 0 && ${0:?${FAIL}then:${FAIL}else}
@@ -27,5 +27,5 @@ ParseDependency(.MAKEFLAGS: -d0)
Global: .MAKEFLAGS = -r -k -d cpv -d
Global: .MAKEFLAGS = -r -k -d cpv -d 0
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/var-eval-short.mk b/contrib/bmake/unit-tests/var-eval-short.mk
index 5a42335a4474..d6872d158e32 100644
--- a/contrib/bmake/unit-tests/var-eval-short.mk
+++ b/contrib/bmake/unit-tests/var-eval-short.mk
@@ -1,4 +1,4 @@
-# $NetBSD: var-eval-short.mk,v 1.12 2024/04/20 10:18:55 rillig Exp $
+# $NetBSD: var-eval-short.mk,v 1.14 2024/07/05 20:01:52 rillig Exp $
#
# Tests for each variable modifier to ensure that they only do the minimum
# necessary computations. If the result of the expression is irrelevant,
@@ -41,7 +41,7 @@ FAIL= ${:!echo unexpected 1>&2!}
# after the loop, when undefining the temporary global loop variable.
# Since var.c 1.907 from 2021-04-04, a '$' is no longer allowed in the
# variable name.
-# expect+2: while evaluating "${:Uword:@${FAIL}@expr@}": In the :@ modifier, the variable name "${FAIL}" must not contain a dollar
+# expect+2: while parsing "${:Uword:@${FAIL}@expr@}": In the :@ modifier, the variable name "${FAIL}" must not contain a dollar
# expect+1: Malformed conditional (0 && ${:Uword:@${FAIL}@expr@})
.if 0 && ${:Uword:@${FAIL}@expr@}
.endif
diff --git a/contrib/bmake/unit-tests/var-op-assign.exp b/contrib/bmake/unit-tests/var-op-assign.exp
index 5fad47ca67c4..de88eac21d0c 100644
--- a/contrib/bmake/unit-tests/var-op-assign.exp
+++ b/contrib/bmake/unit-tests/var-op-assign.exp
@@ -2,5 +2,5 @@ this will be evaluated later
make: "var-op-assign.mk" line 60: Invalid line 'VARIABLE NAME= variable value'
make: "var-op-assign.mk" line 95: Parsing still continues until here.
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/var-op-expand.exp b/contrib/bmake/unit-tests/var-op-expand.exp
index 0eafc9ae4c39..63d74f313737 100644
--- a/contrib/bmake/unit-tests/var-op-expand.exp
+++ b/contrib/bmake/unit-tests/var-op-expand.exp
@@ -1,7 +1,7 @@
-make: "var-op-expand.mk" line 274: while evaluating variable "indirect": while evaluating variable "later": Unknown modifier "s,value,replaced,"
+make: "var-op-expand.mk" line 274: while evaluating variable "indirect" with value "${later:s,value,replaced,} ok ${later:value=sysv}": while evaluating variable "later" with value "": Unknown modifier "s,value,replaced,"
make: "var-op-expand.mk" line 278: warning: XXX Neither branch should be taken.
-make: "var-op-expand.mk" line 283: while evaluating variable "indirect": while evaluating variable "later": Unknown modifier "s,value,replaced,"
+make: "var-op-expand.mk" line 283: while evaluating variable "indirect" with value "${later:s,value,replaced,} ok ${later:value=sysv}": while evaluating variable "later" with value "lowercase-value": Unknown modifier "s,value,replaced,"
make: "var-op-expand.mk" line 285: warning: XXX Neither branch should be taken.
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/var-op-expand.mk b/contrib/bmake/unit-tests/var-op-expand.mk
index fb1e6d2c390f..a2ae8b0e22d1 100644
--- a/contrib/bmake/unit-tests/var-op-expand.mk
+++ b/contrib/bmake/unit-tests/var-op-expand.mk
@@ -1,4 +1,4 @@
-# $NetBSD: var-op-expand.mk,v 1.20 2024/04/20 10:18:55 rillig Exp $
+# $NetBSD: var-op-expand.mk,v 1.21 2024/07/04 17:47:54 rillig Exp $
#
# Tests for the := variable assignment operator, which expands its
# right-hand side.
@@ -270,7 +270,7 @@ later= lowercase-value
.undef later
INDIRECT:= ${LATER:S,value,replaced,} OK ${LATER:value=sysv}
indirect:= ${INDIRECT:tl}
-# expect+1: while evaluating variable "indirect": while evaluating variable "later": Unknown modifier "s,value,replaced,"
+# expect+1: while evaluating variable "indirect" with value "${later:s,value,replaced,} ok ${later:value=sysv}": while evaluating variable "later" with value "": Unknown modifier "s,value,replaced,"
.if ${indirect} != " ok "
. error
.else
@@ -279,7 +279,7 @@ indirect:= ${INDIRECT:tl}
.endif
LATER= uppercase-value
later= lowercase-value
-# expect+1: while evaluating variable "indirect": while evaluating variable "later": Unknown modifier "s,value,replaced,"
+# expect+1: while evaluating variable "indirect" with value "${later:s,value,replaced,} ok ${later:value=sysv}": while evaluating variable "later" with value "lowercase-value": Unknown modifier "s,value,replaced,"
.if ${indirect} != "uppercase-replaced ok uppercase-sysv"
# expect+1: warning: XXX Neither branch should be taken.
. warning XXX Neither branch should be taken.
diff --git a/contrib/bmake/unit-tests/var-op-shell.exp b/contrib/bmake/unit-tests/var-op-shell.exp
index 0837cd4f832e..952af6df5518 100644
--- a/contrib/bmake/unit-tests/var-op-shell.exp
+++ b/contrib/bmake/unit-tests/var-op-shell.exp
@@ -1,8 +1,8 @@
-make: "var-op-shell.mk" line 32: warning: "echo "failed"; false" returned non-zero status
-make: "var-op-shell.mk" line 39: warning: "false" returned non-zero status
+make: "var-op-shell.mk" line 32: warning: Command "echo "failed"; (exit 13)" exited with status 13
+make: "var-op-shell.mk" line 39: warning: Command "exit 13" exited with status 13
make: "var-op-shell.mk" line 62: warning: "kill $$" exited on a signal
/bin/no/such/command: not found
-make: "var-op-shell.mk" line 69: warning: "/bin/no/such/command" returned non-zero status
+make: "var-op-shell.mk" line 69: warning: Command "/bin/no/such/command" exited with status 127
stderr
Capturing the output of command "echo '$$$$'"
Global: OUTPUT = $$$$
diff --git a/contrib/bmake/unit-tests/var-op-shell.mk b/contrib/bmake/unit-tests/var-op-shell.mk
index 4441efaf4a90..bfc2e4f1361d 100644
--- a/contrib/bmake/unit-tests/var-op-shell.mk
+++ b/contrib/bmake/unit-tests/var-op-shell.mk
@@ -1,4 +1,4 @@
-# $NetBSD: var-op-shell.mk,v 1.8 2024/01/05 23:36:45 rillig Exp $
+# $NetBSD: var-op-shell.mk,v 1.10 2024/07/11 20:09:16 sjg Exp $
#
# Tests for the != variable assignment operator, which runs its right-hand
# side through the shell.
@@ -28,15 +28,15 @@ OUTPUT!= true
# '::!=', expression modifier ':!...!'), a failed command generates only a
# warning, not an "error". These "errors" are ignored in default mode, for
# compatibility, but not in lint mode (-dL).
-# expect+1: warning: "echo "failed"; false" returned non-zero status
-OUTPUT!= echo "failed"; false
+# expect+1: warning: Command "echo "failed"; (exit 13)" exited with status 13
+OUTPUT!= echo "failed"; (exit 13)
.if ${OUTPUT} != "failed"
. error
.endif
# A command with empty output may fail as well.
-# expect+1: warning: "false" returned non-zero status
-OUTPUT!= false
+# expect+1: warning: Command "exit 13" exited with status 13
+OUTPUT!= exit 13
.if ${OUTPUT} != ""
. error
.endif
@@ -50,7 +50,7 @@ OUTPUT!= echo "line 1"; echo "line 2"
# A failing command in the middle results in the exit status 0, which in the
# end means that the whole sequence of commands succeeded.
-OUTPUT!= echo "before"; false; echo "after"
+OUTPUT!= echo "before"; (exit 13); echo "after"
.if ${OUTPUT} != "before after"
. error
.endif
@@ -65,7 +65,7 @@ OUTPUT!= kill $$$$
.endif
# A nonexistent command produces a non-zero exit status.
-# expect+1: warning: "/bin/no/such/command" returned non-zero status
+# expect+1: warning: Command "/bin/no/such/command" exited with status 127
OUTPUT!= /bin/no/such/command
.if ${OUTPUT} != ""
. error
@@ -99,7 +99,7 @@ OUTPUT_SHORT!= echo "$$0"
OUTPUT_LONG!= echo "$$0" || : ${:U:range=1000}
# When running '$shell -c $command', '$0' in the shell evaluates to the name
# of the shell.
-.if ${OUTPUT_SHORT} != ${.SHELL:T}
+.if ${OUTPUT_SHORT:T} != ${.SHELL:T}
. error
.endif
# When running '$shell $tmpfile', '$0' in the shell evaluates to the name of
diff --git a/contrib/bmake/unit-tests/var-recursive.exp b/contrib/bmake/unit-tests/var-recursive.exp
index 5415dc93a53d..c92c22b125dc 100644
--- a/contrib/bmake/unit-tests/var-recursive.exp
+++ b/contrib/bmake/unit-tests/var-recursive.exp
@@ -1,19 +1,22 @@
make: "var-recursive.mk" line 21: still there
make: Variable DIRECT is recursive.
in var-recursive.mk:22
+ in directory <curdir>
make: stopped in unit-tests
make: Variable INDIRECT1 is recursive.
in var-recursive.mk:29
+ in directory <curdir>
make: stopped in unit-tests
make: "var-recursive.mk" line 37: ok
make: Variable V is recursive.
in var-recursive.mk:45
+ in directory <curdir>
make: stopped in unit-tests
: OK
In a command near "var-recursive.mk" line 57: make[1]: Variable VAR is recursive.
-make: stopped in unit-tests
+make: stopped making "target" in unit-tests
exit status 0
diff --git a/contrib/bmake/unit-tests/vardebug.exp b/contrib/bmake/unit-tests/vardebug.exp
index 86f2ac0b420d..9937185ae807 100644
--- a/contrib/bmake/unit-tests/vardebug.exp
+++ b/contrib/bmake/unit-tests/vardebug.exp
@@ -54,7 +54,7 @@ Var_Parse: ${:Uvariable:unknown} (eval-defined)
Evaluating modifier ${:U...} on value "" (eval-defined, undefined)
Result of ${:Uvariable} is "variable" (eval-defined, defined)
Evaluating modifier ${:u...} on value "variable" (eval-defined, defined)
-make: "vardebug.mk" line 63: while evaluating "${:Uvariable:unknown}": Unknown modifier "unknown"
+make: "vardebug.mk" line 63: while evaluating "${:Uvariable:unknown}" with value "variable": Unknown modifier "unknown"
Result of ${:unknown} is error (eval-defined, defined)
make: "vardebug.mk" line 63: Malformed conditional (${:Uvariable:unknown})
Var_Parse: ${UNDEFINED} (eval-defined)
diff --git a/contrib/bmake/unit-tests/vardebug.mk b/contrib/bmake/unit-tests/vardebug.mk
index 6c5703cb526f..7e6154d7e52c 100644
--- a/contrib/bmake/unit-tests/vardebug.mk
+++ b/contrib/bmake/unit-tests/vardebug.mk
@@ -1,4 +1,4 @@
-# $NetBSD: vardebug.mk,v 1.10 2024/04/20 10:18:55 rillig Exp $
+# $NetBSD: vardebug.mk,v 1.11 2024/07/05 19:47:22 rillig Exp $
#
# Demonstrates the debugging output for var.c.
@@ -59,7 +59,7 @@ VAR+= 3
# as "is error", without surrounding quotes.
# expect: Result of ${:unknown} is error (eval-defined, defined)
# expect+2: Malformed conditional (${:Uvariable:unknown})
-# expect+1: while evaluating "${:Uvariable:unknown}": Unknown modifier "unknown"
+# expect+1: while evaluating "${:Uvariable:unknown}" with value "variable": Unknown modifier "unknown"
.if ${:Uvariable:unknown}
.endif
diff --git a/contrib/bmake/unit-tests/varmisc.exp b/contrib/bmake/unit-tests/varmisc.exp
index dd24a419fe75..5e63f9f6563a 100644
--- a/contrib/bmake/unit-tests/varmisc.exp
+++ b/contrib/bmake/unit-tests/varmisc.exp
@@ -50,8 +50,8 @@ make: in target "varerror-unclosed": Unclosed variable "UNCLOSED"
make: in target "varerror-unclosed": Unclosed variable "UNCLOSED"
-make: in target "varerror-unclosed": while evaluating variable "UNCLOSED": Unclosed variable "PATTERN"
-make: Unclosed expression, expecting '}' for modifier "M${PATTERN" of variable "UNCLOSED" with value ""
+make: in target "varerror-unclosed": while evaluating variable "UNCLOSED" with value "": Unclosed variable "PATTERN"
+make: in target "varerror-unclosed": while evaluating variable "UNCLOSED" with value "": Unclosed expression, expecting '}' for modifier "M${PATTERN"
make: in target "varerror-unclosed": Unclosed variable "param"
make: in target "varerror-unclosed": Unclosed variable "UNCLOSED."
@@ -63,9 +63,9 @@ make: in target "varerror-unclosed": Unclosed variable "UNCLOSED.2"
make: in target "varerror-unclosed": Unclosed variable "UNCLOSED.3"
-make: in target "varerror-unclosed": while evaluating variable "UNCLOSED_INDIR_2": while evaluating variable "UNCLOSED_INDIR_1": Unclosed variable "UNCLOSED_ORIG"
+make: in target "varerror-unclosed": while evaluating variable "UNCLOSED_INDIR_2" with value "${UNCLOSED_INDIR_1}": while evaluating variable "UNCLOSED_INDIR_1" with value "${UNCLOSED_ORIG": Unclosed variable "UNCLOSED_ORIG"
varerror-unclosed:end
target1-flags: we have: one two
target2-flags: we have: one two three four
-exit status 0
+exit status 2
diff --git a/contrib/bmake/unit-tests/varmisc.mk b/contrib/bmake/unit-tests/varmisc.mk
index f6a0e4da2d88..94ac32812d87 100644
--- a/contrib/bmake/unit-tests/varmisc.mk
+++ b/contrib/bmake/unit-tests/varmisc.mk
@@ -1,5 +1,5 @@
-# $Id: varmisc.mk,v 1.26 2023/11/25 01:39:31 sjg Exp $
-# $NetBSD: varmisc.mk,v 1.33 2023/10/19 18:24:33 rillig Exp $
+# $Id: varmisc.mk,v 1.27 2024/07/06 18:23:18 sjg Exp $
+# $NetBSD: varmisc.mk,v 1.35 2024/07/05 18:59:33 rillig Exp $
#
# Miscellaneous variable tests.
@@ -191,13 +191,22 @@ target2-flags: target2.c
varerror-unclosed:
@echo $@:begin
+# expect: make: in target "varerror-unclosed": Unclosed variable ""
@echo $(
+# expect: make: in target "varerror-unclosed": Unclosed variable "UNCLOSED"
@echo $(UNCLOSED
+# expect: make: in target "varerror-unclosed": Unclosed variable "UNCLOSED"
@echo ${UNCLOSED
+# expect: make: in target "varerror-unclosed": while evaluating variable "UNCLOSED" with value "": Unclosed expression, expecting '}' for modifier "M${PATTERN"
@echo ${UNCLOSED:M${PATTERN
+# expect: make: in target "varerror-unclosed": Unclosed variable "param"
+# expect: make: in target "varerror-unclosed": Unclosed variable "UNCLOSED."
@echo ${UNCLOSED.${param
@echo $
.for i in 1 2 3
+# expect: make: in target "varerror-unclosed": Unclosed variable "UNCLOSED.1"
+# expect: make: in target "varerror-unclosed": Unclosed variable "UNCLOSED.2"
+# expect: make: in target "varerror-unclosed": Unclosed variable "UNCLOSED.3"
@echo ${UNCLOSED.${i}
.endfor
@echo ${UNCLOSED_INDIR_2}
diff --git a/contrib/bmake/unit-tests/varmod-assign-shell.exp b/contrib/bmake/unit-tests/varmod-assign-shell.exp
index b7c6cd223f24..819fa6a5f304 100644
--- a/contrib/bmake/unit-tests/varmod-assign-shell.exp
+++ b/contrib/bmake/unit-tests/varmod-assign-shell.exp
@@ -1,11 +1,11 @@
-make: "varmod-assign-shell.mk" line 28: warning: "echo output; false" returned non-zero status
+make: "varmod-assign-shell.mk" line 21: warning: Command "echo output; (exit 13)" exited with status 13
Global: _ = # (empty)
-Var_Parse: ${ASSIGNED::!=echo output; ${:Ufalse}} (eval-keep-dollar-and-undefined)
+Var_Parse: ${ASSIGNED::!=echo output; ${:U(exit 13)}} (eval-keep-dollar-and-undefined)
Evaluating modifier ${ASSIGNED::...} on value "previous" (eval-keep-dollar-and-undefined, regular)
-Modifier part: "echo output; false"
-Capturing the output of command "echo output; false"
-make: "echo output; false" returned non-zero status
-Result of ${ASSIGNED::!=echo output; ${:Ufalse}} is "" (eval-keep-dollar-and-undefined, regular)
+Modifier part: "echo output; (exit 13)"
+Capturing the output of command "echo output; (exit 13)"
+make: "varmod-assign-shell.mk" line 26: warning: while evaluating variable "ASSIGNED" with value "previous": Command "echo output; (exit 13)" exited with status 13
+Result of ${ASSIGNED::!=echo output; ${:U(exit 13)}} is "" (eval-keep-dollar-and-undefined, regular)
Global: _ = # (empty)
Global: .MAKEFLAGS = -r -k -d v -d
Global: .MAKEFLAGS = -r -k -d v -d 0
diff --git a/contrib/bmake/unit-tests/varmod-assign-shell.mk b/contrib/bmake/unit-tests/varmod-assign-shell.mk
index 6158bac14eaa..0b3e553055b3 100644
--- a/contrib/bmake/unit-tests/varmod-assign-shell.mk
+++ b/contrib/bmake/unit-tests/varmod-assign-shell.mk
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-assign-shell.mk,v 1.5 2023/06/01 20:56:35 rillig Exp $
+# $NetBSD: varmod-assign-shell.mk,v 1.8 2024/07/04 17:47:54 rillig Exp $
#
# Tests for the variable modifier '::!=', which assigns the output of a shell
# command to the variable, but only if the command exited successfully. This
@@ -15,21 +15,15 @@
# error message instead of the command that was executed. That's where the
# counterintuitive error message 'make: "previous" returned non-zero status'
# comes from.
-#
-# BUGS
-# Even though the variable modifier '::!=' produces an error message,
-# the exit status of make is still 0.
-#
-# Having an error message instead of a warning like for the variable
-# assignment operator '!=' is another unnecessary inconsistency.
DIRECT= previous
-# expect+1: warning: "echo output; false" returned non-zero status
-DIRECT!= echo output; false
+# expect+1: warning: Command "echo output; (exit 13)" exited with status 13
+DIRECT!= echo output; (exit 13)
ASSIGNED= previous
-.MAKEFLAGS: -dv # to see the actual command
-_:= ${ASSIGNED::!=echo output; ${:Ufalse}}
+.MAKEFLAGS: -dv # to see the "Capturing" debug output
+# expect+1: warning: while evaluating variable "ASSIGNED" with value "previous": Command "echo output; (exit 13)" exited with status 13
+_:= ${ASSIGNED::!=echo output; ${:U(exit 13)}}
.MAKEFLAGS: -d0
all:
diff --git a/contrib/bmake/unit-tests/varmod-assign.exp b/contrib/bmake/unit-tests/varmod-assign.exp
index db1fa64c8479..6c8bfb5cd6e8 100644
--- a/contrib/bmake/unit-tests/varmod-assign.exp
+++ b/contrib/bmake/unit-tests/varmod-assign.exp
@@ -37,18 +37,18 @@ Global: .MAKEOVERRIDES = FIRST LAST LAST LAST APPENDED RAN RAN RAN IT1 THEN1 IE
Result of ${CMD_NEW_VAR::=new-value} is "" (eval, undefined)
Global: .MAKEFLAGS = -r -k -d v -d 0 -d v -d
Global: .MAKEFLAGS = -r -k -d v -d 0 -d v -d 0
-make: Bad modifier ":" for variable ""
+make: in target "mod-assign-empty": while evaluating "${::=value}" with value "": Bad modifier ":"
mod-assign-empty: value}
-make: Bad modifier ":" for variable ""
+make: in target "mod-assign-empty": while evaluating "${:Uvalue::=overwritten}" with value "value": Bad modifier ":"
mod-assign-empty: overwritten}
mod-assign-empty: VAR=overwritten
-make: in target "mod-assign-parse": while evaluating variable "ASSIGN": Unknown modifier ":x"
+make: in target "mod-assign-parse": while evaluating variable "ASSIGN" with value "": Unknown modifier ":x"
sysv:y
-make: Unfinished modifier for "ASSIGN" ('}' missing)
+make: in target "mod-assign-parse": while evaluating variable "ASSIGN" with value "": Unfinished modifier ('}' missing)
ok=word
-make: " echo word; false " returned non-zero status
+make: warning: in target "mod-assign-shell-error": while evaluating variable "SH_ERR" with value "previous": Command " echo word; (exit 13) " exited with status 13
err=previous
Command: TARGET_CMD_VAR = cmd-value
Global: TARGET_GLOBAL_VAR = global-value
@@ -57,4 +57,4 @@ target: TARGET_TARGET_VAR = new-value
Global: TARGET_GLOBAL_VAR = new-value
Global: TARGET_ENV_VAR = new-value
target: TARGET_NEW_VAR = new-value
-exit status 0
+exit status 2
diff --git a/contrib/bmake/unit-tests/varmod-assign.mk b/contrib/bmake/unit-tests/varmod-assign.mk
index 17d9df764be1..ee1c86c039f5 100644
--- a/contrib/bmake/unit-tests/varmod-assign.mk
+++ b/contrib/bmake/unit-tests/varmod-assign.mk
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-assign.mk,v 1.20 2024/04/20 10:18:55 rillig Exp $
+# $NetBSD: varmod-assign.mk,v 1.23 2024/07/04 17:47:54 rillig Exp $
#
# Tests for the obscure ::= variable modifiers, which perform variable
# assignments during evaluation, just like the = operator in C.
@@ -90,13 +90,14 @@ mod-assign-empty:
mod-assign-parse:
# The modifier for assignment operators starts with a ':'.
# An 'x' after that is an invalid modifier.
- # expect: make: in target "mod-assign-parse": while evaluating variable "ASSIGN": Unknown modifier ":x"
+ # expect: make: in target "mod-assign-parse": while evaluating variable "ASSIGN" with value "": Unknown modifier ":x"
@echo ${ASSIGN::x}
# When parsing an assignment operator fails because the operator is
# incomplete, make falls back to the SysV modifier.
@echo ${SYSV::=sysv\:x}${SYSV::x=:y}
+# expect: make: in target "mod-assign-parse": while evaluating variable "ASSIGN" with value "": Unfinished modifier ('}' missing)
@echo ${ASSIGN::=value # missing closing brace
mod-assign-shell-error:
@@ -105,7 +106,7 @@ mod-assign-shell-error:
# If the command fails, the variable keeps its previous value.
@${SH_ERR::=previous}
- @${SH_ERR::!= echo word; false } echo err=${SH_ERR}
+ @${SH_ERR::!= echo word; (exit 13) } echo err=${SH_ERR}
# XXX: The ::= modifier expands its right-hand side exactly once.
# This differs subtly from normal assignments such as '+=' or '=', which copy
diff --git a/contrib/bmake/unit-tests/varmod-edge.exp b/contrib/bmake/unit-tests/varmod-edge.exp
index fad5cb2c3c94..ff4f73d30939 100644
--- a/contrib/bmake/unit-tests/varmod-edge.exp
+++ b/contrib/bmake/unit-tests/varmod-edge.exp
@@ -1,27 +1,12 @@
-make: "varmod-edge.mk" line 184: ok M-paren
-make: "varmod-edge.mk" line 184: ok M-mixed
-make: "varmod-edge.mk" line 184: ok M-unescape
-make: Unclosed expression, expecting '}' for modifier "U*)" of variable "" with value "*)"
-make: "varmod-edge.mk" line 184: ok M-nest-mix
-make: "varmod-edge.mk" line 184: ok M-nest-brk
-make: "varmod-edge.mk" line 184: ok M-pat-err
-make: "varmod-edge.mk" line 184: ok M-bsbs
-make: "varmod-edge.mk" line 184: ok M-bs1-par
-make: "varmod-edge.mk" line 184: ok M-bs2-par
-make: "varmod-edge.mk" line 184: ok M-128
-make: "varmod-edge.mk" line 184: ok eq-ext
-make: "varmod-edge.mk" line 184: ok eq-q
-make: "varmod-edge.mk" line 184: ok eq-bs
-make: Unfinished modifier for "INP.eq-esc" ('=' missing)
-make: "varmod-edge.mk" line 184: ok eq-esc
-make: "varmod-edge.mk" line 184: ok colon
-make: "varmod-edge.mk" line 167: while evaluating variable "MOD.colons": while evaluating variable "INP.colons": Unknown modifier ":"
-make: "varmod-edge.mk" line 167: while evaluating variable "MOD.colons": while evaluating variable "INP.colons": Unknown modifier ":"
-make: "varmod-edge.mk" line 184: ok colons
-make: "varmod-edge.mk" line 195: while evaluating "${:Z}": Unknown modifier "Z"
-make: "varmod-edge.mk" line 195: Malformed conditional (${:Z})
-make: Unfinished modifier for "" (',' missing)
-make: "varmod-edge.mk" line 209: Malformed conditional (${:S,})
+make: "varmod-edge.mk" line 60: while evaluating variable "MOD" with value "${INP:M${:U*)}}": while evaluating variable "INP" with value "(parentheses)": while evaluating "${:U*)" with value "*)": Unclosed expression, expecting '}' for modifier "U*)"
+make: "varmod-edge.mk" line 88: while evaluating variable "MOD" with value "${INP:M${:U[[}}": while evaluating variable "INP" with value "[ [[ [[[": Unfinished character list in pattern '[[' of modifier ':M'
+make: "varmod-edge.mk" line 178: while evaluating variable "MOD" with value "${INP:a\=b}": while evaluating variable "INP" with value "file.c file...": Unfinished modifier ('=' missing)
+make: "varmod-edge.mk" line 194: while evaluating variable "MOD" with value "${INP::::}": while evaluating variable "INP" with value "value": Unknown modifier ":"
+make: "varmod-edge.mk" line 194: while evaluating variable "MOD" with value "${INP::::}": while evaluating variable "INP" with value "": Unknown modifier ":"
+make: "varmod-edge.mk" line 203: while evaluating "${:Z}" with value "": Unknown modifier "Z"
+make: "varmod-edge.mk" line 203: Malformed conditional (${:Z})
+make: "varmod-edge.mk" line 217: while evaluating "${:S,}" with value "": Unfinished modifier (',' missing)
+make: "varmod-edge.mk" line 217: Malformed conditional (${:S,})
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/varmod-edge.mk b/contrib/bmake/unit-tests/varmod-edge.mk
index 2f8f8c793de1..77c080ef3e5f 100644
--- a/contrib/bmake/unit-tests/varmod-edge.mk
+++ b/contrib/bmake/unit-tests/varmod-edge.mk
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-edge.mk,v 1.20 2024/04/20 10:18:55 rillig Exp $
+# $NetBSD: varmod-edge.mk,v 1.29 2024/07/09 17:07:23 rillig Exp $
#
# Tests for edge cases in variable modifiers.
#
@@ -10,19 +10,23 @@
# - MOD, the expression for testing the modifier
# - EXP, the expected output
-TESTS+= M-paren
-INP.M-paren= (parentheses) {braces} (opening closing) ()
-MOD.M-paren= ${INP.M-paren:M(*)}
-EXP.M-paren= (parentheses) ()
+INP= (parentheses) {braces} (opening closing) ()
+MOD= ${INP:M(*)}
+EXP= (parentheses) ()
+.if ${MOD} != ${EXP}
+. warning expected "${EXP}", got "${MOD}"
+.endif
# The first closing brace matches the opening parenthesis.
# The second closing brace actually ends the expression.
#
# XXX: This is unexpected but rarely occurs in practice.
-TESTS+= M-mixed
-INP.M-mixed= (paren-brace} (
-MOD.M-mixed= ${INP.M-mixed:M(*}}
-EXP.M-mixed= (paren-brace}
+INP= (paren-brace} (
+MOD= ${INP:M(*}}
+EXP= (paren-brace}
+.if ${MOD} != ${EXP}
+. warning expected "${EXP}", got "${MOD}"
+.endif
# After the :M modifier has parsed the pattern, only the closing brace
# and the colon are unescaped. The other characters are left as-is.
@@ -31,10 +35,12 @@ EXP.M-mixed= (paren-brace}
# Str_Match.
#
# XXX: This is unexpected. The opening brace should also be unescaped.
-TESTS+= M-unescape
-INP.M-unescape= ({}): \(\{\}\)\: \(\{}\):
-MOD.M-unescape= ${INP.M-unescape:M\\(\\{\\}\\)\\:}
-EXP.M-unescape= \(\{}\):
+INP= ({}): \(\{\}\)\: \(\{}\):
+MOD= ${INP:M\\(\\{\\}\\)\\:}
+EXP= \(\{}\):
+.if ${MOD} != ${EXP}
+. warning expected "${EXP}", got "${MOD}"
+.endif
# When the :M and :N modifiers are parsed, the pattern finishes as soon
# as open_parens + open_braces == closing_parens + closing_braces. This
@@ -47,50 +53,59 @@ EXP.M-unescape= \(\{}\):
# The final brace in the output comes from the end of M.nest-mix.
#
# XXX: This is unexpected but rarely occurs in practice.
-TESTS+= M-nest-mix
-INP.M-nest-mix= (parentheses)
-MOD.M-nest-mix= ${INP.M-nest-mix:M${:U*)}}
-EXP.M-nest-mix= (parentheses)}
-# make: Unclosed expression, expecting '}' for modifier "U*)" of variable "" with value "*)"
+INP= (parentheses)
+MOD= ${INP:M${:U*)}}
+EXP= (parentheses)}
+# expect+1: while evaluating variable "MOD" with value "${INP:M${:U*)}}": while evaluating variable "INP" with value "(parentheses)": while evaluating "${:U*)" with value "*)": Unclosed expression, expecting '}' for modifier "U*)"
+.if ${MOD} != ${EXP}
+. warning expected "${EXP}", got "${MOD}"
+.endif
+
# In contrast to parentheses and braces, the brackets are not counted
-# when the :M modifier is parsed since Makefile variables only take the
+# when the :M modifier is parsed since Makefile expressions only take the
# ${VAR} or $(VAR) forms, but not $[VAR].
#
# The final ] in the pattern is needed to close the character class.
-TESTS+= M-nest-brk
-INP.M-nest-brk= [ [[ [[[
-MOD.M-nest-brk= ${INP.M-nest-brk:M${:U[[[[[]}}
-EXP.M-nest-brk= [
+INP= [ [[ [[[
+MOD= ${INP:M${:U[[[[[]}}
+EXP= [
+.if ${MOD} != ${EXP}
+. warning expected "${EXP}", got "${MOD}"
+.endif
+
# The pattern in the nested variable has an unclosed character class.
-# No error is reported though, and the pattern is closed implicitly.
#
-# XXX: It is unexpected that no error is reported.
-# See str.c, function Str_Match.
+# Before str.c 1.104 from 2024-07-06, no error was reported.
#
# Before 2019-12-02, this test case triggered an out-of-bounds read
# in Str_Match.
-TESTS+= M-pat-err
-INP.M-pat-err= [ [[ [[[
-MOD.M-pat-err= ${INP.M-pat-err:M${:U[[}}
-EXP.M-pat-err= [
+INP= [ [[ [[[
+MOD= ${INP:M${:U[[}}
+EXP= [
+# expect+1: while evaluating variable "MOD" with value "${INP:M${:U[[}}": while evaluating variable "INP" with value "[ [[ [[[": Unfinished character list in pattern '[[' of modifier ':M'
+.if ${MOD} != ${EXP}
+. warning expected "${EXP}", got "${MOD}"
+.endif
# The first backslash does not escape the second backslash.
# Therefore, the second backslash escapes the parenthesis.
# This means that the pattern ends there.
-# The final } in the output comes from the end of MOD.M-bsbs.
+# The final } in the output comes from the end of MOD.
#
# If the first backslash were to escape the second backslash, the first
-# closing brace would match the opening parenthesis (see M-mixed), and
+# closing brace would match the opening parenthesis (see paren-brace), and
# the second closing brace would be needed to close the variable.
# After that, the remaining backslash would escape the parenthesis in
# the pattern, therefore (} would match.
-TESTS+= M-bsbs
-INP.M-bsbs= (} \( \(}
-MOD.M-bsbs= ${INP.M-bsbs:M\\(}}
-EXP.M-bsbs= \(}
-#EXP.M-bsbs= (} # If the first backslash were to escape ...
+INP= (} \( \(}
+MOD= ${INP:M\\(}}
+EXP= \(}
+#EXP= (} # If the first backslash were to escape ...
+.if ${MOD} != ${EXP}
+. warning expected "${EXP}", got "${MOD}"
+.endif
# The backslash in \( does not escape the parenthesis, therefore it
# counts for the nesting level and matches with the first closing brace.
@@ -99,99 +114,92 @@ EXP.M-bsbs= \(}
#
# The second :M in the pattern is nested between ( and }, therefore it
# does not start a new modifier.
-TESTS+= M-bs1-par
-INP.M-bs1-par= ( (:M (:M} \( \(:M \(:M}
-MOD.M-bs1-par= ${INP.M-bs1-par:M\(:M*}}}
-EXP.M-bs1-par= (:M}}
+INP= ( (:M (:M} \( \(:M \(:M}
+MOD= ${INP:M\(:M*}}}
+EXP= (:M}}
+.if ${MOD} != ${EXP}
+. warning expected "${EXP}", got "${MOD}"
+.endif
# The double backslash is passed verbatim to the pattern matcher.
# The Str_Match pattern is \\(:M*}, and there the backslash is unescaped.
# Again, the ( takes place in the nesting level, and there is no way to
# prevent this, no matter how many backslashes are used.
-TESTS+= M-bs2-par
-INP.M-bs2-par= ( (:M (:M} \( \(:M \(:M}
-MOD.M-bs2-par= ${INP.M-bs2-par:M\\(:M*}}}
-EXP.M-bs2-par= \(:M}}
-
-# Str_Match uses a recursive algorithm for matching the * patterns.
-# Make sure that it survives patterns with 128 asterisks.
-# That should be enough for all practical purposes.
-# To produce a stack overflow, just add more :Qs below.
-TESTS+= M-128
-INP.M-128= ${:U\\:Q:Q:Q:Q:Q:Q:Q:S,\\,x,g}
-PAT.M-128= ${:U\\:Q:Q:Q:Q:Q:Q:Q:S,\\,*,g}
-MOD.M-128= ${INP.M-128:M${PAT.M-128}}
-EXP.M-128= ${INP.M-128}
+INP= ( (:M (:M} \( \(:M \(:M}
+MOD= ${INP:M\\(:M*}}}
+EXP= \(:M}}
+.if ${MOD} != ${EXP}
+. warning expected "${EXP}", got "${MOD}"
+.endif
+
+# Before str.c 1.48 from 2020-06-15, Str_Match used a recursive algorithm for
+# matching the '*' patterns and did not optimize for multiple '*' in a row.
+# Test a pattern with 65536 asterisks.
+INP= ${:U\\:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:S,\\,x,g}
+PAT= ${:U\\:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:S,\\,*,g}
+MOD= ${INP:M${PAT}}
+EXP= ${INP}
+.if ${MOD} != ${EXP}
+. warning expected "${EXP}", got "${MOD}"
+.endif
# This is the normal SysV substitution. Nothing surprising here.
-TESTS+= eq-ext
-INP.eq-ext= file.c file.cc
-MOD.eq-ext= ${INP.eq-ext:%.c=%.o}
-EXP.eq-ext= file.o file.cc
+INP= file.c file.cc
+MOD= ${INP:%.c=%.o}
+EXP= file.o file.cc
+.if ${MOD} != ${EXP}
+. warning expected "${EXP}", got "${MOD}"
+.endif
# The SysV := modifier is greedy and consumes all the modifier text
# up until the closing brace or parenthesis. The :Q may look like a
# modifier, but it really isn't, that's why it appears in the output.
-TESTS+= eq-q
-INP.eq-q= file.c file.cc
-MOD.eq-q= ${INP.eq-q:%.c=%.o:Q}
-EXP.eq-q= file.o:Q file.cc
+INP= file.c file.cc
+MOD= ${INP:%.c=%.o:Q}
+EXP= file.o:Q file.cc
+.if ${MOD} != ${EXP}
+. warning expected "${EXP}", got "${MOD}"
+.endif
# The = in the := modifier can be escaped.
-TESTS+= eq-bs
-INP.eq-bs= file.c file.c=%.o
-MOD.eq-bs= ${INP.eq-bs:%.c\=%.o=%.ext}
-EXP.eq-bs= file.c file.ext
+INP= file.c file.c=%.o
+MOD= ${INP:%.c\=%.o=%.ext}
+EXP= file.c file.ext
+.if ${MOD} != ${EXP}
+. warning expected "${EXP}", got "${MOD}"
+.endif
# Having only an escaped '=' results in a parse error.
# The call to "pattern.lhs = ParseModifierPart" fails.
-TESTS+= eq-esc
-INP.eq-esc= file.c file...
-MOD.eq-esc= ${INP.eq-esc:a\=b}
-EXP.eq-esc= # empty
-# make: Unfinished modifier for INP.eq-esc ('=' missing)
-
-TESTS+= colon
-INP.colon= value
-MOD.colon= ${INP.colon:}
-EXP.colon= value
-
-TESTS+= colons
-INP.colons= value
-MOD.colons= ${INP.colons::::}
-EXP.colons= # empty
-
-.for test in ${TESTS}
-# expect+2: while evaluating variable "MOD.colons": while evaluating variable "INP.colons": Unknown modifier ":"
-# expect+1: while evaluating variable "MOD.colons": while evaluating variable "INP.colons": Unknown modifier ":"
-. if ${MOD.${test}} == ${EXP.${test}}
-# expect+16: ok M-paren
-# expect+15: ok M-mixed
-# expect+14: ok M-unescape
-# expect+13: ok M-nest-mix
-# expect+12: ok M-nest-brk
-# expect+11: ok M-pat-err
-# expect+10: ok M-bsbs
-# expect+09: ok M-bs1-par
-# expect+08: ok M-bs2-par
-# expect+07: ok M-128
-# expect+06: ok eq-ext
-# expect+05: ok eq-q
-# expect+04: ok eq-bs
-# expect+03: ok eq-esc
-# expect+02: ok colon
-# expect+01: ok colons
-. info ok ${test}
-. else
-. warning error in ${test}: expected "${EXP.${test}}", got "${MOD.${test}}"
-. endif
-.endfor
+INP= file.c file...
+MOD= ${INP:a\=b}
+EXP= # empty
+# expect+1: while evaluating variable "MOD" with value "${INP:a\=b}": while evaluating variable "INP" with value "file.c file...": Unfinished modifier ('=' missing)
+.if ${MOD} != ${EXP}
+. warning expected "${EXP}", got "${MOD}"
+.endif
+
+INP= value
+MOD= ${INP:}
+EXP= value
+.if ${MOD} != ${EXP}
+. warning expected "${EXP}", got "${MOD}"
+.endif
+
+INP= value
+MOD= ${INP::::}
+EXP= # empty
+# expect+2: while evaluating variable "MOD" with value "${INP::::}": while evaluating variable "INP" with value "value": Unknown modifier ":"
+# expect+1: while evaluating variable "MOD" with value "${INP::::}": while evaluating variable "INP" with value "": Unknown modifier ":"
+.if ${MOD} != ${EXP}
+. warning expected "${EXP}", got "${MOD}"
+.endif
# Even in expressions based on an unnamed variable, there may be errors.
# XXX: The error message should mention the variable name of the expression,
# even though that name is empty in this case.
# expect+2: Malformed conditional (${:Z})
-# expect+1: while evaluating "${:Z}": Unknown modifier "Z"
+# expect+1: while evaluating "${:Z}" with value "": Unknown modifier "Z"
.if ${:Z}
. error
.else
@@ -204,13 +212,10 @@ EXP.colons= # empty
# variable name with quotes, leading to the rather confusing "Unfinished
# modifier for (',' missing)", having two spaces in a row.
#
-# XXX: The error message should report the filename:lineno.
+# expect+2: while evaluating "${:S,}" with value "": Unfinished modifier (',' missing)
# expect+1: Malformed conditional (${:S,})
.if ${:S,}
. error
.else
. error
.endif
-
-all:
- @echo ok
diff --git a/contrib/bmake/unit-tests/varmod-gmtime.exp b/contrib/bmake/unit-tests/varmod-gmtime.exp
index 1b12ead96d85..c41e96723f65 100644
--- a/contrib/bmake/unit-tests/varmod-gmtime.exp
+++ b/contrib/bmake/unit-tests/varmod-gmtime.exp
@@ -1,13 +1,13 @@
-make: "varmod-gmtime.mk" line 61: while evaluating "${:L:gmtime=-1} != """: Invalid time value "-1"
+make: "varmod-gmtime.mk" line 61: while evaluating "${:L:gmtime=-1} != """ with value "": Invalid time value "-1"
make: "varmod-gmtime.mk" line 61: Malformed conditional (${:L:gmtime=-1} != "")
-make: "varmod-gmtime.mk" line 72: while evaluating "${:L:gmtime= 1} != """: Invalid time value " 1"
+make: "varmod-gmtime.mk" line 72: while evaluating "${:L:gmtime= 1} != """ with value "": Invalid time value " 1"
make: "varmod-gmtime.mk" line 72: Malformed conditional (${:L:gmtime= 1} != "")
-make: "varmod-gmtime.mk" line 120: while evaluating "${:L:gmtime=10000000000000000000000000000000} != """: Invalid time value "10000000000000000000000000000000"
+make: "varmod-gmtime.mk" line 120: while evaluating "${:L:gmtime=10000000000000000000000000000000} != """ with value "": Invalid time value "10000000000000000000000000000000"
make: "varmod-gmtime.mk" line 120: Malformed conditional (${:L:gmtime=10000000000000000000000000000000} != "")
-make: "varmod-gmtime.mk" line 133: while evaluating "${:L:gmtime=error} != """: Invalid time value "error"
+make: "varmod-gmtime.mk" line 133: while evaluating "${:L:gmtime=error} != """ with value "": Invalid time value "error"
make: "varmod-gmtime.mk" line 133: Malformed conditional (${:L:gmtime=error} != "")
-make: "varmod-gmtime.mk" line 144: while evaluating variable "%Y": Invalid time value "100000S,1970,bad,"
+make: "varmod-gmtime.mk" line 144: while evaluating variable "%Y" with value "%Y": Invalid time value "100000S,1970,bad,"
make: "varmod-gmtime.mk" line 144: Malformed conditional (${%Y:L:gmtime=100000S,1970,bad,} != "bad")
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/varmod-gmtime.mk b/contrib/bmake/unit-tests/varmod-gmtime.mk
index db24b1680c46..a2b983508be5 100644
--- a/contrib/bmake/unit-tests/varmod-gmtime.mk
+++ b/contrib/bmake/unit-tests/varmod-gmtime.mk
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-gmtime.mk,v 1.22 2024/04/20 10:18:55 rillig Exp $
+# $NetBSD: varmod-gmtime.mk,v 1.24 2024/07/05 19:47:22 rillig Exp $
#
# Tests for the :gmtime variable modifier, which formats a timestamp
# using strftime(3) in UTC.
@@ -56,7 +56,7 @@
# 1970. Going back 50 years in the past is not a practical use case for
# make. Therefore, since var.c 1.631, negative time stamps produce a
# parse error.
-# expect+2: while evaluating "${:L:gmtime=-1} != """: Invalid time value "-1"
+# expect+2: while evaluating "${:L:gmtime=-1} != """ with value "": Invalid time value "-1"
# expect+1: Malformed conditional (${:L:gmtime=-1} != "")
.if ${:L:gmtime=-1} != ""
. error
@@ -67,7 +67,7 @@
# Spaces were allowed before var.c 1.631 from 2020-10-31 21:40:20, not
# because it would make sense but just as a side-effect from using strtoul.
-# expect+2: while evaluating "${:L:gmtime= 1} != """: Invalid time value " 1"
+# expect+2: while evaluating "${:L:gmtime= 1} != """ with value "": Invalid time value " 1"
# expect+1: Malformed conditional (${:L:gmtime= 1} != "")
.if ${:L:gmtime= 1} != ""
. error
@@ -115,7 +115,7 @@
#
# Since var.c 1.631 from 2020-10-31, the overflow is detected and produces a
# parse error.
-# expect+2: while evaluating "${:L:gmtime=10000000000000000000000000000000} != """: Invalid time value "10000000000000000000000000000000"
+# expect+2: while evaluating "${:L:gmtime=10000000000000000000000000000000} != """ with value "": Invalid time value "10000000000000000000000000000000"
# expect+1: Malformed conditional (${:L:gmtime=10000000000000000000000000000000} != "")
.if ${:L:gmtime=10000000000000000000000000000000} != ""
. error
@@ -128,7 +128,7 @@
# stopped after the '=', and the remaining string was parsed for more variable
# modifiers. Because of the unknown modifier 'e' from the 'error', the whole
# variable value was discarded and thus not printed.
-# expect+2: while evaluating "${:L:gmtime=error} != """: Invalid time value "error"
+# expect+2: while evaluating "${:L:gmtime=error} != """ with value "": Invalid time value "error"
# expect+1: Malformed conditional (${:L:gmtime=error} != "")
.if ${:L:gmtime=error} != ""
. error
@@ -139,7 +139,7 @@
# Before var.c 1.1050 from 2023-05-09, the timestamp could be directly
# followed by the next modifier, without a ':' separator. This was the same
# bug as for the ':L' and ':P' modifiers.
-# expect+2: while evaluating variable "%Y": Invalid time value "100000S,1970,bad,"
+# expect+2: while evaluating variable "%Y" with value "%Y": Invalid time value "100000S,1970,bad,"
# expect+1: Malformed conditional (${%Y:L:gmtime=100000S,1970,bad,} != "bad")
.if ${%Y:L:gmtime=100000S,1970,bad,} != "bad"
. error
diff --git a/contrib/bmake/unit-tests/varmod-hash.exp b/contrib/bmake/unit-tests/varmod-hash.exp
index e385c3b3ae11..55f43dbb56d8 100644
--- a/contrib/bmake/unit-tests/varmod-hash.exp
+++ b/contrib/bmake/unit-tests/varmod-hash.exp
@@ -1,9 +1,9 @@
-make: in target "all": while evaluating variable "12345": Unknown modifier "has"
+make: in target "all": while evaluating variable "12345" with value "12345": Unknown modifier "has"
26bb0f5f
12345
-make: in target "all": while evaluating variable "12345": Unknown modifier "hasX"
+make: in target "all": while evaluating variable "12345" with value "12345": Unknown modifier "hasX"
-make: in target "all": while evaluating variable "12345": Unknown modifier "hashed"
+make: in target "all": while evaluating variable "12345" with value "12345": Unknown modifier "hashed"
-exit status 0
+exit status 2
diff --git a/contrib/bmake/unit-tests/varmod-ifelse.exp b/contrib/bmake/unit-tests/varmod-ifelse.exp
index 8b9d41bd2427..c93a9ec71716 100644
--- a/contrib/bmake/unit-tests/varmod-ifelse.exp
+++ b/contrib/bmake/unit-tests/varmod-ifelse.exp
@@ -1,32 +1,32 @@
-make: Bad conditional expression 'bare words == "literal"' before '?bad:bad'
-make: "varmod-ifelse.mk" line 28: Malformed conditional (${${:Ubare words} == "literal":?bad:bad})
-make: Bad conditional expression ' == ""' before '?bad-assign:bad-assign'
-make: Bad conditional expression ' == ""' before '?bad-cond:bad-cond'
-make: "varmod-ifelse.mk" line 46: Malformed conditional (${${UNDEF} == "":?bad-cond:bad-cond})
-make: Bad conditional expression '1 == == 2' before '?yes:no'
-make: "varmod-ifelse.mk" line 69: Malformed conditional (${1 == == 2:?yes:no} != "")
+make: "varmod-ifelse.mk" line 29: while evaluating condition "bare words == "literal"": Bad condition
+make: "varmod-ifelse.mk" line 29: Malformed conditional (${${:Ubare words} == "literal":?bad:bad})
+make: "varmod-ifelse.mk" line 40: while evaluating condition " == """: Bad condition
+make: "varmod-ifelse.mk" line 49: while evaluating condition " == """: Bad condition
+make: "varmod-ifelse.mk" line 49: Malformed conditional (${${UNDEF} == "":?bad-cond:bad-cond})
+make: "varmod-ifelse.mk" line 73: while evaluating condition "1 == == 2": Bad condition
+make: "varmod-ifelse.mk" line 73: Malformed conditional (${1 == == 2:?yes:no} != "")
CondParser_Eval: "${1 == == 2:?yes:no}" != ""
CondParser_Eval: 1 == == 2
Comparing 1.000000 == 0.000000
-make: Bad conditional expression '1 == == 2' before '?yes:no'
+make: "varmod-ifelse.mk" line 97: while evaluating condition "1 == == 2": Bad condition
Comparing "" != ""
-make: "varmod-ifelse.mk" line 96: warning: Oops, the parse error should have been propagated.
+make: "varmod-ifelse.mk" line 101: warning: Oops, the parse error should have been propagated.
CondParser_Eval: ${ ${:U\$}{VAR} == value:?ok:bad} != "ok"
CondParser_Eval: ${VAR} == value
Comparing "value" == "value"
Comparing "ok" != "ok"
-make: "varmod-ifelse.mk" line 158: no.
-make: "varmod-ifelse.mk" line 162: while evaluating variable "string == "literal" || no >= 10": Comparison with '>=' requires both operands 'no' and '10' to be numeric
-make: Bad conditional expression 'string == "literal" || no >= 10' before '?yes:no'
-make: "varmod-ifelse.mk" line 162: .
-make: Bad conditional expression 'string == "literal" && >= 10' before '?yes:no'
-make: "varmod-ifelse.mk" line 169: .
-make: Bad conditional expression 'string == "literal" || >= 10' before '?yes:no'
-make: "varmod-ifelse.mk" line 172: .
-make: "varmod-ifelse.mk" line 180: <true>
-make: "varmod-ifelse.mk" line 183: <false>
-make: Bad conditional expression ' ' before '?true:false'
-make: "varmod-ifelse.mk" line 186: <>
+make: "varmod-ifelse.mk" line 163: no.
+make: "varmod-ifelse.mk" line 167: while evaluating condition "string == "literal" || no >= 10": Comparison with '>=' requires both operands 'no' and '10' to be numeric
+make: "varmod-ifelse.mk" line 167: while evaluating condition "string == "literal" || no >= 10": Bad condition
+make: "varmod-ifelse.mk" line 167: .
+make: "varmod-ifelse.mk" line 174: while evaluating condition "string == "literal" && >= 10": Bad condition
+make: "varmod-ifelse.mk" line 174: .
+make: "varmod-ifelse.mk" line 177: while evaluating condition "string == "literal" || >= 10": Bad condition
+make: "varmod-ifelse.mk" line 177: .
+make: "varmod-ifelse.mk" line 185: <true>
+make: "varmod-ifelse.mk" line 188: <false>
+make: "varmod-ifelse.mk" line 192: while evaluating condition " ": Bad condition
+make: "varmod-ifelse.mk" line 192: <>
CondParser_Eval: 0 && ${1:?${:Uthen0:S,}},,}:${:Uelse0:S,}},,}} != "not evaluated"
CondParser_Eval: 1 && ${0:?${:Uthen1:S,}},,}:${:Uelse1:S,}},,}} != "else1"
CondParser_Eval: 0
@@ -36,16 +36,18 @@ CondParser_Eval: 1
Comparing "then2" != "then2"
CondParser_Eval: ${DELAYED} == "one"
Comparing "two" == "one"
-make: "varmod-ifelse.mk" line 282: no
+make: "varmod-ifelse.mk" line 288: no
CondParser_Eval: ${DELAYED} == "two"
Comparing "two" == "two"
-make: "varmod-ifelse.mk" line 284: yes
+make: "varmod-ifelse.mk" line 290: yes
CondParser_Eval: ${DELAYED} == "one"
Comparing "two" == "one"
-make: "varmod-ifelse.mk" line 287: no
+make: "varmod-ifelse.mk" line 293: no
CondParser_Eval: ${DELAYED} == "two"
Comparing "two" == "two"
-make: "varmod-ifelse.mk" line 290: yes
+make: "varmod-ifelse.mk" line 296: yes
+make: "varmod-ifelse.mk" line 318: while evaluating then-branch of condition "1": while evaluating "${:X-then}:${:X-else}}" with value "": Unknown modifier "X-then"
+make: "varmod-ifelse.mk" line 318: while evaluating else-branch of condition "1": while parsing "${:X-else}}": Unknown modifier "X-else"
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/varmod-ifelse.mk b/contrib/bmake/unit-tests/varmod-ifelse.mk
index 3cb2bdf8e855..292bc076366e 100644
--- a/contrib/bmake/unit-tests/varmod-ifelse.mk
+++ b/contrib/bmake/unit-tests/varmod-ifelse.mk
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-ifelse.mk,v 1.29 2024/06/02 15:31:26 rillig Exp $
+# $NetBSD: varmod-ifelse.mk,v 1.32 2024/07/05 20:01:52 rillig Exp $
#
# Tests for the ${cond:?then:else} variable modifier, which evaluates either
# the then-expression or the else-expression, depending on the condition.
@@ -24,6 +24,7 @@
# Evaluating the variable name lazily would require additional code in
# Var_Parse and ParseVarname, it would be more useful and predictable
# though.
+# expect+2: while evaluating condition "bare words == "literal"": Bad condition
# expect+1: Malformed conditional (${${:Ubare words} == "literal":?bad:bad})
.if ${${:Ubare words} == "literal":?bad:bad}
. error
@@ -35,6 +36,7 @@
# Because of the early expansion, the whole condition evaluates to
# ' == ""' though, which cannot be parsed because the left-hand side looks
# empty.
+# expect+1: while evaluating condition " == """: Bad condition
COND:= ${${UNDEF} == "":?bad-assign:bad-assign}
# In a condition, undefined variables generate a "Malformed conditional"
@@ -42,6 +44,7 @@ COND:= ${${UNDEF} == "":?bad-assign:bad-assign}
# "Undefined variable" error message is generated.
# The difference to the ':=' variable assignment is the additional
# "Malformed conditional" error message.
+# expect+2: while evaluating condition " == """: Bad condition
# expect+1: Malformed conditional (${${UNDEF} == "":?bad-cond:bad-cond})
.if ${${UNDEF} == "":?bad-cond:bad-cond}
. error
@@ -65,6 +68,7 @@ COND:= ${${UNDEF} == "":?bad-assign:bad-assign}
# conditional therefore returns a parse error from Var_Parse, and this parse
# error propagates to CondEvalExpression, where the "Malformed conditional"
# comes from.
+# expect+2: while evaluating condition "1 == == 2": Bad condition
# expect+1: Malformed conditional (${1 == == 2:?yes:no} != "")
.if ${1 == == 2:?yes:no} != ""
. error
@@ -89,6 +93,7 @@ COND:= ${${UNDEF} == "":?bad-assign:bad-assign}
# condition should be detected as being malformed before any comparison is
# done since there is no well-formed comparison in the condition at all.
.MAKEFLAGS: -dc
+# expect+1: while evaluating condition "1 == == 2": Bad condition
.if "${1 == == 2:?yes:no}" != ""
. error
.else
@@ -156,18 +161,18 @@ STRING= string
NUMBER= no # not really a number
# expect+1: no.
.info ${${STRING} == "literal" && ${NUMBER} >= 10:?yes:no}.
-# expect+3: while evaluating variable "string == "literal" || no >= 10": Comparison with '>=' requires both operands 'no' and '10' to be numeric
-# expect: make: Bad conditional expression 'string == "literal" || no >= 10' before '?yes:no'
+# expect+3: while evaluating condition "string == "literal" || no >= 10": Comparison with '>=' requires both operands 'no' and '10' to be numeric
+# expect+2: while evaluating condition "string == "literal" || no >= 10": Bad condition
# expect+1: .
.info ${${STRING} == "literal" || ${NUMBER} >= 10:?yes:no}.
# The following situation occasionally occurs with MKINET6 or similar
# variables.
NUMBER= # empty, not really a number either
-# expect: make: Bad conditional expression 'string == "literal" && >= 10' before '?yes:no'
+# expect+2: while evaluating condition "string == "literal" && >= 10": Bad condition
# expect+1: .
.info ${${STRING} == "literal" && ${NUMBER} >= 10:?yes:no}.
-# expect: make: Bad conditional expression 'string == "literal" || >= 10' before '?yes:no'
+# expect+2: while evaluating condition "string == "literal" || >= 10": Bad condition
# expect+1: .
.info ${${STRING} == "literal" || ${NUMBER} >= 10:?yes:no}.
@@ -182,6 +187,7 @@ EMPTY= # empty
# expect+1: <false>
.info <${${ASTERISK} :?true:false}>
# syntax error since the condition is completely blank.
+# expect+2: while evaluating condition " ": Bad condition
# expect+1: <>
.info <${${EMPTY} :?true:false}>
@@ -305,3 +311,9 @@ BOTH= <${YES}> <${NO}>
.if ${BOTH} != "<yes> <no>"
. error
.endif
+
+
+# expect+2: while evaluating then-branch of condition "1": while evaluating "${:X-then}:${:X-else}}" with value "": Unknown modifier "X-then"
+# expect+1: while evaluating else-branch of condition "1": while parsing "${:X-else}}": Unknown modifier "X-else"
+.if ${1:?${:X-then}:${:X-else}}
+.endif
diff --git a/contrib/bmake/unit-tests/varmod-indirect.exp b/contrib/bmake/unit-tests/varmod-indirect.exp
index 376beb8edef9..360cec21e291 100644
--- a/contrib/bmake/unit-tests/varmod-indirect.exp
+++ b/contrib/bmake/unit-tests/varmod-indirect.exp
@@ -1,5 +1,5 @@
-make: "varmod-indirect.mk" line 19: while evaluating variable "value": Unknown modifier "${"
-make: "varmod-indirect.mk" line 52: while evaluating variable "value": Unknown modifier "${"
+make: "varmod-indirect.mk" line 19: while evaluating variable "value" with value "value": Unknown modifier "${"
+make: "varmod-indirect.mk" line 52: while evaluating variable "value" with value "value": Unknown modifier "${"
make: "varmod-indirect.mk" line 54: warning: FIXME: this expression should have resulted in a parse error rather than returning the unparsed portion of the expression.
make: "varmod-indirect.mk" line 143: before
make: "varmod-indirect.mk" line 143: after
@@ -7,7 +7,7 @@ make: "varmod-indirect.mk" line 151: before
make: "varmod-indirect.mk" line 151: after
make: "varmod-indirect.mk" line 159: before
make: "varmod-indirect.mk" line 159: after
-make: "varmod-indirect.mk" line 164: while evaluating variable "UNDEF": Unknown modifier "Z"
+make: "varmod-indirect.mk" line 164: while evaluating variable "UNDEF" with value "": Unknown modifier "Z"
make: "varmod-indirect.mk" line 167: before
make: "varmod-indirect.mk" line 167: after
Parsing line 176: _:= before ${UNDEF} after
@@ -31,7 +31,7 @@ Parsing line 195: _:= before ${UNDEF:${:UZ}} after
Var_Parse: ${UNDEF:${:UZ}} after (eval-keep-dollar-and-undefined)
Indirect modifier "Z" from "${:UZ}"
Evaluating modifier ${UNDEF:Z} on value "" (eval-keep-dollar-and-undefined, undefined)
-make: "varmod-indirect.mk" line 195: while evaluating variable "UNDEF": Unknown modifier "Z"
+make: "varmod-indirect.mk" line 195: while evaluating variable "UNDEF" with value "": Unknown modifier "Z"
Result of ${UNDEF:Z} is error (eval-keep-dollar-and-undefined, undefined)
Global: _ = before ${UNDEF:Z} after
Parsing line 197: .MAKEFLAGS: -d0
diff --git a/contrib/bmake/unit-tests/varmod-indirect.mk b/contrib/bmake/unit-tests/varmod-indirect.mk
index 869231d47ebc..a58cb870aac8 100644
--- a/contrib/bmake/unit-tests/varmod-indirect.mk
+++ b/contrib/bmake/unit-tests/varmod-indirect.mk
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-indirect.mk,v 1.19 2024/04/20 10:18:55 rillig Exp $
+# $NetBSD: varmod-indirect.mk,v 1.20 2024/07/04 17:47:54 rillig Exp $
#
# Tests for indirect variable modifiers, such as in ${VAR:${M_modifiers}}.
# These can be used for very basic purposes like converting a string to either
@@ -15,7 +15,7 @@
# The following expression generates a parse error since its indirect
# modifier contains more than a sole expression.
#
-# expect+1: while evaluating variable "value": Unknown modifier "${"
+# expect+1: while evaluating variable "value" with value "value": Unknown modifier "${"
.if ${value:L:${:US}${:U,value,replacement,}} != "S,value,replacement,}"
. warning unexpected
.endif
@@ -47,7 +47,7 @@
# error. Because of this parse error, this feature cannot be used reasonably
# in practice.
#
-# expect+2: while evaluating variable "value": Unknown modifier "${"
+# expect+2: while evaluating variable "value" with value "value": Unknown modifier "${"
#.MAKEFLAGS: -dvc
.if ${value:L:${:UM*}S,value,replaced,} == "M*S,value,replaced,}"
# expect+1: warning: FIXME: this expression should have resulted in a parse error rather than returning the unparsed portion of the expression.
@@ -160,7 +160,7 @@ M_NoPrimes= ${PRIMES:${M_ListToSkip}}
.endfor
# An error in an indirect modifier.
-# expect+1: while evaluating variable "UNDEF": Unknown modifier "Z"
+# expect+1: while evaluating variable "UNDEF" with value "": Unknown modifier "Z"
.for var in before ${UNDEF:${:UZ}} after
# expect+2: before
# expect+1: after
@@ -191,7 +191,7 @@ _:= before ${UNDEF:${:U}} after
# XXX: This expands to ${UNDEF:Z}, which will behave differently if the
# variable '_' is used in a context where the expression ${_} is
# parsed but not evaluated.
-# expect+1: while evaluating variable "UNDEF": Unknown modifier "Z"
+# expect+1: while evaluating variable "UNDEF" with value "": Unknown modifier "Z"
_:= before ${UNDEF:${:UZ}} after
.MAKEFLAGS: -d0
diff --git a/contrib/bmake/unit-tests/varmod-localtime.exp b/contrib/bmake/unit-tests/varmod-localtime.exp
index 1bb547289edd..0183ae6dcc2f 100644
--- a/contrib/bmake/unit-tests/varmod-localtime.exp
+++ b/contrib/bmake/unit-tests/varmod-localtime.exp
@@ -1,13 +1,13 @@
-make: "varmod-localtime.mk" line 61: while evaluating "${:L:localtime=-1} != """: Invalid time value "-1"
+make: "varmod-localtime.mk" line 61: while evaluating "${:L:localtime=-1} != """ with value "": Invalid time value "-1"
make: "varmod-localtime.mk" line 61: Malformed conditional (${:L:localtime=-1} != "")
-make: "varmod-localtime.mk" line 72: while evaluating "${:L:localtime= 1} != """: Invalid time value " 1"
+make: "varmod-localtime.mk" line 72: while evaluating "${:L:localtime= 1} != """ with value "": Invalid time value " 1"
make: "varmod-localtime.mk" line 72: Malformed conditional (${:L:localtime= 1} != "")
-make: "varmod-localtime.mk" line 120: while evaluating "${:L:localtime=10000000000000000000000000000000} != """: Invalid time value "10000000000000000000000000000000"
+make: "varmod-localtime.mk" line 120: while evaluating "${:L:localtime=10000000000000000000000000000000} != """ with value "": Invalid time value "10000000000000000000000000000000"
make: "varmod-localtime.mk" line 120: Malformed conditional (${:L:localtime=10000000000000000000000000000000} != "")
-make: "varmod-localtime.mk" line 133: while evaluating "${:L:localtime=error} != """: Invalid time value "error"
+make: "varmod-localtime.mk" line 133: while evaluating "${:L:localtime=error} != """ with value "": Invalid time value "error"
make: "varmod-localtime.mk" line 133: Malformed conditional (${:L:localtime=error} != "")
-make: "varmod-localtime.mk" line 144: while evaluating variable "%Y": Invalid time value "100000S,1970,bad,"
+make: "varmod-localtime.mk" line 144: while evaluating variable "%Y" with value "%Y": Invalid time value "100000S,1970,bad,"
make: "varmod-localtime.mk" line 144: Malformed conditional (${%Y:L:localtime=100000S,1970,bad,} != "bad")
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/varmod-localtime.mk b/contrib/bmake/unit-tests/varmod-localtime.mk
index 233e556e0c77..b6295965ddb8 100644
--- a/contrib/bmake/unit-tests/varmod-localtime.mk
+++ b/contrib/bmake/unit-tests/varmod-localtime.mk
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-localtime.mk,v 1.15 2024/04/20 10:18:55 rillig Exp $
+# $NetBSD: varmod-localtime.mk,v 1.17 2024/07/05 19:47:22 rillig Exp $
#
# Tests for the :localtime variable modifier, which formats a timestamp
# using strftime(3) in local time.
@@ -56,7 +56,7 @@
# 1970. Going back 50 years in the past is not a practical use case for
# make. Therefore, since var.c 1.631, negative time stamps produce a
# parse error.
-# expect+2: while evaluating "${:L:localtime=-1} != """: Invalid time value "-1"
+# expect+2: while evaluating "${:L:localtime=-1} != """ with value "": Invalid time value "-1"
# expect+1: Malformed conditional (${:L:localtime=-1} != "")
.if ${:L:localtime=-1} != ""
. error
@@ -67,7 +67,7 @@
# Spaces were allowed before var.c 1.631 from 2020-10-31 21:40:20, not
# because it would make sense but just as a side-effect from using strtoul.
-# expect+2: while evaluating "${:L:localtime= 1} != """: Invalid time value " 1"
+# expect+2: while evaluating "${:L:localtime= 1} != """ with value "": Invalid time value " 1"
# expect+1: Malformed conditional (${:L:localtime= 1} != "")
.if ${:L:localtime= 1} != ""
. error
@@ -115,7 +115,7 @@
#
# Since var.c 1.631 from 2020-10-31, the overflow is detected and produces a
# parse error.
-# expect+2: while evaluating "${:L:localtime=10000000000000000000000000000000} != """: Invalid time value "10000000000000000000000000000000"
+# expect+2: while evaluating "${:L:localtime=10000000000000000000000000000000} != """ with value "": Invalid time value "10000000000000000000000000000000"
# expect+1: Malformed conditional (${:L:localtime=10000000000000000000000000000000} != "")
.if ${:L:localtime=10000000000000000000000000000000} != ""
. error
@@ -128,7 +128,7 @@
# stopped after the '=', and the remaining string was parsed for more variable
# modifiers. Because of the unknown modifier 'e' from the 'error', the whole
# variable value was discarded and thus not printed.
-# expect+2: while evaluating "${:L:localtime=error} != """: Invalid time value "error"
+# expect+2: while evaluating "${:L:localtime=error} != """ with value "": Invalid time value "error"
# expect+1: Malformed conditional (${:L:localtime=error} != "")
.if ${:L:localtime=error} != ""
. error
@@ -139,7 +139,7 @@
# Before var.c 1.1050 from 2023-05-09, the timestamp could be directly
# followed by the next modifier, without a ':' separator. This was the same
# bug as for the ':L' and ':P' modifiers.
-# expect+2: while evaluating variable "%Y": Invalid time value "100000S,1970,bad,"
+# expect+2: while evaluating variable "%Y" with value "%Y": Invalid time value "100000S,1970,bad,"
# expect+1: Malformed conditional (${%Y:L:localtime=100000S,1970,bad,} != "bad")
.if ${%Y:L:localtime=100000S,1970,bad,} != "bad"
. error
diff --git a/contrib/bmake/unit-tests/varmod-loop-delete.exp b/contrib/bmake/unit-tests/varmod-loop-delete.exp
index 5c508a7a6420..eb3124a9adfd 100644
--- a/contrib/bmake/unit-tests/varmod-loop-delete.exp
+++ b/contrib/bmake/unit-tests/varmod-loop-delete.exp
@@ -1,4 +1,4 @@
-make: "varmod-loop-delete.mk" line 20: while evaluating variable "VAR": while evaluating "${:U:@VAR@@} rest of the value": Cannot delete variable "VAR" while it is used
+make: "varmod-loop-delete.mk" line 20: while evaluating variable "VAR" with value "${:U:@VAR@@} rest of the value": while evaluating "${:U:@VAR@@} rest of the value" with value "": Cannot delete variable "VAR" while it is used
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/varmod-loop-delete.mk b/contrib/bmake/unit-tests/varmod-loop-delete.mk
index cf0611991194..5a4b273afcaf 100644
--- a/contrib/bmake/unit-tests/varmod-loop-delete.mk
+++ b/contrib/bmake/unit-tests/varmod-loop-delete.mk
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-loop-delete.mk,v 1.4 2024/04/20 10:18:55 rillig Exp $
+# $NetBSD: varmod-loop-delete.mk,v 1.6 2024/07/05 19:47:22 rillig Exp $
#
# Tests for the variable modifier ':@', which as a side effect allows to
# delete an arbitrary variable.
@@ -16,7 +16,7 @@ VAR= ${:U:@VAR@@} rest of the value
# In an assignment, the scope is 'Global'. Since the variable 'VAR' is
# defined in the global scope, it deletes itself.
-# expect+1: while evaluating variable "VAR": while evaluating "${:U:@VAR@@} rest of the value": Cannot delete variable "VAR" while it is used
+# expect+1: while evaluating variable "VAR" with value "${:U:@VAR@@} rest of the value": while evaluating "${:U:@VAR@@} rest of the value" with value "": Cannot delete variable "VAR" while it is used
EVAL:= ${VAR}
.if ${EVAL} != " rest of the value"
. error
diff --git a/contrib/bmake/unit-tests/varmod-loop-varname.exp b/contrib/bmake/unit-tests/varmod-loop-varname.exp
index cefd82093e29..8ad1842c4d09 100644
--- a/contrib/bmake/unit-tests/varmod-loop-varname.exp
+++ b/contrib/bmake/unit-tests/varmod-loop-varname.exp
@@ -1,11 +1,11 @@
-make: "varmod-loop-varname.mk" line 18: while evaluating "${:Uone two three:@${:Ubar:S,b,v,}@+${var}+@} != "+one+ +two+ +three+"": In the :@ modifier, the variable name "${:Ubar:S,b,v,}" must not contain a dollar
+make: "varmod-loop-varname.mk" line 18: while evaluating "${:Uone two three:@${:Ubar:S,b,v,}@+${var}+@} != "+one+ +two+ +three+"" with value "one two three": In the :@ modifier, the variable name "${:Ubar:S,b,v,}" must not contain a dollar
make: "varmod-loop-varname.mk" line 18: Malformed conditional (${:Uone two three:@${:Ubar:S,b,v,}@+${var}+@} != "+one+ +two+ +three+")
-make: "varmod-loop-varname.mk" line 89: while evaluating variable "1 2 3": In the :@ modifier, the variable name "v$" must not contain a dollar
+make: "varmod-loop-varname.mk" line 89: while evaluating variable "1 2 3" with value "1 2 3": In the :@ modifier, the variable name "v$" must not contain a dollar
make: "varmod-loop-varname.mk" line 89: Malformed conditional (${1 2 3:L:@v$@($v)@} != "(1) (2) (3)")
-make: "varmod-loop-varname.mk" line 96: while evaluating variable "1 2 3": In the :@ modifier, the variable name "v$$" must not contain a dollar
+make: "varmod-loop-varname.mk" line 96: while evaluating variable "1 2 3" with value "1 2 3": In the :@ modifier, the variable name "v$$" must not contain a dollar
make: "varmod-loop-varname.mk" line 96: Malformed conditional (${1 2 3:L:@v$$@($v)@} != "() () ()")
-make: "varmod-loop-varname.mk" line 103: while evaluating variable "1 2 3": In the :@ modifier, the variable name "v$$$" must not contain a dollar
+make: "varmod-loop-varname.mk" line 103: while evaluating variable "1 2 3" with value "1 2 3": In the :@ modifier, the variable name "v$$$" must not contain a dollar
make: "varmod-loop-varname.mk" line 103: Malformed conditional (${1 2 3:L:@v$$$@($v)@} != "() () ()")
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/varmod-loop-varname.mk b/contrib/bmake/unit-tests/varmod-loop-varname.mk
index 7abf8610911a..a41d1d30d019 100644
--- a/contrib/bmake/unit-tests/varmod-loop-varname.mk
+++ b/contrib/bmake/unit-tests/varmod-loop-varname.mk
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-loop-varname.mk,v 1.7 2024/04/20 10:18:55 rillig Exp $
+# $NetBSD: varmod-loop-varname.mk,v 1.9 2024/07/05 19:47:22 rillig Exp $
#
# Tests for the first part of the variable modifier ':@var@...@', which
# contains the variable name to use during the loop.
@@ -13,7 +13,7 @@
# dynamically. There was no practical use-case for this.
# Since var.c 1.907 from 2021-04-04, a '$' is no longer allowed in the
# variable name.
-# expect+2: while evaluating "${:Uone two three:@${:Ubar:S,b,v,}@+${var}+@} != "+one+ +two+ +three+"": In the :@ modifier, the variable name "${:Ubar:S,b,v,}" must not contain a dollar
+# expect+2: while evaluating "${:Uone two three:@${:Ubar:S,b,v,}@+${var}+@} != "+one+ +two+ +three+"" with value "one two three": In the :@ modifier, the variable name "${:Ubar:S,b,v,}" must not contain a dollar
# expect+1: Malformed conditional (${:Uone two three:@${:Ubar:S,b,v,}@+${var}+@} != "+one+ +two+ +three+")
.if ${:Uone two three:@${:Ubar:S,b,v,}@+${var}+@} != "+one+ +two+ +three+"
. error
@@ -84,21 +84,21 @@ RES3= 3
# There's no point in allowing a dollar sign in that position.
# Since var.c 1.907 from 2021-04-04, a '$' is no longer allowed in the
# variable name.
-# expect+2: while evaluating variable "1 2 3": In the :@ modifier, the variable name "v$" must not contain a dollar
+# expect+2: while evaluating variable "1 2 3" with value "1 2 3": In the :@ modifier, the variable name "v$" must not contain a dollar
# expect+1: Malformed conditional (${1 2 3:L:@v$@($v)@} != "(1) (2) (3)")
.if ${1 2 3:L:@v$@($v)@} != "(1) (2) (3)"
. error
.else
. error
.endif
-# expect+2: while evaluating variable "1 2 3": In the :@ modifier, the variable name "v$$" must not contain a dollar
+# expect+2: while evaluating variable "1 2 3" with value "1 2 3": In the :@ modifier, the variable name "v$$" must not contain a dollar
# expect+1: Malformed conditional (${1 2 3:L:@v$$@($v)@} != "() () ()")
.if ${1 2 3:L:@v$$@($v)@} != "() () ()"
. error
.else
. error
.endif
-# expect+2: while evaluating variable "1 2 3": In the :@ modifier, the variable name "v$$$" must not contain a dollar
+# expect+2: while evaluating variable "1 2 3" with value "1 2 3": In the :@ modifier, the variable name "v$$$" must not contain a dollar
# expect+1: Malformed conditional (${1 2 3:L:@v$$$@($v)@} != "() () ()")
.if ${1 2 3:L:@v$$$@($v)@} != "() () ()"
. error
diff --git a/contrib/bmake/unit-tests/varmod-match-escape.exp b/contrib/bmake/unit-tests/varmod-match-escape.exp
index cf5aeab5b39d..e15445de356b 100755
--- a/contrib/bmake/unit-tests/varmod-match-escape.exp
+++ b/contrib/bmake/unit-tests/varmod-match-escape.exp
@@ -33,9 +33,11 @@ Comparing ":" != "::"
make: "varmod-match-escape.mk" line 43: warning: XXX: Oops
Global: .MAKEFLAGS = -r -k -d cv -d
Global: .MAKEFLAGS = -r -k -d cv -d 0
-make: "varmod-match-escape.mk" line 69: while evaluating "${:U\$:M\$} != """: Dollar followed by nothing
-make: "varmod-match-escape.mk" line 110: warning: while evaluating variable "WORDS": Unfinished character list in pattern '[A-]' of modifier ':M'
-make: "varmod-match-escape.mk" line 110: warning: while evaluating variable "WORDS": Unfinished character list in pattern '[^A-]' of modifier ':M'
+make: "varmod-match-escape.mk" line 69: while evaluating "${:U\$:M\$} != """ with value "$": Dollar followed by nothing
+make: "varmod-match-escape.mk" line 110: while evaluating variable "WORDS" with value "A A] A]] B B] B]] ] ]] ]]] a a] a]]": Unfinished character list in pattern '[A-]' of modifier ':M'
+ in .for loop from varmod-match-escape.mk:107 with pattern = [A-]
+make: "varmod-match-escape.mk" line 110: while evaluating variable "WORDS" with value "A A] A]] B B] B]] ] ]] ]]] a a] a]]": Unfinished character list in pattern '[^A-]' of modifier ':M'
+ in .for loop from varmod-match-escape.mk:107 with pattern = [^A-]
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/varmod-match-escape.mk b/contrib/bmake/unit-tests/varmod-match-escape.mk
index fba42ef03054..eb5730d3e5a1 100755
--- a/contrib/bmake/unit-tests/varmod-match-escape.mk
+++ b/contrib/bmake/unit-tests/varmod-match-escape.mk
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-match-escape.mk,v 1.14 2024/06/15 19:43:56 rillig Exp $
+# $NetBSD: varmod-match-escape.mk,v 1.17 2024/07/09 17:07:23 rillig Exp $
#
# As of 2020-08-01, the :M and :N modifiers interpret backslashes differently,
# depending on whether there was an expression somewhere before the
@@ -65,7 +65,7 @@ VALUES= : :: :\:
# In lint mode, the case of a lonely '$' is covered with an error message.
.MAKEFLAGS: -dL
-# expect+1: while evaluating "${:U\$:M\$} != """: Dollar followed by nothing
+# expect+1: while evaluating "${:U\$:M\$} != """ with value "$": Dollar followed by nothing
.if ${:U\$:M\$} != ""
. error
.endif
@@ -105,8 +105,8 @@ EXP.[^A-]]= a
EXP.[^A-]]]= a]
.for pattern in [A-] [A-]] [A-]]] [^A-] [^A-]] [^A-]]]
-# expect+2: warning: while evaluating variable "WORDS": Unfinished character list in pattern '[A-]' of modifier ':M'
-# expect+1: warning: while evaluating variable "WORDS": Unfinished character list in pattern '[^A-]' of modifier ':M'
+# expect+2: while evaluating variable "WORDS" with value "A A] A]] B B] B]] ] ]] ]]] a a] a]]": Unfinished character list in pattern '[A-]' of modifier ':M'
+# expect+1: while evaluating variable "WORDS" with value "A A] A]] B B] B]] ] ]] ]]] a a] a]]": Unfinished character list in pattern '[^A-]' of modifier ':M'
. if ${WORDS:M${pattern}} != ${EXP.${pattern}}
. warning ${pattern}: ${WORDS:M${pattern}} != ${EXP.${pattern}}
. endif
diff --git a/contrib/bmake/unit-tests/varmod-match.exp b/contrib/bmake/unit-tests/varmod-match.exp
index ddf02c561e65..377a43082fed 100644
--- a/contrib/bmake/unit-tests/varmod-match.exp
+++ b/contrib/bmake/unit-tests/varmod-match.exp
@@ -1,13 +1,13 @@
-make: "varmod-match.mk" line 289: warning: while evaluating variable "WORDS": Unfinished character list in pattern 'a[' of modifier ':M'
-make: "varmod-match.mk" line 297: warning: while evaluating variable "WORDS": Unfinished character list in pattern 'a[^' of modifier ':M'
-make: "varmod-match.mk" line 305: warning: while evaluating variable "WORDS": Unfinished character list in pattern '[-x1-3' of modifier ':M'
-make: "varmod-match.mk" line 313: warning: while evaluating variable "WORDS": Unfinished character list in pattern '*[-x1-3' of modifier ':M'
-make: "varmod-match.mk" line 322: warning: while evaluating variable "WORDS": Unfinished character list in pattern '[^-x1-3' of modifier ':M'
-make: "varmod-match.mk" line 336: warning: while evaluating variable "WORDS": Unfinished character list in pattern '?[\' of modifier ':M'
-make: "varmod-match.mk" line 344: warning: while evaluating variable "WORDS": Unfinished character range in pattern '[x-' of modifier ':M'
-make: "varmod-match.mk" line 356: warning: while evaluating variable "WORDS": Unfinished character range in pattern '[^x-' of modifier ':M'
-make: "varmod-match.mk" line 364: warning: while evaluating variable " : :: ": Unfinished character list in pattern '[' of modifier ':M'
-make: "varmod-match.mk" line 364: while evaluating variable " : :: ": Unknown modifier "]"
+make: "varmod-match.mk" line 289: while evaluating variable "WORDS" with value "a a[": Unfinished character list in pattern 'a[' of modifier ':M'
+make: "varmod-match.mk" line 297: while evaluating variable "WORDS" with value "a a[ aX": Unfinished character list in pattern 'a[^' of modifier ':M'
+make: "varmod-match.mk" line 305: while evaluating variable "WORDS" with value "- + x xx 0 1 2 3 4 [x1-3": Unfinished character list in pattern '[-x1-3' of modifier ':M'
+make: "varmod-match.mk" line 313: while evaluating variable "WORDS" with value "- + x xx 0 1 2 3 4 00 01 10 11 000 001 010 011 100 101 110 111 [x1-3": Unfinished character list in pattern '*[-x1-3' of modifier ':M'
+make: "varmod-match.mk" line 322: while evaluating variable "WORDS" with value "- + x xx 0 1 2 3 4 [x1-3": Unfinished character list in pattern '[^-x1-3' of modifier ':M'
+make: "varmod-match.mk" line 336: while evaluating variable "WORDS" with value "\\ \a x\": Unfinished character list in pattern '?[\' of modifier ':M'
+make: "varmod-match.mk" line 344: while evaluating variable "WORDS" with value "[x- x x- y": Unfinished character range in pattern '[x-' of modifier ':M'
+make: "varmod-match.mk" line 356: while evaluating variable "WORDS" with value "[x- x x- y yyyyy": Unfinished character range in pattern '[^x-' of modifier ':M'
+make: "varmod-match.mk" line 364: while evaluating variable " : :: " with value " : :: ": Unfinished character list in pattern '[' of modifier ':M'
+make: "varmod-match.mk" line 364: while evaluating variable " : :: " with value "": Unknown modifier "]"
make: "varmod-match.mk" line 364: Malformed conditional (${ ${:U\:} ${:U\:\:} :L:M[:]} != ":")
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
diff --git a/contrib/bmake/unit-tests/varmod-match.mk b/contrib/bmake/unit-tests/varmod-match.mk
index 2cdd38f04d03..ce2bbab7eb53 100644
--- a/contrib/bmake/unit-tests/varmod-match.mk
+++ b/contrib/bmake/unit-tests/varmod-match.mk
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-match.mk,v 1.24 2024/06/15 19:43:56 rillig Exp $
+# $NetBSD: varmod-match.mk,v 1.26 2024/07/09 17:07:23 rillig Exp $
#
# Tests for the ':M' modifier, which keeps only those words that match the
# given pattern.
@@ -285,7 +285,7 @@ ${:U*}= asterisk
# [ Incomplete empty character list, never matches.
WORDS= a a[
-# expect+1: warning: while evaluating variable "WORDS": Unfinished character list in pattern 'a[' of modifier ':M'
+# expect+1: while evaluating variable "WORDS" with value "a a[": Unfinished character list in pattern 'a[' of modifier ':M'
.if ${WORDS:Ma[} != ""
. error
.endif
@@ -293,7 +293,7 @@ WORDS= a a[
# [^ Incomplete negated empty character list, matches any single
# character.
WORDS= a a[ aX
-# expect+1: warning: while evaluating variable "WORDS": Unfinished character list in pattern 'a[^' of modifier ':M'
+# expect+1: while evaluating variable "WORDS" with value "a a[ aX": Unfinished character list in pattern 'a[^' of modifier ':M'
.if ${WORDS:Ma[^} != "a[ aX"
. error
.endif
@@ -301,7 +301,7 @@ WORDS= a a[ aX
# [-x1-3 Incomplete character list, matches those elements that can be
# parsed without lookahead.
WORDS= - + x xx 0 1 2 3 4 [x1-3
-# expect+1: warning: while evaluating variable "WORDS": Unfinished character list in pattern '[-x1-3' of modifier ':M'
+# expect+1: while evaluating variable "WORDS" with value "- + x xx 0 1 2 3 4 [x1-3": Unfinished character list in pattern '[-x1-3' of modifier ':M'
.if ${WORDS:M[-x1-3} != "- x 1 2 3"
. error
.endif
@@ -309,7 +309,7 @@ WORDS= - + x xx 0 1 2 3 4 [x1-3
# *[-x1-3 Incomplete character list after a wildcard, matches those
# words that end with one of the characters from the list.
WORDS= - + x xx 0 1 2 3 4 00 01 10 11 000 001 010 011 100 101 110 111 [x1-3
-# expect+1: warning: while evaluating variable "WORDS": Unfinished character list in pattern '*[-x1-3' of modifier ':M'
+# expect+1: while evaluating variable "WORDS" with value "- + x xx 0 1 2 3 4 00 01 10 11 000 001 010 011 100 101 110 111 [x1-3": Unfinished character list in pattern '*[-x1-3' of modifier ':M'
.if ${WORDS:M*[-x1-3} != "- x xx 1 2 3 01 11 001 011 101 111 [x1-3"
. warning ${WORDS:M*[-x1-3}
.endif
@@ -318,7 +318,7 @@ WORDS= - + x xx 0 1 2 3 4 00 01 10 11 000 001 010 011 100 101 110 111 [x1-3
# Incomplete negated character list, matches any character
# except those elements that can be parsed without lookahead.
WORDS= - + x xx 0 1 2 3 4 [x1-3
-# expect+1: warning: while evaluating variable "WORDS": Unfinished character list in pattern '[^-x1-3' of modifier ':M'
+# expect+1: while evaluating variable "WORDS" with value "- + x xx 0 1 2 3 4 [x1-3": Unfinished character list in pattern '[^-x1-3' of modifier ':M'
.if ${WORDS:M[^-x1-3} != "+ 0 4"
. error
.endif
@@ -332,7 +332,7 @@ WORDS= - + x xx 0 1 2 3 4 [x1-3
# '\', as there is no following space that could be escaped.
WORDS= \\ \a ${:Ux\\}
PATTERN= ${:U?[\\}
-# expect+1: warning: while evaluating variable "WORDS": Unfinished character list in pattern '?[\' of modifier ':M'
+# expect+1: while evaluating variable "WORDS" with value "\\ \a x\": Unfinished character list in pattern '?[\' of modifier ':M'
.if ${WORDS:M${PATTERN}} != "\\\\ x\\"
. error
.endif
@@ -340,7 +340,7 @@ PATTERN= ${:U?[\\}
# [x- Incomplete character list containing an incomplete character
# range, matches only the 'x'.
WORDS= [x- x x- y
-# expect+1: warning: while evaluating variable "WORDS": Unfinished character range in pattern '[x-' of modifier ':M'
+# expect+1: while evaluating variable "WORDS" with value "[x- x x- y": Unfinished character range in pattern '[x-' of modifier ':M'
.if ${WORDS:M[x-} != "x"
. error
.endif
@@ -352,14 +352,14 @@ WORDS= [x- x x- y
# XXX: Even matches strings that are longer than a single
# character.
WORDS= [x- x x- y yyyyy
-# expect+1: warning: while evaluating variable "WORDS": Unfinished character range in pattern '[^x-' of modifier ':M'
+# expect+1: while evaluating variable "WORDS" with value "[x- x x- y yyyyy": Unfinished character range in pattern '[^x-' of modifier ':M'
.if ${WORDS:M[^x-} != "[x- y yyyyy"
. error
.endif
# [:] matches never since the ':' starts the next modifier
-# expect+3: warning: while evaluating variable " : :: ": Unfinished character list in pattern '[' of modifier ':M'
-# expect+2: while evaluating variable " : :: ": Unknown modifier "]"
+# expect+3: while evaluating variable " : :: " with value " : :: ": Unfinished character list in pattern '[' of modifier ':M'
+# expect+2: while evaluating variable " : :: " with value "": Unknown modifier "]"
# expect+1: Malformed conditional (${ ${:U\:} ${:U\:\:} :L:M[:]} != ":")
.if ${ ${:U\:} ${:U\:\:} :L:M[:]} != ":"
. error
diff --git a/contrib/bmake/unit-tests/varmod-mtime.exp b/contrib/bmake/unit-tests/varmod-mtime.exp
index 87f405573437..153b7ff79f08 100644
--- a/contrib/bmake/unit-tests/varmod-mtime.exp
+++ b/contrib/bmake/unit-tests/varmod-mtime.exp
@@ -1,13 +1,13 @@
-make: "varmod-mtime.mk" line 47: while evaluating variable "no/such/file": Invalid argument '123x' for modifier ':mtime'
+make: "varmod-mtime.mk" line 47: while evaluating variable "no/such/file" with value "no/such/file": Invalid argument '123x' for modifier ':mtime'
make: "varmod-mtime.mk" line 47: Malformed conditional (${no/such/file:L:mtime=123x})
-make: "varmod-mtime.mk" line 70: while evaluating variable "no/such/file1 no/such/file2": Cannot determine mtime for 'no/such/file1': <ENOENT>
-make: "varmod-mtime.mk" line 70: while evaluating variable "no/such/file1 no/such/file2": Cannot determine mtime for 'no/such/file2': <ENOENT>
+make: "varmod-mtime.mk" line 70: while evaluating variable "no/such/file1 no/such/file2" with value "no/such/file1 no/such/file2": Cannot determine mtime for 'no/such/file1': <ENOENT>
+make: "varmod-mtime.mk" line 70: while evaluating variable "no/such/file1 no/such/file2" with value "no/such/file1 no/such/file2": Cannot determine mtime for 'no/such/file2': <ENOENT>
make: "varmod-mtime.mk" line 70: Malformed conditional (${no/such/file1 no/such/file2:L:mtime=error})
-make: "varmod-mtime.mk" line 81: while evaluating variable "MAKEFILE": Invalid argument 'errorhandler-no' for modifier ':mtime'
+make: "varmod-mtime.mk" line 81: while evaluating variable "MAKEFILE" with value "varmod-mtime.mk": Invalid argument 'errorhandler-no' for modifier ':mtime'
make: "varmod-mtime.mk" line 81: Malformed conditional (${MAKEFILE:mtime=errorhandler-no} > 0)
-make: "varmod-mtime.mk" line 90: while evaluating variable "MAKEFILE": Invalid argument 'warn' for modifier ':mtime'
+make: "varmod-mtime.mk" line 90: while evaluating variable "MAKEFILE" with value "varmod-mtime.mk": Invalid argument 'warn' for modifier ':mtime'
make: "varmod-mtime.mk" line 90: Malformed conditional (${MAKEFILE:mtime=warn} > 0)
-make: "varmod-mtime.mk" line 115: while evaluating variable "anything": Unknown modifier "mtim"
+make: "varmod-mtime.mk" line 115: while evaluating variable "anything" with value "anything": Unknown modifier "mtim"
make: "varmod-mtime.mk" line 115: Malformed conditional (${anything:L:mtim})
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
diff --git a/contrib/bmake/unit-tests/varmod-mtime.mk b/contrib/bmake/unit-tests/varmod-mtime.mk
index 189bb8cadc9a..be627fcfe040 100644
--- a/contrib/bmake/unit-tests/varmod-mtime.mk
+++ b/contrib/bmake/unit-tests/varmod-mtime.mk
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-mtime.mk,v 1.10 2024/04/20 10:18:55 rillig Exp $
+# $NetBSD: varmod-mtime.mk,v 1.11 2024/07/04 17:47:54 rillig Exp $
#
# Tests for the ':mtime' variable modifier, which maps each word of the
# expression to that file's modification time.
@@ -42,7 +42,7 @@ not_found_mtime:= ${no/such/file:L:mtime}
# The fallback timestamp must only be an integer, without trailing characters.
-# expect+2: while evaluating variable "no/such/file": Invalid argument '123x' for modifier ':mtime'
+# expect+2: while evaluating variable "no/such/file" with value "no/such/file": Invalid argument '123x' for modifier ':mtime'
# expect+1: Malformed conditional (${no/such/file:L:mtime=123x})
.if ${no/such/file:L:mtime=123x}
. error
@@ -64,8 +64,8 @@ _!= rm -f ${COOKIE}
# If the optional argument of the ':mtime' modifier is the word 'error', the
# modifier fails with an error message, once for each affected file.
#
-# expect+3: while evaluating variable "no/such/file1 no/such/file2": Cannot determine mtime for 'no/such/file1': <ENOENT>
-# expect+2: while evaluating variable "no/such/file1 no/such/file2": Cannot determine mtime for 'no/such/file2': <ENOENT>
+# expect+3: while evaluating variable "no/such/file1 no/such/file2" with value "no/such/file1 no/such/file2": Cannot determine mtime for 'no/such/file1': <ENOENT>
+# expect+2: while evaluating variable "no/such/file1 no/such/file2" with value "no/such/file1 no/such/file2": Cannot determine mtime for 'no/such/file2': <ENOENT>
# expect+1: Malformed conditional (${no/such/file1 no/such/file2:L:mtime=error})
.if ${no/such/file1 no/such/file2:L:mtime=error}
. error
@@ -76,7 +76,7 @@ _!= rm -f ${COOKIE}
# Only the word 'error' is a special argument to the ':mtime' modifier, all
# other words result in a parse error.
-# expect+2: while evaluating variable "MAKEFILE": Invalid argument 'errorhandler-no' for modifier ':mtime'
+# expect+2: while evaluating variable "MAKEFILE" with value "varmod-mtime.mk": Invalid argument 'errorhandler-no' for modifier ':mtime'
# expect+1: Malformed conditional (${MAKEFILE:mtime=errorhandler-no} > 0)
.if ${MAKEFILE:mtime=errorhandler-no} > 0
.else
@@ -85,7 +85,7 @@ _!= rm -f ${COOKIE}
# Only the word 'error' can be used as a fallback argument to the modifier.
-# expect+2: while evaluating variable "MAKEFILE": Invalid argument 'warn' for modifier ':mtime'
+# expect+2: while evaluating variable "MAKEFILE" with value "varmod-mtime.mk": Invalid argument 'warn' for modifier ':mtime'
# expect+1: Malformed conditional (${MAKEFILE:mtime=warn} > 0)
.if ${MAKEFILE:mtime=warn} > 0
. error
@@ -110,7 +110,7 @@ end:= ${%s:L:gmtime}
# If there is a typo in the modifier name, it does not match.
-# expect+2: while evaluating variable "anything": Unknown modifier "mtim"
+# expect+2: while evaluating variable "anything" with value "anything": Unknown modifier "mtim"
# expect+1: Malformed conditional (${anything:L:mtim})
.if ${anything:L:mtim}
. error
diff --git a/contrib/bmake/unit-tests/varmod-order.exp b/contrib/bmake/unit-tests/varmod-order.exp
index 12d0bff75157..591e1f160f61 100644
--- a/contrib/bmake/unit-tests/varmod-order.exp
+++ b/contrib/bmake/unit-tests/varmod-order.exp
@@ -1,26 +1,26 @@
-make: Bad modifier ":OX" for variable "WORDS"
-make: "varmod-order.mk" line 16: Undefined variable "${WORDS:OX"
-make: Bad modifier ":OxXX" for variable "WORDS"
-make: "varmod-order.mk" line 21: Undefined variable "${WORDS:Ox"
-make: Unclosed expression, expecting '}' for modifier "O" of variable "WORDS" with value "eight five four nine one seven six ten three two"
-make: Unclosed expression, expecting '}' for modifier "On" of variable "NUMBERS" with value "1 2 3 4 5 6 7 8 9 10"
-make: Unclosed expression, expecting '}' for modifier "Onr" of variable "NUMBERS" with value "10 9 8 7 6 5 4 3 2 1"
-make: Bad modifier ":Oxn" for variable "NUMBERS"
-make: "varmod-order.mk" line 33: Malformed conditional (${NUMBERS:Oxn})
-make: Bad modifier ":On_typo" for variable "NUMBERS"
-make: "varmod-order.mk" line 44: Malformed conditional (${NUMBERS:On_typo})
-make: Bad modifier ":Onr_typo" for variable "NUMBERS"
-make: "varmod-order.mk" line 54: Malformed conditional (${NUMBERS:Onr_typo})
-make: Bad modifier ":Orn_typo" for variable "NUMBERS"
-make: "varmod-order.mk" line 64: Malformed conditional (${NUMBERS:Orn_typo})
-make: Bad modifier ":Onn" for variable "NUMBERS"
-make: "varmod-order.mk" line 76: Malformed conditional (${NUMBERS:Onn})
-make: Bad modifier ":Onrr" for variable "NUMBERS"
-make: "varmod-order.mk" line 86: Malformed conditional (${NUMBERS:Onrr})
-make: Bad modifier ":Orrn" for variable "NUMBERS"
-make: "varmod-order.mk" line 96: Malformed conditional (${NUMBERS:Orrn})
-make: Bad modifier ":On=Off" for variable "SWITCH"
-make: "varmod-order.mk" line 111: Malformed conditional (${SWITCH:On=Off} != "Off")
+make: "varmod-order.mk" line 17: while evaluating variable "WORDS" with value "one two three four five six seven eight nine ten": Bad modifier ":OX"
+make: "varmod-order.mk" line 17: Undefined variable "${WORDS:OX"
+make: "varmod-order.mk" line 23: while evaluating variable "WORDS" with value "one two three four five six seven eight nine ten": Bad modifier ":OxXX"
+make: "varmod-order.mk" line 23: Undefined variable "${WORDS:Ox"
+make: "varmod-order.mk" line 27: while evaluating variable "WORDS" with value "eight five four nine one seven six ten three two": Unclosed expression, expecting '}' for modifier "O"
+make: "varmod-order.mk" line 29: while evaluating variable "NUMBERS" with value "1 2 3 4 5 6 7 8 9 10": Unclosed expression, expecting '}' for modifier "On"
+make: "varmod-order.mk" line 31: while evaluating variable "NUMBERS" with value "10 9 8 7 6 5 4 3 2 1": Unclosed expression, expecting '}' for modifier "Onr"
+make: "varmod-order.mk" line 38: while evaluating variable "NUMBERS" with value "8 5 4 9 1 7 6 10 3 2": Bad modifier ":Oxn"
+make: "varmod-order.mk" line 38: Malformed conditional (${NUMBERS:Oxn})
+make: "varmod-order.mk" line 48: while evaluating variable "NUMBERS" with value "8 5 4 9 1 7 6 10 3 2": Bad modifier ":On_typo"
+make: "varmod-order.mk" line 48: Malformed conditional (${NUMBERS:On_typo})
+make: "varmod-order.mk" line 58: while evaluating variable "NUMBERS" with value "8 5 4 9 1 7 6 10 3 2": Bad modifier ":Onr_typo"
+make: "varmod-order.mk" line 58: Malformed conditional (${NUMBERS:Onr_typo})
+make: "varmod-order.mk" line 68: while evaluating variable "NUMBERS" with value "8 5 4 9 1 7 6 10 3 2": Bad modifier ":Orn_typo"
+make: "varmod-order.mk" line 68: Malformed conditional (${NUMBERS:Orn_typo})
+make: "varmod-order.mk" line 80: while evaluating variable "NUMBERS" with value "8 5 4 9 1 7 6 10 3 2": Bad modifier ":Onn"
+make: "varmod-order.mk" line 80: Malformed conditional (${NUMBERS:Onn})
+make: "varmod-order.mk" line 90: while evaluating variable "NUMBERS" with value "8 5 4 9 1 7 6 10 3 2": Bad modifier ":Onrr"
+make: "varmod-order.mk" line 90: Malformed conditional (${NUMBERS:Onrr})
+make: "varmod-order.mk" line 100: while evaluating variable "NUMBERS" with value "8 5 4 9 1 7 6 10 3 2": Bad modifier ":Orrn"
+make: "varmod-order.mk" line 100: Malformed conditional (${NUMBERS:Orrn})
+make: "varmod-order.mk" line 115: while evaluating variable "SWITCH" with value "On": Bad modifier ":On=Off"
+make: "varmod-order.mk" line 115: Malformed conditional (${SWITCH:On=Off} != "Off")
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/varmod-order.mk b/contrib/bmake/unit-tests/varmod-order.mk
index 67919543a93e..b8a631857e6f 100644
--- a/contrib/bmake/unit-tests/varmod-order.mk
+++ b/contrib/bmake/unit-tests/varmod-order.mk
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-order.mk,v 1.11 2023/06/01 20:56:35 rillig Exp $
+# $NetBSD: varmod-order.mk,v 1.14 2024/07/05 18:59:33 rillig Exp $
#
# Tests for the :O variable modifier and its variants, which either sort the
# words of the value or shuffle them.
@@ -11,24 +11,29 @@ NUMBERS= 8 5 4 9 1 7 6 10 3 2 # in English alphabetical order
.endif
# Unknown modifier "OX"
-# FIXME: The error message is wrong.
-# expect+1: Undefined variable "${WORDS:OX"
+# FIXME: The error message "Undefined variable" is wrong.
+# expect+2: Undefined variable "${WORDS:OX"
+# expect+1: while evaluating variable "WORDS" with value "one two three four five six seven eight nine ten": Bad modifier ":OX"
_:= ${WORDS:OX}
# Unknown modifier "OxXX"
-# FIXME: The error message is wrong.
-# expect+1: Undefined variable "${WORDS:Ox"
+# FIXME: The error message "Undefined variable" is wrong.
+# expect+2: Undefined variable "${WORDS:Ox"
+# expect+1: while evaluating variable "WORDS" with value "one two three four five six seven eight nine ten": Bad modifier ":OxXX"
_:= ${WORDS:OxXX}
# Missing closing brace, to cover the error handling code.
+# expect+1: while evaluating variable "WORDS" with value "eight five four nine one seven six ten three two": Unclosed expression, expecting '}' for modifier "O"
_:= ${WORDS:O
+# expect+1: while evaluating variable "NUMBERS" with value "1 2 3 4 5 6 7 8 9 10": Unclosed expression, expecting '}' for modifier "On"
_:= ${NUMBERS:On
+# expect+1: while evaluating variable "NUMBERS" with value "10 9 8 7 6 5 4 3 2 1": Unclosed expression, expecting '}' for modifier "Onr"
_:= ${NUMBERS:Onr
# Shuffling numerically doesn't make sense, so don't allow 'x' and 'n' to be
# combined.
#
-# expect: make: Bad modifier ":Oxn" for variable "NUMBERS"
+# expect+2: while evaluating variable "NUMBERS" with value "8 5 4 9 1 7 6 10 3 2": Bad modifier ":Oxn"
# expect+1: Malformed conditional (${NUMBERS:Oxn})
.if ${NUMBERS:Oxn}
. error
@@ -37,9 +42,8 @@ _:= ${NUMBERS:Onr
.endif
# Extra characters after ':On' are detected and diagnosed.
-# TODO: Add line number information to the "Bad modifier" diagnostic.
#
-# expect: make: Bad modifier ":On_typo" for variable "NUMBERS"
+# expect+2: while evaluating variable "NUMBERS" with value "8 5 4 9 1 7 6 10 3 2": Bad modifier ":On_typo"
# expect+1: Malformed conditional (${NUMBERS:On_typo})
.if ${NUMBERS:On_typo}
. error
@@ -49,7 +53,7 @@ _:= ${NUMBERS:Onr
# Extra characters after ':Onr' are detected and diagnosed.
#
-# expect: make: Bad modifier ":Onr_typo" for variable "NUMBERS"
+# expect+2: while evaluating variable "NUMBERS" with value "8 5 4 9 1 7 6 10 3 2": Bad modifier ":Onr_typo"
# expect+1: Malformed conditional (${NUMBERS:Onr_typo})
.if ${NUMBERS:Onr_typo}
. error
@@ -59,7 +63,7 @@ _:= ${NUMBERS:Onr
# Extra characters after ':Orn' are detected and diagnosed.
#
-# expect: make: Bad modifier ":Orn_typo" for variable "NUMBERS"
+# expect+2: while evaluating variable "NUMBERS" with value "8 5 4 9 1 7 6 10 3 2": Bad modifier ":Orn_typo"
# expect+1: Malformed conditional (${NUMBERS:Orn_typo})
.if ${NUMBERS:Orn_typo}
. error
@@ -71,7 +75,7 @@ _:= ${NUMBERS:Onr
# criteria are fixed, not computed, therefore allowing this redundancy does
# not make sense.
#
-# expect: make: Bad modifier ":Onn" for variable "NUMBERS"
+# expect+2: while evaluating variable "NUMBERS" with value "8 5 4 9 1 7 6 10 3 2": Bad modifier ":Onn"
# expect+1: Malformed conditional (${NUMBERS:Onn})
.if ${NUMBERS:Onn}
. error
@@ -81,7 +85,7 @@ _:= ${NUMBERS:Onr
# Repeating the 'r' is not supported as well, for the same reasons as above.
#
-# expect: make: Bad modifier ":Onrr" for variable "NUMBERS"
+# expect+2: while evaluating variable "NUMBERS" with value "8 5 4 9 1 7 6 10 3 2": Bad modifier ":Onrr"
# expect+1: Malformed conditional (${NUMBERS:Onrr})
.if ${NUMBERS:Onrr}
. error
@@ -91,7 +95,7 @@ _:= ${NUMBERS:Onr
# Repeating the 'r' is not supported as well, for the same reasons as above.
#
-# expect: make: Bad modifier ":Orrn" for variable "NUMBERS"
+# expect+2: while evaluating variable "NUMBERS" with value "8 5 4 9 1 7 6 10 3 2": Bad modifier ":Orrn"
# expect+1: Malformed conditional (${NUMBERS:Orrn})
.if ${NUMBERS:Orrn}
. error
@@ -106,7 +110,7 @@ _:= ${NUMBERS:Onr
# ':H' modifier but instead replaces a trailing 'H' with 'new' in each word.
# There is no such fallback for the ':O' modifiers.
SWITCH= On
-# expect: make: Bad modifier ":On=Off" for variable "SWITCH"
+# expect+2: while evaluating variable "SWITCH" with value "On": Bad modifier ":On=Off"
# expect+1: Malformed conditional (${SWITCH:On=Off} != "Off")
.if ${SWITCH:On=Off} != "Off"
. error
diff --git a/contrib/bmake/unit-tests/varmod-range.exp b/contrib/bmake/unit-tests/varmod-range.exp
index d9848c2ef4f6..2848193e0db1 100644
--- a/contrib/bmake/unit-tests/varmod-range.exp
+++ b/contrib/bmake/unit-tests/varmod-range.exp
@@ -1,14 +1,14 @@
make: "varmod-range.mk" line 43: Malformed conditional (${:range=5} != "")
-make: "varmod-range.mk" line 67: while evaluating "${:U:range=x}Rest" != "Rest"": Invalid number "x}Rest" != "Rest"" for ':range' modifier
+make: "varmod-range.mk" line 67: while evaluating "${:U:range=x}Rest" != "Rest"" with value "": Invalid number "x}Rest" != "Rest"" for ':range' modifier
make: "varmod-range.mk" line 67: Malformed conditional ("${:U:range=x}Rest" != "Rest")
-make: "varmod-range.mk" line 78: while evaluating "${:U:range=0x0}Rest" != "Rest"": Unknown modifier "x0"
+make: "varmod-range.mk" line 78: while evaluating "${:U:range=0x0}Rest" != "Rest"" with value "1": Unknown modifier "x0"
make: "varmod-range.mk" line 78: Malformed conditional ("${:U:range=0x0}Rest" != "Rest")
-make: "varmod-range.mk" line 96: while evaluating variable "a b c": Unknown modifier "rang"
+make: "varmod-range.mk" line 96: while evaluating variable "a b c" with value "a b c": Unknown modifier "rang"
make: "varmod-range.mk" line 96: Malformed conditional ("${a b c:L:rang}Rest" != "Rest")
-make: "varmod-range.mk" line 105: while evaluating variable "a b c": Unknown modifier "rango"
+make: "varmod-range.mk" line 105: while evaluating variable "a b c" with value "a b c": Unknown modifier "rango"
make: "varmod-range.mk" line 105: Malformed conditional ("${a b c:L:rango}Rest" != "Rest")
-make: "varmod-range.mk" line 114: while evaluating variable "a b c": Unknown modifier "ranger"
+make: "varmod-range.mk" line 114: while evaluating variable "a b c" with value "a b c": Unknown modifier "ranger"
make: "varmod-range.mk" line 114: Malformed conditional ("${a b c:L:ranger}Rest" != "Rest")
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/varmod-range.mk b/contrib/bmake/unit-tests/varmod-range.mk
index 2915100bfb79..4b07b659489c 100644
--- a/contrib/bmake/unit-tests/varmod-range.mk
+++ b/contrib/bmake/unit-tests/varmod-range.mk
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-range.mk,v 1.11 2024/04/20 10:18:55 rillig Exp $
+# $NetBSD: varmod-range.mk,v 1.13 2024/07/05 19:47:22 rillig Exp $
#
# Tests for the :range variable modifier, which generates sequences
# of integers from the given range.
@@ -62,7 +62,7 @@
#
# Since 2020-11-01, the parser issues a more precise "Invalid number" error
# instead.
-# expect+2: while evaluating "${:U:range=x}Rest" != "Rest"": Invalid number "x}Rest" != "Rest"" for ':range' modifier
+# expect+2: while evaluating "${:U:range=x}Rest" != "Rest"" with value "": Invalid number "x}Rest" != "Rest"" for ':range' modifier
# expect+1: Malformed conditional ("${:U:range=x}Rest" != "Rest")
.if "${:U:range=x}Rest" != "Rest"
. error
@@ -73,7 +73,7 @@
# The upper limit of the range must always be given in decimal.
# This parse error stops at the 'x', trying to parse it as a variable
# modifier.
-# expect+2: while evaluating "${:U:range=0x0}Rest" != "Rest"": Unknown modifier "x0"
+# expect+2: while evaluating "${:U:range=0x0}Rest" != "Rest"" with value "1": Unknown modifier "x0"
# expect+1: Malformed conditional ("${:U:range=0x0}Rest" != "Rest")
.if "${:U:range=0x0}Rest" != "Rest"
. error
@@ -91,7 +91,7 @@
#.endif
# modifier name too short
-# expect+2: while evaluating variable "a b c": Unknown modifier "rang"
+# expect+2: while evaluating variable "a b c" with value "a b c": Unknown modifier "rang"
# expect+1: Malformed conditional ("${a b c:L:rang}Rest" != "Rest")
.if "${a b c:L:rang}Rest" != "Rest"
. error
@@ -100,7 +100,7 @@
.endif
# misspelled modifier name
-# expect+2: while evaluating variable "a b c": Unknown modifier "rango"
+# expect+2: while evaluating variable "a b c" with value "a b c": Unknown modifier "rango"
# expect+1: Malformed conditional ("${a b c:L:rango}Rest" != "Rest")
.if "${a b c:L:rango}Rest" != "Rest"
. error
@@ -109,7 +109,7 @@
.endif
# modifier name too long
-# expect+2: while evaluating variable "a b c": Unknown modifier "ranger"
+# expect+2: while evaluating variable "a b c" with value "a b c": Unknown modifier "ranger"
# expect+1: Malformed conditional ("${a b c:L:ranger}Rest" != "Rest")
.if "${a b c:L:ranger}Rest" != "Rest"
. error
diff --git a/contrib/bmake/unit-tests/varmod-select-words.exp b/contrib/bmake/unit-tests/varmod-select-words.exp
index 02e9974c02d6..c503e57b384b 100644
--- a/contrib/bmake/unit-tests/varmod-select-words.exp
+++ b/contrib/bmake/unit-tests/varmod-select-words.exp
@@ -1,4 +1,4 @@
-make: Bad modifier ":[]" for variable "LIST"
+make: in target "mod-squarebrackets-0-star-at": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[]"
LIST:[]="" is an error
LIST:[0]="one two three four five six"
LIST:[0x0]="one two three four five six"
@@ -37,17 +37,17 @@ REALLYSPACE=" "
REALLYSPACE:[1]="" == "" ?
REALLYSPACE:[*]:[1]=" " == " " ?
LIST:[1]="one"
-make: Bad modifier ":[1.]" for variable "LIST"
+make: in target "mod-squarebrackets-n": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[1.]"
LIST:[1.]="" is an error
-make: Bad modifier ":[1]." for variable "LIST"
+make: in target "mod-squarebrackets-n": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[1]."
LIST:[1].="}" is an error
LIST:[2]="two"
LIST:[6]="six"
LIST:[7]=""
LIST:[999]=""
-make: Bad modifier ":[-]" for variable "LIST"
+make: in target "mod-squarebrackets-n": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[-]"
LIST:[-]="" is an error
-make: Bad modifier ":[--]" for variable "LIST"
+make: in target "mod-squarebrackets-n": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[--]"
LIST:[--]="" is an error
LIST:[-1]="six"
LIST:[-2]="five"
@@ -67,22 +67,22 @@ LIST:[*]:C/ /,/:[2]=""
LIST:[*]:C/ /,/:[*]:[2]=""
LIST:[*]:C/ /,/:[@]:[2]="three"
LONGLIST:[012..0x12]="10 11 12 13 14 15 16 17 18"
-make: Bad modifier ":[1.]" for variable "LIST"
+make: in target "mod-squarebrackets-start-end": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[1.]"
LIST:[1.]="" is an error
-make: Bad modifier ":[1..]" for variable "LIST"
+make: in target "mod-squarebrackets-start-end": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[1..]"
LIST:[1..]="" is an error
-make: Bad modifier ":[1.. ]" for variable "LIST"
+make: in target "mod-squarebrackets-start-end": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[1.. ]"
LIST:[1.. ]="" is an error
LIST:[1..1]="one"
-make: Bad modifier ":[1..1.]" for variable "LIST"
+make: in target "mod-squarebrackets-start-end": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[1..1.]"
LIST:[1..1.]="" is an error
LIST:[1..2]="one two"
LIST:[2..1]="two one"
LIST:[3..-2]="three four five"
LIST:[-4..4]="three four"
-make: Bad modifier ":[0..1]" for variable "LIST"
+make: in target "mod-squarebrackets-start-end": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[0..1]"
LIST:[0..1]="" is an error
-make: Bad modifier ":[-1..0]" for variable "LIST"
+make: in target "mod-squarebrackets-start-end": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[-1..0]"
LIST:[-1..0]="" is an error
LIST:[-1..1]="six five four three two one"
LIST:[0..0]="one two three four five six"
@@ -97,7 +97,7 @@ LIST:[${ONE}]="one"
LIST:[${MINUSONE}]="six"
LIST:[${STAR}]="one two three four five six"
LIST:[${AT}]="one two three four five six"
-make: Bad modifier ":[${EMPTY" for variable "LIST"
+make: in target "mod-squarebrackets-nested": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[${EMPTY"
LIST:[${EMPTY}]="" is an error
LIST:[${LONGLIST:[21]:S/2//}]="one"
LIST:[${LIST:[#]}]="six"
@@ -123,4 +123,4 @@ LIST:tw:C/ /,/g="one two three four five six"
LIST:tw:C/ /,/1g="one two three four five six"
LIST:tw:tW:C/ /,/="one,two three four five six"
LIST:tW:tw:C/ /,/="one two three four five six"
-exit status 0
+exit status 2
diff --git a/contrib/bmake/unit-tests/varmod-shell.exp b/contrib/bmake/unit-tests/varmod-shell.exp
index 208ef953728b..6ada8f74d75e 100644
--- a/contrib/bmake/unit-tests/varmod-shell.exp
+++ b/contrib/bmake/unit-tests/varmod-shell.exp
@@ -1,12 +1,12 @@
-make: "echo word; false" returned non-zero status
-make: "echo word; false" returned non-zero status
+make: "varmod-shell.mk" line 25: warning: while evaluating "${:!echo word; (exit 13)!} != "word"" with value "word": Command "echo word; (exit 13)" exited with status 13
+make: "varmod-shell.mk" line 29: warning: while evaluating "${:Uprevious value:!echo word; (exit 13)!} != "word"" with value "word": Command "echo word; (exit 13)" exited with status 13
Global: _ = # (empty)
-Var_Parse: ${:!echo word; ${:Ufalse}!} (eval-keep-dollar-and-undefined)
+Var_Parse: ${:!echo word; ${:U(exit 13)}!} (eval-keep-dollar-and-undefined)
Evaluating modifier ${:!...} on value "" (eval-keep-dollar-and-undefined, undefined)
-Modifier part: "echo word; false"
-Capturing the output of command "echo word; false"
-make: "echo word; false" returned non-zero status
-Result of ${:!echo word; ${:Ufalse}!} is "word" (eval-keep-dollar-and-undefined, defined)
+Modifier part: "echo word; (exit 13)"
+Capturing the output of command "echo word; (exit 13)"
+make: "varmod-shell.mk" line 36: warning: while evaluating "${:!echo word; ${:U(exit 13)}!}" with value "word": Command "echo word; (exit 13)" exited with status 13
+Result of ${:!echo word; ${:U(exit 13)}!} is "word" (eval-keep-dollar-and-undefined, defined)
Global: _ = word
Global: .MAKEFLAGS = -r -k -d v -d
Global: .MAKEFLAGS = -r -k -d v -d 0
diff --git a/contrib/bmake/unit-tests/varmod-shell.mk b/contrib/bmake/unit-tests/varmod-shell.mk
index d449709cee0f..87918c5bbbf6 100644
--- a/contrib/bmake/unit-tests/varmod-shell.mk
+++ b/contrib/bmake/unit-tests/varmod-shell.mk
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-shell.mk,v 1.7 2022/01/10 20:32:29 rillig Exp $
+# $NetBSD: varmod-shell.mk,v 1.10 2024/07/05 19:47:22 rillig Exp $
#
# Tests for the ':!cmd!' variable modifier, which runs the shell command
# given by the variable modifier and returns its output.
@@ -21,16 +21,20 @@
# Between 2000-04-29 and 2020-11-17, the error message mentioned the previous
# value of the expression (which is usually an empty string) instead of the
# command that was executed.
-.if ${:!echo word; false!} != "word"
+# expect+1: warning: while evaluating "${:!echo word; (exit 13)!} != "word"" with value "word": Command "echo word; (exit 13)" exited with status 13
+.if ${:!echo word; (exit 13)!} != "word"
. error
.endif
-.if ${:Uprevious value:!echo word; false!} != "word"
+# expect+1: warning: while evaluating "${:Uprevious value:!echo word; (exit 13)!} != "word"" with value "word": Command "echo word; (exit 13)" exited with status 13
+.if ${:Uprevious value:!echo word; (exit 13)!} != "word"
. error
.endif
-.MAKEFLAGS: -dv # to see the actual command
-_:= ${:!echo word; ${:Ufalse}!}
+.MAKEFLAGS: -dv # to see the "Capturing" debug output
+# expect+1: warning: while evaluating "${:!echo word; ${:U(exit 13)}!}" with value "word": Command "echo word; (exit 13)" exited with status 13
+_:= ${:!echo word; ${:U(exit 13)}!}
.MAKEFLAGS: -d0
+
all:
diff --git a/contrib/bmake/unit-tests/varmod-subst-regex.exp b/contrib/bmake/unit-tests/varmod-subst-regex.exp
index 25626ba18508..722abdff5813 100644
--- a/contrib/bmake/unit-tests/varmod-subst-regex.exp
+++ b/contrib/bmake/unit-tests/varmod-subst-regex.exp
@@ -1,26 +1,26 @@
-make: Regex compilation error: (details omitted)
+make: in target "mod-regex-compile-error": while evaluating "${:Uword1 word2:C,****,____,g:C,word,____,:Q}." with value "word1 word2": Regex compilation error: (details omitted)
mod-regex-compile-error: C,word,____,:Q}.
-make: No subexpression \1
-make: No subexpression \1
-make: No subexpression \1
-make: No subexpression \1
+make: in target "mod-regex-limits": while evaluating "${:U1 23 456:C,..,\1\1,:Q}" with value "1 23 456": No subexpression \1
+make: in target "mod-regex-limits": while evaluating "${:U1 23 456:C,..,\1\1,:Q}" with value "1 23 456": No subexpression \1
+make: in target "mod-regex-limits": while evaluating "${:U1 23 456:C,..,\1\1,:Q}" with value "1 23 456": No subexpression \1
+make: in target "mod-regex-limits": while evaluating "${:U1 23 456:C,..,\1\1,:Q}" with value "1 23 456": No subexpression \1
mod-regex-limits:11-missing:1 6
mod-regex-limits:11-ok:1 22 446
-make: No subexpression \2
-make: No subexpression \2
-make: No subexpression \2
-make: No subexpression \2
+make: in target "mod-regex-limits": while evaluating "${:U1 23 456:C,..,\2\2,:Q}" with value "1 23 456": No subexpression \2
+make: in target "mod-regex-limits": while evaluating "${:U1 23 456:C,..,\2\2,:Q}" with value "1 23 456": No subexpression \2
+make: in target "mod-regex-limits": while evaluating "${:U1 23 456:C,..,\2\2,:Q}" with value "1 23 456": No subexpression \2
+make: in target "mod-regex-limits": while evaluating "${:U1 23 456:C,..,\2\2,:Q}" with value "1 23 456": No subexpression \2
mod-regex-limits:22-missing:1 6
-make: No subexpression \2
-make: No subexpression \2
-make: No subexpression \2
-make: No subexpression \2
+make: in target "mod-regex-limits": while evaluating "${:U1 23 456:C,(.).,\2\2,:Q}" with value "1 23 456": No subexpression \2
+make: in target "mod-regex-limits": while evaluating "${:U1 23 456:C,(.).,\2\2,:Q}" with value "1 23 456": No subexpression \2
+make: in target "mod-regex-limits": while evaluating "${:U1 23 456:C,(.).,\2\2,:Q}" with value "1 23 456": No subexpression \2
+make: in target "mod-regex-limits": while evaluating "${:U1 23 456:C,(.).,\2\2,:Q}" with value "1 23 456": No subexpression \2
mod-regex-limits:22-missing:1 6
mod-regex-limits:22-ok:1 33 556
mod-regex-limits:capture:ihgfedcbaabcdefghijABCDEFGHIJa0a1a2rest
-make: Regex compilation error: (details omitted)
+make: in target "mod-regex-errors": while evaluating variable "UNDEF" with value "value": Regex compilation error: (details omitted)
mod-regex-errors:
-make: in target "mod-regex-errors": while evaluating variable "word": while evaluating "${:U:Z}y,W}": Unknown modifier "Z"
+make: in target "mod-regex-errors": while evaluating variable "word" with value "word": while evaluating "${:U:Z}y,W}" with value "": Unknown modifier "Z"
mod-regex-errors: xy
unmatched-subexpression.ok: one one 2 3 5 8 one3 2one 34
make: No match for subexpression \2
diff --git a/contrib/bmake/unit-tests/varmod-subst.exp b/contrib/bmake/unit-tests/varmod-subst.exp
index 9d88b3d6fa6f..9b91c0e50857 100644
--- a/contrib/bmake/unit-tests/varmod-subst.exp
+++ b/contrib/bmake/unit-tests/varmod-subst.exp
@@ -45,7 +45,7 @@ mod-subst-delimiter:
1 two 3 tilde
mod-subst-chain:
A B c.
-make: in target "mod-subst-chain": while evaluating "${:Uvalue:S,a,x,i}.": Unknown modifier "i"
+make: in target "mod-subst-chain": while evaluating "${:Uvalue:S,a,x,i}." with value "vxlue": Unknown modifier "i"
.
mod-subst-dollar:$1:
mod-subst-dollar:$2:
@@ -59,4 +59,4 @@ mod-subst-dollar:$40:
mod-subst-dollar:U8:
mod-subst-dollar:$$$$:
mod-subst-dollar:$$$good3
-exit status 0
+exit status 2
diff --git a/contrib/bmake/unit-tests/varmod-sun-shell.exp b/contrib/bmake/unit-tests/varmod-sun-shell.exp
index 7f661ff6e79e..80dec0935f28 100644
--- a/contrib/bmake/unit-tests/varmod-sun-shell.exp
+++ b/contrib/bmake/unit-tests/varmod-sun-shell.exp
@@ -1,12 +1,12 @@
-make: "echo word; false" returned non-zero status
+make: "varmod-sun-shell.mk" line 17: warning: while evaluating variable "echo word; (exit 13)" with value "echo word; (exit 13)": Command "echo word; (exit 13)" exited with status 13
Global: _ = # (empty)
-Var_Parse: ${echo word; ${:Ufalse}:L:sh} (eval-keep-dollar-and-undefined)
-Evaluating modifier ${echo word; false:L} on value "" (eval-keep-dollar-and-undefined, undefined)
-Result of ${echo word; false:L} is "echo word; false" (eval-keep-dollar-and-undefined, defined)
-Evaluating modifier ${echo word; false:s...} on value "echo word; false" (eval-keep-dollar-and-undefined, defined)
-Capturing the output of command "echo word; false"
-make: "echo word; false" returned non-zero status
-Result of ${echo word; false:sh} is "word" (eval-keep-dollar-and-undefined, defined)
+Var_Parse: ${echo word; ${:U(exit 13)}:L:sh} (eval-keep-dollar-and-undefined)
+Evaluating modifier ${echo word; (exit 13):L} on value "" (eval-keep-dollar-and-undefined, undefined)
+Result of ${echo word; (exit 13):L} is "echo word; (exit 13)" (eval-keep-dollar-and-undefined, defined)
+Evaluating modifier ${echo word; (exit 13):s...} on value "echo word; (exit 13)" (eval-keep-dollar-and-undefined, defined)
+Capturing the output of command "echo word; (exit 13)"
+make: "varmod-sun-shell.mk" line 24: warning: while evaluating variable "echo word; (exit 13)" with value "echo word; (exit 13)": Command "echo word; (exit 13)" exited with status 13
+Result of ${echo word; (exit 13):sh} is "word" (eval-keep-dollar-and-undefined, defined)
Global: _ = word
Global: .MAKEFLAGS = -r -k -d v -d
Global: .MAKEFLAGS = -r -k -d v -d 0
diff --git a/contrib/bmake/unit-tests/varmod-sun-shell.mk b/contrib/bmake/unit-tests/varmod-sun-shell.mk
index 97acc5bd8c0f..4a37a271eced 100644
--- a/contrib/bmake/unit-tests/varmod-sun-shell.mk
+++ b/contrib/bmake/unit-tests/varmod-sun-shell.mk
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-sun-shell.mk,v 1.2 2022/01/10 20:32:29 rillig Exp $
+# $NetBSD: varmod-sun-shell.mk,v 1.5 2024/07/04 17:47:54 rillig Exp $
#
# Tests for the :sh variable modifier, which runs the shell command
# given by the variable value and returns its output.
@@ -12,15 +12,17 @@
. error
.endif
-# If the command exits with non-zero, an error message is printed.
-# XXX: Processing continues as usual though.
-.if ${echo word; false:L:sh} != "word"
+# If the command exits with non-zero, a warning is printed.
+# expect+1: warning: while evaluating variable "echo word; (exit 13)" with value "echo word; (exit 13)": Command "echo word; (exit 13)" exited with status 13
+.if ${echo word; (exit 13):L:sh} != "word"
. error
.endif
-.MAKEFLAGS: -dv # to see the actual command
-_:= ${echo word; ${:Ufalse}:L:sh}
+.MAKEFLAGS: -dv # to see the "Capturing" debug output
+# expect+1: warning: while evaluating variable "echo word; (exit 13)" with value "echo word; (exit 13)": Command "echo word; (exit 13)" exited with status 13
+_:= ${echo word; ${:U(exit 13)}:L:sh}
.MAKEFLAGS: -d0
+
all:
diff --git a/contrib/bmake/unit-tests/varmod-sysv.exp b/contrib/bmake/unit-tests/varmod-sysv.exp
index fe88ebd0a306..be87193b4066 100644
--- a/contrib/bmake/unit-tests/varmod-sysv.exp
+++ b/contrib/bmake/unit-tests/varmod-sysv.exp
@@ -1,5 +1,5 @@
-make: Unfinished modifier for "word214" ('=' missing)
-make: "varmod-sysv.mk" line 215: Malformed conditional (${word214:L:from${:D=}to})
+make: "varmod-sysv.mk" line 216: while evaluating variable "word216" with value "word216": Unfinished modifier ('=' missing)
+make: "varmod-sysv.mk" line 216: Malformed conditional (${word216:L:from${:D=}to})
word modifier result
'' = ""
suffix = "suffix"
@@ -145,8 +145,8 @@ pre-middle-suffix pre%ffix=NPre% "NPre-middle-su"
suffix pre%ffix=NPre%NS "suffix"
prefix pre%ffix=NPre%NS "prefix"
pre-middle-suffix pre%ffix=NPre%NS "NPre-middle-suNS"
-make: Unfinished modifier for "error" ('}' missing)
-make: "varmod-sysv.mk" line 259: Malformed conditional (${error:L:from=$(}))
+make: "varmod-sysv.mk" line 261: while evaluating variable "error" with value "error": Unfinished modifier ('}' missing)
+make: "varmod-sysv.mk" line 261: Malformed conditional (${error:L:from=$(}))
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/varmod-sysv.mk b/contrib/bmake/unit-tests/varmod-sysv.mk
index d37c33e47229..8db41d7fb364 100644
--- a/contrib/bmake/unit-tests/varmod-sysv.mk
+++ b/contrib/bmake/unit-tests/varmod-sysv.mk
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-sysv.mk,v 1.17 2024/06/01 18:44:05 rillig Exp $
+# $NetBSD: varmod-sysv.mk,v 1.19 2024/07/04 17:47:54 rillig Exp $
#
# Tests for the variable modifier ':from=to', which replaces the suffix
# "from" with "to". It can also use '%' as a wildcard.
@@ -208,11 +208,12 @@
# This is not a SysV modifier since the nested expression expands
# to an empty string. The '=' in it should be irrelevant during parsing.
-# XXX: As of 2020-12-05, this expression generates an "Unfinished modifier"
+# XXX: As of 2024-06-30, this expression generates an "Unfinished modifier"
# error, while the correct error message would be "Unknown modifier" since
# there is no modifier named "fromto".
-# expect+1: Malformed conditional (${word214:L:from${:D=}to})
-.if ${word214:L:from${:D=}to}
+# expect+2: while evaluating variable "word216" with value "word216": Unfinished modifier ('=' missing)
+# expect+1: Malformed conditional (${word216:L:from${:D=}to})
+.if ${word216:L:from${:D=}to}
. error
.endif
@@ -255,6 +256,7 @@ INDIRECT= 1:${VALUE} 2:$${VALUE} 4:$$$${VALUE}
# The error case of an unfinished ':from=to' modifier after the '=' requires
# an expression that is missing the closing '}'.
+# expect+2: while evaluating variable "error" with value "error": Unfinished modifier ('}' missing)
# expect+1: Malformed conditional (${error:L:from=$(}))
.if ${error:L:from=$(})
.endif
diff --git a/contrib/bmake/unit-tests/varmod-to-separator.exp b/contrib/bmake/unit-tests/varmod-to-separator.exp
index 586b19f123b5..fe61ada505df 100644
--- a/contrib/bmake/unit-tests/varmod-to-separator.exp
+++ b/contrib/bmake/unit-tests/varmod-to-separator.exp
@@ -1,29 +1,29 @@
-make: "varmod-to-separator.mk" line 155: while evaluating variable "WORDS": Invalid character number at "400:tu}"
+make: "varmod-to-separator.mk" line 155: while evaluating variable "WORDS" with value "one two three": Invalid character number at "400:tu}"
make: "varmod-to-separator.mk" line 155: Malformed conditional (${WORDS:[1..3]:ts\400:tu})
-make: "varmod-to-separator.mk" line 171: while evaluating variable "WORDS": Invalid character number at "100:tu}"
+make: "varmod-to-separator.mk" line 171: while evaluating variable "WORDS" with value "one two three": Invalid character number at "100:tu}"
make: "varmod-to-separator.mk" line 171: Malformed conditional (${WORDS:[1..3]:ts\x100:tu})
-make: "varmod-to-separator.mk" line 180: while evaluating variable "word": Invalid character number at ",}"
+make: "varmod-to-separator.mk" line 180: while evaluating variable "word" with value "word": Invalid character number at ",}"
make: "varmod-to-separator.mk" line 180: Malformed conditional (${word:L:ts\x,})
-make: "varmod-to-separator.mk" line 187: while evaluating variable "word": Invalid character number at "112233445566778899}"
+make: "varmod-to-separator.mk" line 187: while evaluating variable "word" with value "word": Invalid character number at "112233445566778899}"
make: "varmod-to-separator.mk" line 187: Malformed conditional (${word:L:ts\x112233445566778899})
-make: Bad modifier ":ts\-300" for variable "WORDS"
-make: "varmod-to-separator.mk" line 192: Malformed conditional (${WORDS:[1..3]:ts\-300:tu})
-make: Bad modifier ":ts\8" for variable "1 2 3"
-make: "varmod-to-separator.mk" line 201: Malformed conditional (${1 2 3:L:ts\8:tu})
-make: Bad modifier ":ts\100L" for variable "1 2 3"
-make: "varmod-to-separator.mk" line 209: Malformed conditional (${1 2 3:L:ts\100L})
-make: Bad modifier ":ts\x40g" for variable "1 2 3"
-make: "varmod-to-separator.mk" line 217: Malformed conditional (${1 2 3:L:ts\x40g})
-make: Bad modifier ":tx" for variable "WORDS"
-make: "varmod-to-separator.mk" line 227: Malformed conditional (${WORDS:tx})
-make: Bad modifier ":ts\X" for variable "WORDS"
-make: "varmod-to-separator.mk" line 236: Malformed conditional (${WORDS:ts\X})
-make: Bad modifier ":t\X" for variable "WORDS"
-make: "varmod-to-separator.mk" line 245: Malformed conditional (${WORDS:t\X} != "anything")
-make: Bad modifier ":ts\69" for variable ""
-make: "varmod-to-separator.mk" line 262: Malformed conditional (${:Ua b:ts\69})
-make: "varmod-to-separator.mk" line 271: while evaluating "${:Ua b:ts\x1F60E}": Invalid character number at "1F60E}"
-make: "varmod-to-separator.mk" line 271: Malformed conditional (${:Ua b:ts\x1F60E})
+make: "varmod-to-separator.mk" line 193: while evaluating variable "WORDS" with value "one two three": Bad modifier ":ts\-300"
+make: "varmod-to-separator.mk" line 193: Malformed conditional (${WORDS:[1..3]:ts\-300:tu})
+make: "varmod-to-separator.mk" line 203: while evaluating variable "1 2 3" with value "1 2 3": Bad modifier ":ts\8"
+make: "varmod-to-separator.mk" line 203: Malformed conditional (${1 2 3:L:ts\8:tu})
+make: "varmod-to-separator.mk" line 212: while evaluating variable "1 2 3" with value "1 2 3": Bad modifier ":ts\100L"
+make: "varmod-to-separator.mk" line 212: Malformed conditional (${1 2 3:L:ts\100L})
+make: "varmod-to-separator.mk" line 221: while evaluating variable "1 2 3" with value "1 2 3": Bad modifier ":ts\x40g"
+make: "varmod-to-separator.mk" line 221: Malformed conditional (${1 2 3:L:ts\x40g})
+make: "varmod-to-separator.mk" line 231: while evaluating variable "WORDS" with value "one two three four five six": Bad modifier ":tx"
+make: "varmod-to-separator.mk" line 231: Malformed conditional (${WORDS:tx})
+make: "varmod-to-separator.mk" line 240: while evaluating variable "WORDS" with value "one two three four five six": Bad modifier ":ts\X"
+make: "varmod-to-separator.mk" line 240: Malformed conditional (${WORDS:ts\X})
+make: "varmod-to-separator.mk" line 250: while evaluating variable "WORDS" with value "one two three four five six": Bad modifier ":t\X"
+make: "varmod-to-separator.mk" line 250: Malformed conditional (${WORDS:t\X} != "anything")
+make: "varmod-to-separator.mk" line 267: while evaluating "${:Ua b:ts\69}" with value "a b": Bad modifier ":ts\69"
+make: "varmod-to-separator.mk" line 267: Malformed conditional (${:Ua b:ts\69})
+make: "varmod-to-separator.mk" line 276: while evaluating "${:Ua b:ts\x1F60E}" with value "a b": Invalid character number at "1F60E}"
+make: "varmod-to-separator.mk" line 276: Malformed conditional (${:Ua b:ts\x1F60E})
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/varmod-to-separator.mk b/contrib/bmake/unit-tests/varmod-to-separator.mk
index ec48dacbb60c..b4c6839a0a2b 100644
--- a/contrib/bmake/unit-tests/varmod-to-separator.mk
+++ b/contrib/bmake/unit-tests/varmod-to-separator.mk
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-to-separator.mk,v 1.15 2024/06/01 18:44:05 rillig Exp $
+# $NetBSD: varmod-to-separator.mk,v 1.18 2024/07/05 19:47:22 rillig Exp $
#
# Tests for the :ts variable modifier, which joins the words of the variable
# using an arbitrary character as word separator.
@@ -150,7 +150,7 @@ WORDS= one two three four five six
# for an unsigned character though.
#
# Since 2020-11-01, these out-of-bounds values are rejected.
-# expect+2: while evaluating variable "WORDS": Invalid character number at "400:tu}"
+# expect+2: while evaluating variable "WORDS" with value "one two three": Invalid character number at "400:tu}"
# expect+1: Malformed conditional (${WORDS:[1..3]:ts\400:tu})
.if ${WORDS:[1..3]:ts\400:tu}
. warning The separator \400 is accepted even though it is out of bounds.
@@ -166,7 +166,7 @@ WORDS= one two three four five six
# The hexadecimal number must be in the range of an unsigned char.
#
# Since 2020-11-01, these out-of-bounds values are rejected.
-# expect+2: while evaluating variable "WORDS": Invalid character number at "100:tu}"
+# expect+2: while evaluating variable "WORDS" with value "one two three": Invalid character number at "100:tu}"
# expect+1: Malformed conditional (${WORDS:[1..3]:ts\x100:tu})
.if ${WORDS:[1..3]:ts\x100:tu}
. warning The separator \x100 is accepted even though it is out of bounds.
@@ -175,19 +175,20 @@ WORDS= one two three four five six
.endif
# The number after ':ts\x' must be hexadecimal.
-# expect+2: while evaluating variable "word": Invalid character number at ",}"
+# expect+2: while evaluating variable "word" with value "word": Invalid character number at ",}"
# expect+1: Malformed conditional (${word:L:ts\x,})
.if ${word:L:ts\x,}
.endif
# The hexadecimal number must be in the range of 'unsigned long' on all
# supported platforms.
-# expect+2: while evaluating variable "word": Invalid character number at "112233445566778899}"
+# expect+2: while evaluating variable "word" with value "word": Invalid character number at "112233445566778899}"
# expect+1: Malformed conditional (${word:L:ts\x112233445566778899})
.if ${word:L:ts\x112233445566778899}
.endif
# Negative numbers are not allowed for the separator character.
+# expect+2: while evaluating variable "WORDS" with value "one two three": Bad modifier ":ts\-300"
# expect+1: Malformed conditional (${WORDS:[1..3]:ts\-300:tu})
.if ${WORDS:[1..3]:ts\-300:tu}
. warning The separator \-300 is accepted even though it is negative.
@@ -197,6 +198,7 @@ WORDS= one two three four five six
# The character number is interpreted as octal number by default.
# The digit '8' is not an octal digit though.
+# expect+2: while evaluating variable "1 2 3" with value "1 2 3": Bad modifier ":ts\8"
# expect+1: Malformed conditional (${1 2 3:L:ts\8:tu})
.if ${1 2 3:L:ts\8:tu}
. warning The separator \8 is accepted even though it is not octal.
@@ -205,6 +207,7 @@ WORDS= one two three four five six
.endif
# Trailing characters after the octal character number are rejected.
+# expect+2: while evaluating variable "1 2 3" with value "1 2 3": Bad modifier ":ts\100L"
# expect+1: Malformed conditional (${1 2 3:L:ts\100L})
.if ${1 2 3:L:ts\100L}
. warning The separator \100L is accepted even though it contains an 'L'.
@@ -213,6 +216,7 @@ WORDS= one two three four five six
.endif
# Trailing characters after the hexadecimal character number are rejected.
+# expect+2: while evaluating variable "1 2 3" with value "1 2 3": Bad modifier ":ts\x40g"
# expect+1: Malformed conditional (${1 2 3:L:ts\x40g})
.if ${1 2 3:L:ts\x40g}
. warning The separator \x40g is accepted even though it contains a 'g'.
@@ -222,7 +226,7 @@ WORDS= one two three four five six
# In the :t modifier, the :t must be followed by any of A, l, s, u.
-# expect: make: Bad modifier ":tx" for variable "WORDS"
+# expect+2: while evaluating variable "WORDS" with value "one two three four five six": Bad modifier ":tx"
# expect+1: Malformed conditional (${WORDS:tx})
.if ${WORDS:tx}
. error
@@ -231,7 +235,7 @@ WORDS= one two three four five six
.endif
# The word separator can only be a single character.
-# expect: make: Bad modifier ":ts\X" for variable "WORDS"
+# expect+2: while evaluating variable "WORDS" with value "one two three four five six": Bad modifier ":ts\X"
# expect+1: Malformed conditional (${WORDS:ts\X})
.if ${WORDS:ts\X}
. error
@@ -241,6 +245,7 @@ WORDS= one two three four five six
# After the backslash, only n, t, an octal number, or x and a hexadecimal
# number are allowed.
+# expect+2: while evaluating variable "WORDS" with value "one two three four five six": Bad modifier ":t\X"
# expect+1: Malformed conditional (${WORDS:t\X} != "anything")
.if ${WORDS:t\X} != "anything"
. info This line is not reached.
@@ -257,7 +262,7 @@ WORDS= one two three four five six
# happens for non-octal digits. From 2003.07.23.18.06.46 to
# 2016.02.27.16.20.06, the result was '1E2', since 2016.03.07.20.20.35 make no
# longer accepts this escape and complains.
-# expect: make: Bad modifier ":ts\69" for variable ""
+# expect+2: while evaluating "${:Ua b:ts\69}" with value "a b": Bad modifier ":ts\69"
# expect+1: Malformed conditional (${:Ua b:ts\69})
.if ${:Ua b:ts\69}
. error
@@ -266,7 +271,7 @@ WORDS= one two three four five six
.endif
# Try whether bmake is Unicode-ready.
-# expect+2: while evaluating "${:Ua b:ts\x1F60E}": Invalid character number at "1F60E}"
+# expect+2: while evaluating "${:Ua b:ts\x1F60E}" with value "a b": Invalid character number at "1F60E}"
# expect+1: Malformed conditional (${:Ua b:ts\x1F60E})
.if ${:Ua b:ts\x1F60E} # U+1F60E "smiling face with sunglasses"
. error
diff --git a/contrib/bmake/unit-tests/varmod-to-title.exp b/contrib/bmake/unit-tests/varmod-to-title.exp
new file mode 100644
index 000000000000..39a9383953dd
--- /dev/null
+++ b/contrib/bmake/unit-tests/varmod-to-title.exp
@@ -0,0 +1 @@
+exit status 0
diff --git a/contrib/bmake/unit-tests/varmod-to-title.mk b/contrib/bmake/unit-tests/varmod-to-title.mk
new file mode 100644
index 000000000000..f99e5441a8fb
--- /dev/null
+++ b/contrib/bmake/unit-tests/varmod-to-title.mk
@@ -0,0 +1,31 @@
+# $NetBSD: varmod-to-title.mk,v 1.1 2024/07/01 21:02:26 sjg Exp $
+#
+# Tests for the :tc variable modifier, which converts the expression value
+# to lowercase.
+#
+# TODO: What about non-ASCII characters? ISO-8859-1, UTF-8?
+
+.if ${:UUPPER:tt} != "Upper"
+. error
+.endif
+
+.if ${:Ulower:tt} != "Lower"
+. error
+.endif
+
+.if ${:UMixeD case.:tt} != "Mixed Case."
+. error
+.endif
+
+# The ':tt' modifier works on the whole string, without splitting it into
+# words.
+.if ${:Umultiple spaces:tt} != "Multiple Spaces"
+. error
+.endif
+
+# Note words only count if separated by spaces
+.if ${:Uthis&that or os/2:tt} != "This&that Or Os/2"
+. error
+.endif
+
+all: .PHONY
diff --git a/contrib/bmake/unit-tests/varmod.exp b/contrib/bmake/unit-tests/varmod.exp
index e619555d56cb..0948b585a477 100644
--- a/contrib/bmake/unit-tests/varmod.exp
+++ b/contrib/bmake/unit-tests/varmod.exp
@@ -1,33 +1,33 @@
make: "varmod.mk" line 101: To escape a dollar, use \$, not $$, at "$$:L} != """
make: "varmod.mk" line 101: Invalid variable name ':', at "$:L} != """
-make: "varmod.mk" line 107: while evaluating "${:Uword:@word@${word}$@} != "word"": Dollar followed by nothing
-make: "varmod.mk" line 117: while evaluating variable "VAR": Missing delimiter ':' after modifier "P"
+make: "varmod.mk" line 107: while evaluating "${:Uword:@word@${word}$@} != "word"" with value "word": Dollar followed by nothing
+make: "varmod.mk" line 117: while evaluating variable "VAR" with value "VAR": Missing delimiter ':' after modifier "P"
make: "varmod.mk" line 119: Missing argument for ".error"
-make: Bad modifier ":[99333000222000111000]" for variable "word"
-make: "varmod.mk" line 125: Malformed conditional (${word:L:[99333000222000111000]})
-make: Bad modifier ":[2147483648]" for variable "word"
-make: "varmod.mk" line 128: Malformed conditional (${word:L:[2147483648]})
-make: "varmod.mk" line 135: while evaluating variable "word": Invalid number "99333000222000111000}" for ':range' modifier
-make: "varmod.mk" line 135: Malformed conditional (${word:L:range=99333000222000111000})
-make: "varmod.mk" line 143: while evaluating "${:${:Ugmtime=\\}}": Invalid time value "\"
-make: "varmod.mk" line 143: Malformed conditional (${:${:Ugmtime=\\}})
-make: "varmod.mk" line 158: while evaluating variable "VAR": Dollar followed by nothing
-make: "varmod.mk" line 164: while evaluating variable "VAR": Dollar followed by nothing
-make: "varmod.mk" line 164: while evaluating variable "VAR": Dollar followed by nothing
-make: "varmod.mk" line 174: while evaluating variable "word": Dollar followed by nothing
-make: Bad modifier ":[$]" for variable "word"
-make: "varmod.mk" line 179: Malformed conditional (${word:[$]})
-make: "varmod.mk" line 196: while evaluating variable "VAR": Dollar followed by nothing
-make: "varmod.mk" line 196: while evaluating variable "VAR": Invalid variable name '}', at "$} != "set""
-make: "varmod.mk" line 200: while evaluating "${:Ufallback$} != "fallback"": Invalid variable name '}', at "$} != "fallback""
-make: "varmod.mk" line 205: while evaluating variable "%y": Invalid time value "1000$"
-make: "varmod.mk" line 205: Malformed conditional (${%y:L:gmtime=1000$})
-make: "varmod.mk" line 212: while evaluating variable "%y": Invalid time value "1000$"
-make: "varmod.mk" line 212: Malformed conditional (${%y:L:localtime=1000$})
-make: "varmod.mk" line 218: while evaluating variable "word": Dollar followed by nothing
-make: "varmod.mk" line 222: while evaluating variable "word": Dollar followed by nothing
-make: "varmod.mk" line 227: while evaluating variable ".": Invalid argument 'fallback$' for modifier ':mtime'
-make: "varmod.mk" line 227: Malformed conditional (${.:L:mtime=fallback$})
+make: "varmod.mk" line 126: while evaluating variable "word" with value "word": Bad modifier ":[99333000222000111000]"
+make: "varmod.mk" line 126: Malformed conditional (${word:L:[99333000222000111000]})
+make: "varmod.mk" line 130: while evaluating variable "word" with value "word": Bad modifier ":[2147483648]"
+make: "varmod.mk" line 130: Malformed conditional (${word:L:[2147483648]})
+make: "varmod.mk" line 137: while evaluating variable "word" with value "word": Invalid number "99333000222000111000}" for ':range' modifier
+make: "varmod.mk" line 137: Malformed conditional (${word:L:range=99333000222000111000})
+make: "varmod.mk" line 145: while evaluating "${:${:Ugmtime=\\}}" with value "": Invalid time value "\"
+make: "varmod.mk" line 145: Malformed conditional (${:${:Ugmtime=\\}})
+make: "varmod.mk" line 160: while evaluating variable "VAR" with value "value$": Dollar followed by nothing
+make: "varmod.mk" line 166: while evaluating variable "VAR" with value "value$": Dollar followed by nothing
+make: "varmod.mk" line 166: while evaluating variable "VAR" with value "value$ appended$": Dollar followed by nothing
+make: "varmod.mk" line 176: while evaluating variable "word" with value "word": Dollar followed by nothing
+make: "varmod.mk" line 181: while evaluating variable "word" with value "": Bad modifier ":[$]"
+make: "varmod.mk" line 181: Malformed conditional (${word:[$]})
+make: "varmod.mk" line 198: while evaluating variable "VAR" with value "value$ appended$": Dollar followed by nothing
+make: "varmod.mk" line 198: while evaluating variable "VAR" with value "value<space>appended": Invalid variable name '}', at "$} != "set""
+make: "varmod.mk" line 202: while evaluating "${:Ufallback$} != "fallback"" with value "": Invalid variable name '}', at "$} != "fallback""
+make: "varmod.mk" line 207: while evaluating variable "%y" with value "%y": Invalid time value "1000$"
+make: "varmod.mk" line 207: Malformed conditional (${%y:L:gmtime=1000$})
+make: "varmod.mk" line 214: while evaluating variable "%y" with value "%y": Invalid time value "1000$"
+make: "varmod.mk" line 214: Malformed conditional (${%y:L:localtime=1000$})
+make: "varmod.mk" line 220: while evaluating variable "word" with value "word": Dollar followed by nothing
+make: "varmod.mk" line 224: while evaluating variable "word" with value "word": Dollar followed by nothing
+make: "varmod.mk" line 229: while evaluating variable "." with value ".": Invalid argument 'fallback$' for modifier ':mtime'
+make: "varmod.mk" line 229: Malformed conditional (${.:L:mtime=fallback$})
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/varmod.mk b/contrib/bmake/unit-tests/varmod.mk
index 783f2e329b4a..fbb60d80680f 100644
--- a/contrib/bmake/unit-tests/varmod.mk
+++ b/contrib/bmake/unit-tests/varmod.mk
@@ -1,4 +1,4 @@
-# $NetBSD: varmod.mk,v 1.15 2024/06/06 20:41:50 rillig Exp $
+# $NetBSD: varmod.mk,v 1.18 2024/07/05 19:47:22 rillig Exp $
#
# Tests for variable modifiers, such as :Q, :S,from,to or :Ufallback.
#
@@ -103,7 +103,7 @@ DOLLAR2= ${:U\$}
.endif
# A '$' followed by nothing is an error as well.
-# expect+1: while evaluating "${:Uword:@word@${word}$@} != "word"": Dollar followed by nothing
+# expect+1: while evaluating "${:Uword:@word@${word}$@} != "word"" with value "word": Dollar followed by nothing
.if ${:Uword:@word@${word}$@} != "word"
. error
.endif
@@ -113,7 +113,7 @@ DOLLAR2= ${:U\$}
# XXX: The .error should not be reached since the expression is
# malformed, and this error should be propagated up to Cond_EvalLine.
VAR= STOP
-# expect+1: while evaluating variable "VAR": Missing delimiter ':' after modifier "P"
+# expect+1: while evaluating variable "VAR" with value "VAR": Missing delimiter ':' after modifier "P"
.if ${VAR:P=RE} != "STORE"
# expect+1: Missing argument for ".error"
. error
@@ -121,9 +121,11 @@ VAR= STOP
# Test the word selection modifier ':[n]' with a very large number that is
# larger than ULONG_MAX for any supported platform.
+# expect+2: while evaluating variable "word" with value "word": Bad modifier ":[99333000222000111000]"
# expect+1: Malformed conditional (${word:L:[99333000222000111000]})
.if ${word:L:[99333000222000111000]}
.endif
+# expect+2: while evaluating variable "word" with value "word": Bad modifier ":[2147483648]"
# expect+1: Malformed conditional (${word:L:[2147483648]})
.if ${word:L:[2147483648]}
.endif
@@ -131,14 +133,14 @@ VAR= STOP
# Test the range generation modifier ':range=n' with a very large number that
# is larger than SIZE_MAX for any supported platform.
# expect+2: Malformed conditional (${word:L:range=99333000222000111000})
-# expect+1: while evaluating variable "word": Invalid number "99333000222000111000}" for ':range' modifier
+# expect+1: while evaluating variable "word" with value "word": Invalid number "99333000222000111000}" for ':range' modifier
.if ${word:L:range=99333000222000111000}
.endif
# In an indirect modifier, the delimiter is '\0', which at the same time marks
# the end of the string. The sequence '\\' '\0' is not an escaped delimiter,
# as it would be wrong to skip past the end of the string.
-# expect+2: while evaluating "${:${:Ugmtime=\\}}": Invalid time value "\"
+# expect+2: while evaluating "${:${:Ugmtime=\\}}" with value "": Invalid time value "\"
# expect+1: Malformed conditional (${:${:Ugmtime=\\}})
.if ${:${:Ugmtime=\\}}
. error
@@ -154,13 +156,13 @@ VAR= STOP
.if ${:U:!printf '%s\n' $!} != "\$"
. error
.endif
-# expect+1: while evaluating variable "VAR": Dollar followed by nothing
+# expect+1: while evaluating variable "VAR" with value "value$": Dollar followed by nothing
.if ${VAR::=value$} != "" || ${VAR} != "value"
. error
.endif
${:U }= <space>
-# expect+2: while evaluating variable "VAR": Dollar followed by nothing
-# expect+1: while evaluating variable "VAR": Dollar followed by nothing
+# expect+2: while evaluating variable "VAR" with value "value$": Dollar followed by nothing
+# expect+1: while evaluating variable "VAR" with value "value$ appended$": Dollar followed by nothing
.if ${VAR::+=appended$} != "" || ${VAR} != "value<space>appended"
. error
.endif
@@ -170,11 +172,11 @@ ${:U }= <space>
.if ${0:?then$:else$} != "else\$"
. error
.endif
-# expect+1: while evaluating variable "word": Dollar followed by nothing
+# expect+1: while evaluating variable "word" with value "word": Dollar followed by nothing
.if ${word:L:@w@$w$@} != "word"
. error
.endif
-# expect: make: Bad modifier ":[$]" for variable "word"
+# expect+2: while evaluating variable "word" with value "": Bad modifier ":[$]"
# expect+1: Malformed conditional (${word:[$]})
.if ${word:[$]}
. error
@@ -191,38 +193,38 @@ VAR_DOLLAR= VAR$$
.if ${word:L:C,d,$,} != "wor\$"
. error
.endif
-# expect+2: while evaluating variable "VAR": Invalid variable name '}', at "$} != "set""
-# expect+1: while evaluating variable "VAR": Dollar followed by nothing
+# expect+2: while evaluating variable "VAR" with value "value$ appended$": Dollar followed by nothing
+# expect+1: while evaluating variable "VAR" with value "value<space>appended": Invalid variable name '}', at "$} != "set""
.if ${VAR:Dset$} != "set"
. error
.endif
-# expect+1: while evaluating "${:Ufallback$} != "fallback"": Invalid variable name '}', at "$} != "fallback""
+# expect+1: while evaluating "${:Ufallback$} != "fallback"" with value "": Invalid variable name '}', at "$} != "fallback""
.if ${:Ufallback$} != "fallback"
. error
.endif
# expect+2: Malformed conditional (${%y:L:gmtime=1000$})
-# expect+1: while evaluating variable "%y": Invalid time value "1000$"
+# expect+1: while evaluating variable "%y" with value "%y": Invalid time value "1000$"
.if ${%y:L:gmtime=1000$}
. error
.else
. error
.endif
# expect+2: Malformed conditional (${%y:L:localtime=1000$})
-# expect+1: while evaluating variable "%y": Invalid time value "1000$"
+# expect+1: while evaluating variable "%y" with value "%y": Invalid time value "1000$"
.if ${%y:L:localtime=1000$}
. error
.else
. error
.endif
-# expect+1: while evaluating variable "word": Dollar followed by nothing
+# expect+1: while evaluating variable "word" with value "word": Dollar followed by nothing
.if ${word:L:Mw*$} != "word"
. error
.endif
-# expect+1: while evaluating variable "word": Dollar followed by nothing
+# expect+1: while evaluating variable "word" with value "word": Dollar followed by nothing
.if ${word:L:NX*$} != "word"
. error
.endif
-# expect+2: while evaluating variable ".": Invalid argument 'fallback$' for modifier ':mtime'
+# expect+2: while evaluating variable "." with value ".": Invalid argument 'fallback$' for modifier ':mtime'
# expect+1: Malformed conditional (${.:L:mtime=fallback$})
.if ${.:L:mtime=fallback$}
. error
diff --git a/contrib/bmake/unit-tests/varname-dot-newline.exp b/contrib/bmake/unit-tests/varname-dot-newline.exp
index 74b69a5f250b..6817b2a26339 100644
--- a/contrib/bmake/unit-tests/varname-dot-newline.exp
+++ b/contrib/bmake/unit-tests/varname-dot-newline.exp
@@ -1,8 +1,11 @@
make: "varname-dot-newline.mk" line 28: Cannot overwrite ".newline" as it is read-only
+ in directory <curdir>
make: "varname-dot-newline.mk" line 30: Cannot append to ".newline" as it is read-only
+ in directory <curdir>
make: "varname-dot-newline.mk" line 32: Cannot delete ".newline" as it is read-only
+ in directory <curdir>
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "try-to-modify" in unit-tests
first
second
backslash newline: <\
diff --git a/contrib/bmake/unit-tests/varname-make_print_var_on_error-jobs.exp b/contrib/bmake/unit-tests/varname-make_print_var_on_error-jobs.exp
index 81bea0e99ae9..abb8448be90e 100644
--- a/contrib/bmake/unit-tests/varname-make_print_var_on_error-jobs.exp
+++ b/contrib/bmake/unit-tests/varname-make_print_var_on_error-jobs.exp
@@ -2,7 +2,7 @@ echo fail all; false 'all' '${.TARGET}' '$${.TARGET}'
fail all
*** [all] Error code 1
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
.ERROR_TARGET='all'
.ERROR_CMD='@: before '${.TARGET}' '${.TARGET}' '$${.TARGET}' echo fail ${.TARGET}; false '${.TARGET}' '${.TARGET}' '$${.TARGET}' @: after '${.TARGET}' '${.TARGET}' '$${.TARGET}''
exit status 1
diff --git a/contrib/bmake/unit-tests/varname-make_print_var_on_error.exp b/contrib/bmake/unit-tests/varname-make_print_var_on_error.exp
index f23deb3568d6..5ced518b3e3f 100644
--- a/contrib/bmake/unit-tests/varname-make_print_var_on_error.exp
+++ b/contrib/bmake/unit-tests/varname-make_print_var_on_error.exp
@@ -3,7 +3,7 @@ fail all
*** Error code 1 (continuing)
Stop.
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
.ERROR_TARGET='all'
.ERROR_CMD=''
exit status 1
diff --git a/contrib/bmake/unit-tests/varname.exp b/contrib/bmake/unit-tests/varname.exp
index 640f228f8a51..9351b0761e98 100644
--- a/contrib/bmake/unit-tests/varname.exp
+++ b/contrib/bmake/unit-tests/varname.exp
@@ -17,5 +17,5 @@ Global: VAR((( = try3
Global: .MAKEFLAGS = -r -k -d v -d
Global: .MAKEFLAGS = -r -k -d v -d 0
make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
+make: stopped making "all" in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/varparse-errors.exp b/contrib/bmake/unit-tests/varparse-errors.exp
index 20fee23bddae..9ca443c6fd67 100644
--- a/contrib/bmake/unit-tests/varparse-errors.exp
+++ b/contrib/bmake/unit-tests/varparse-errors.exp
@@ -1,25 +1,25 @@
-make: "varparse-errors.mk" line 38: while evaluating "${:U:Z}": Unknown modifier "Z"
-make: "varparse-errors.mk" line 47: while evaluating "${:U:Z}post": Unknown modifier "Z"
-make: Bad modifier ":OX" for variable ""
-make: "varparse-errors.mk" line 71: Undefined variable "${:U:OX"
-make: Bad modifier ":OX" for variable ""
-make: Bad modifier ":OX" for variable ""
-make: "varparse-errors.mk" line 71: Undefined variable "${:U:OX"
-make: Bad modifier ":OX" for variable ""
-make: Unclosed expression, expecting '}' for modifier "Q" of variable "" with value ""
-make: Unclosed expression, expecting '}' for modifier "sh" of variable "" with value ""
-make: Unclosed expression, expecting '}' for modifier "tA" of variable "" with value ""
-make: Unclosed expression, expecting '}' for modifier "tsX" of variable "" with value ""
-make: Unclosed expression, expecting '}' for modifier "ts" of variable "" with value ""
-make: Unclosed expression, expecting '}' for modifier "ts\040" of variable "" with value ""
-make: Unclosed expression, expecting '}' for modifier "u" of variable "" with value ""
-make: Unclosed expression, expecting '}' for modifier "H" of variable "" with value "."
-make: Unclosed expression, expecting '}' for modifier "[1]" of variable "" with value ""
-make: Unclosed expression, expecting '}' for modifier "hash" of variable "" with value "b2af338b"
-make: Unclosed expression, expecting '}' for modifier "range" of variable "" with value "1"
-make: Unclosed expression, expecting '}' for modifier "_" of variable "" with value ""
-make: Unclosed expression, expecting '}' for modifier "gmtime" of variable "" with value "<timestamp>"
-make: Unclosed expression, expecting '}' for modifier "localtime" of variable "" with value "<timestamp>"
+make: "varparse-errors.mk" line 38: while evaluating "${:U:Z}" with value "": Unknown modifier "Z"
+make: "varparse-errors.mk" line 47: while evaluating "${:U:Z}post" with value "": Unknown modifier "Z"
+make: "varparse-errors.mk" line 75: while evaluating "${:U:OX:U${IND}} ${:U:OX:U${IND}}" with value "": Bad modifier ":OX"
+make: "varparse-errors.mk" line 75: Undefined variable "${:U:OX"
+make: "varparse-errors.mk" line 75: while evaluating variable "IND" with value "${:OX}": while evaluating "${:OX}" with value "": Bad modifier ":OX"
+make: "varparse-errors.mk" line 75: while evaluating "${:U:OX:U${IND}}" with value "": Bad modifier ":OX"
+make: "varparse-errors.mk" line 75: Undefined variable "${:U:OX"
+make: "varparse-errors.mk" line 75: while evaluating variable "IND" with value "${:OX}": while evaluating "${:OX}" with value "": Bad modifier ":OX"
+make: "varparse-errors.mk" line 83: while evaluating "${:U:Q" with value "": Unclosed expression, expecting '}' for modifier "Q"
+make: "varparse-errors.mk" line 85: while evaluating "${:U:sh" with value "": Unclosed expression, expecting '}' for modifier "sh"
+make: "varparse-errors.mk" line 87: while evaluating "${:U:tA" with value "": Unclosed expression, expecting '}' for modifier "tA"
+make: "varparse-errors.mk" line 89: while evaluating "${:U:tsX" with value "": Unclosed expression, expecting '}' for modifier "tsX"
+make: "varparse-errors.mk" line 91: while evaluating "${:U:ts" with value "": Unclosed expression, expecting '}' for modifier "ts"
+make: "varparse-errors.mk" line 93: while evaluating "${:U:ts\040" with value "": Unclosed expression, expecting '}' for modifier "ts\040"
+make: "varparse-errors.mk" line 95: while evaluating "${:U:u" with value "": Unclosed expression, expecting '}' for modifier "u"
+make: "varparse-errors.mk" line 97: while evaluating "${:U:H" with value ".": Unclosed expression, expecting '}' for modifier "H"
+make: "varparse-errors.mk" line 99: while evaluating "${:U:[1]" with value "": Unclosed expression, expecting '}' for modifier "[1]"
+make: "varparse-errors.mk" line 101: while evaluating "${:U:hash" with value "b2af338b": Unclosed expression, expecting '}' for modifier "hash"
+make: "varparse-errors.mk" line 103: while evaluating "${:U:range" with value "1": Unclosed expression, expecting '}' for modifier "range"
+make: "varparse-errors.mk" line 105: while evaluating "${:U:_" with value "": Unclosed expression, expecting '}' for modifier "_"
+make: "varparse-errors.mk" line 107: while evaluating "${:U:gmtime" with value "<timestamp>": Unclosed expression, expecting '}' for modifier "gmtime"
+make: "varparse-errors.mk" line 109: while evaluating "${:U:localtime" with value "<timestamp>": Unclosed expression, expecting '}' for modifier "localtime"
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
diff --git a/contrib/bmake/unit-tests/varparse-errors.mk b/contrib/bmake/unit-tests/varparse-errors.mk
index f40e7206b0c3..d10160b816e5 100644
--- a/contrib/bmake/unit-tests/varparse-errors.mk
+++ b/contrib/bmake/unit-tests/varparse-errors.mk
@@ -1,4 +1,4 @@
-# $NetBSD: varparse-errors.mk,v 1.13 2024/06/02 15:31:26 rillig Exp $
+# $NetBSD: varparse-errors.mk,v 1.17 2024/07/05 19:47:22 rillig Exp $
# Tests for parsing and evaluating all kinds of expressions.
#
@@ -34,7 +34,7 @@ ERR_EVAL= An evaluation error ${:Uvalue:C,.,\3,}.
# 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"
+# expect+1: while evaluating "${:U:Z}" with value "": Unknown modifier "Z"
VAR.${:U:Z}= unknown modifier in the variable name
.if ${VAR.} != "unknown modifier in the variable name"
. error
@@ -43,7 +43,7 @@ VAR.${:U:Z}= unknown modifier in the variable name
# 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"
+# expect+1: while evaluating "${:U:Z}post" with value "": 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
@@ -66,8 +66,12 @@ VAR.${:U:Z}post= unknown modifier with text in the variable name
#
#.MAKEFLAGS: -dv
IND= ${:OX}
+# expect+6: while evaluating "${:U:OX:U${IND}} ${:U:OX:U${IND}}" with value "": Bad modifier ":OX"
+# expect+5: while evaluating "${:U:OX:U${IND}}" with value "": Bad modifier ":OX"
+# expect+4: Undefined variable "${:U:OX"
+# expect+3: while evaluating variable "IND" with value "${:OX}": while evaluating "${:OX}" with value "": Bad modifier ":OX"
# expect+2: Undefined variable "${:U:OX"
-# expect+1: Undefined variable "${:U:OX"
+# expect+1: while evaluating variable "IND" with value "${:OX}": while evaluating "${:OX}" with value "": Bad modifier ":OX"
_:= ${:U:OX:U${IND}} ${:U:OX:U${IND}}
#.MAKEFLAGS: -d0
@@ -75,17 +79,31 @@ _:= ${:U:OX:U${IND}} ${:U:OX:U${IND}}
# 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'.
+# expect+1: while evaluating "${:U:Q" with value "": Unclosed expression, expecting '}' for modifier "Q"
UNCLOSED:= ${:U:Q
+# expect+1: while evaluating "${:U:sh" with value "": Unclosed expression, expecting '}' for modifier "sh"
UNCLOSED:= ${:U:sh
+# expect+1: while evaluating "${:U:tA" with value "": Unclosed expression, expecting '}' for modifier "tA"
UNCLOSED:= ${:U:tA
+# expect+1: while evaluating "${:U:tsX" with value "": Unclosed expression, expecting '}' for modifier "tsX"
UNCLOSED:= ${:U:tsX
+# expect+1: while evaluating "${:U:ts" with value "": Unclosed expression, expecting '}' for modifier "ts"
UNCLOSED:= ${:U:ts
+# expect+1: while evaluating "${:U:ts\040" with value "": Unclosed expression, expecting '}' for modifier "ts\040"
UNCLOSED:= ${:U:ts\040
+# expect+1: while evaluating "${:U:u" with value "": Unclosed expression, expecting '}' for modifier "u"
UNCLOSED:= ${:U:u
+# expect+1: while evaluating "${:U:H" with value ".": Unclosed expression, expecting '}' for modifier "H"
UNCLOSED:= ${:U:H
+# expect+1: while evaluating "${:U:[1]" with value "": Unclosed expression, expecting '}' for modifier "[1]"
UNCLOSED:= ${:U:[1]
+# expect+1: while evaluating "${:U:hash" with value "b2af338b": Unclosed expression, expecting '}' for modifier "hash"
UNCLOSED:= ${:U:hash
+# expect+1: while evaluating "${:U:range" with value "1": Unclosed expression, expecting '}' for modifier "range"
UNCLOSED:= ${:U:range
+# expect+1: while evaluating "${:U:_" with value "": Unclosed expression, expecting '}' for modifier "_"
UNCLOSED:= ${:U:_
+# expect+1: while evaluating "${:U:gmtime" with value "<timestamp>": Unclosed expression, expecting '}' for modifier "gmtime"
UNCLOSED:= ${:U:gmtime
+# expect+1: while evaluating "${:U:localtime" with value "<timestamp>": Unclosed expression, expecting '}' for modifier "localtime"
UNCLOSED:= ${:U:localtime