Module Name: src Committed By: rillig Date: Sat Jan 11 20:54:46 UTC 2025
Modified Files: src/usr.bin/make: cond.c var.c src/usr.bin/make/unit-tests: cond-func-empty.exp cond-func-empty.mk cond-token-string.exp cond-token-string.mk cond-undef-lint.exp cond-undef-lint.mk opt-debug-lint.exp opt-debug-lint.mk var-eval-short.exp var-eval-short.mk vardebug.exp vardebug.mk varmod-edge.exp varmod-edge.mk varmod-gmtime.exp varmod-gmtime.mk varmod-ifelse.exp varmod-ifelse.mk varmod-localtime.exp varmod-localtime.mk varmod-loop-varname.exp varmod-loop-varname.mk varmod-match.exp varmod-match.mk varmod-mtime.exp varmod-mtime.mk varmod-order.exp varmod-order.mk varmod-range.exp varmod-range.mk varmod-sysv.exp varmod-sysv.mk varmod-to-separator.exp varmod-to-separator.mk varmod.exp varmod.mk Log Message: make: omit redundant follow-up message "Malformed conditional" If there is a parse error or an evaluation error during the conditional, the conditional is already mentioned in the "while evaluating condition" line, so there's no reason to repeat it once again. Same for the "Bad condition" message from the '?:' modifier. To generate a diff of this commit: cvs rdiff -u -r1.369 -r1.370 src/usr.bin/make/cond.c cvs rdiff -u -r1.1142 -r1.1143 src/usr.bin/make/var.c cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/cond-func-empty.exp cvs rdiff -u -r1.27 -r1.28 src/usr.bin/make/unit-tests/cond-func-empty.mk cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/cond-token-string.exp \ src/usr.bin/make/unit-tests/var-eval-short.mk \ src/usr.bin/make/unit-tests/varmod-order.exp \ src/usr.bin/make/unit-tests/varmod-sysv.exp cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/cond-token-string.mk \ src/usr.bin/make/unit-tests/vardebug.mk cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/cond-undef-lint.exp cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/cond-undef-lint.mk cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/unit-tests/opt-debug-lint.exp \ src/usr.bin/make/unit-tests/varmod-gmtime.exp \ src/usr.bin/make/unit-tests/varmod-match.exp cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/opt-debug-lint.mk \ src/usr.bin/make/unit-tests/varmod-sysv.mk \ src/usr.bin/make/unit-tests/varmod.mk cvs rdiff -u -r1.32 -r1.33 src/usr.bin/make/unit-tests/var-eval-short.exp \ src/usr.bin/make/unit-tests/varmod-edge.mk cvs rdiff -u -r1.38 -r1.39 src/usr.bin/make/unit-tests/vardebug.exp cvs rdiff -u -r1.28 -r1.29 src/usr.bin/make/unit-tests/varmod-edge.exp \ src/usr.bin/make/unit-tests/varmod-match.mk cvs rdiff -u -r1.26 -r1.27 src/usr.bin/make/unit-tests/varmod-gmtime.mk cvs rdiff -u -r1.25 -r1.26 src/usr.bin/make/unit-tests/varmod-ifelse.exp cvs rdiff -u -r1.34 -r1.35 src/usr.bin/make/unit-tests/varmod-ifelse.mk cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/varmod-localtime.exp \ src/usr.bin/make/unit-tests/varmod-localtime.mk cvs rdiff -u -r1.12 -r1.13 \ src/usr.bin/make/unit-tests/varmod-loop-varname.exp cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/varmod-loop-varname.mk \ src/usr.bin/make/unit-tests/varmod-mtime.exp cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/varmod-mtime.mk cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/unit-tests/varmod-order.mk \ src/usr.bin/make/unit-tests/varmod-range.exp \ src/usr.bin/make/unit-tests/varmod.exp cvs rdiff -u -r1.15 -r1.16 src/usr.bin/make/unit-tests/varmod-range.mk cvs rdiff -u -r1.18 -r1.19 \ src/usr.bin/make/unit-tests/varmod-to-separator.exp cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/unit-tests/varmod-to-separator.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/make/cond.c diff -u src/usr.bin/make/cond.c:1.369 src/usr.bin/make/cond.c:1.370 --- src/usr.bin/make/cond.c:1.369 Wed Aug 7 05:48:45 2024 +++ src/usr.bin/make/cond.c Sat Jan 11 20:54:45 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: cond.c,v 1.369 2024/08/07 05:48:45 rillig Exp $ */ +/* $NetBSD: cond.c,v 1.370 2025/01/11 20:54:45 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -91,7 +91,7 @@ #include "dir.h" /* "@(#)cond.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: cond.c,v 1.369 2024/08/07 05:48:45 rillig Exp $"); +MAKE_RCSID("$NetBSD: cond.c,v 1.370 2025/01/11 20:54:45 rillig Exp $"); /* * Conditional expressions conform to this grammar: @@ -925,6 +925,7 @@ CondEvalExpression(const char *cond, boo { CondParser par; CondResult rval; + int parseErrorsBefore = parseErrors; cpp_skip_hspace(&cond); @@ -941,7 +942,8 @@ CondEvalExpression(const char *cond, boo if (par.curr != TOK_EOF) rval = CR_ERROR; - if (rval == CR_ERROR && eprint && !par.printedError) + if (rval == CR_ERROR && eprint && !par.printedError + && parseErrors == parseErrorsBefore) Parse_Error(PARSE_FATAL, "Malformed conditional '%s'", cond); return rval; Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.1142 src/usr.bin/make/var.c:1.1143 --- src/usr.bin/make/var.c:1.1142 Tue Dec 31 09:35:21 2024 +++ src/usr.bin/make/var.c Sat Jan 11 20:54:45 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1142 2024/12/31 09:35:21 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1143 2025/01/11 20:54:45 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -128,7 +128,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1142 2024/12/31 09:35:21 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1143 2025/01/11 20:54:45 rillig Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -3471,8 +3471,9 @@ ApplyModifier_IfElse(const char **pp, Mo VarEvalMode then_emode = VARE_PARSE; VarEvalMode else_emode = VARE_PARSE; + int parseErrorsBefore = parseErrors, parseErrorsAfter = parseErrors; - CondResult cond_rc = CR_TRUE; /* just not CR_ERROR */ + CondResult cond_rc = CR_TRUE; /* anything other than CR_ERROR */ if (Expr_ShouldEval(expr)) { evalStack.elems[evalStack.len - 1].kind = VSK_COND; cond_rc = Cond_EvalCondition(expr->name); @@ -3480,6 +3481,7 @@ ApplyModifier_IfElse(const char **pp, Mo then_emode = expr->emode; if (cond_rc == CR_FALSE) else_emode = expr->emode; + parseErrorsAfter = parseErrors; } evalStack.elems[evalStack.len - 1].kind = VSK_COND_THEN; @@ -3499,7 +3501,8 @@ ApplyModifier_IfElse(const char **pp, Mo if (cond_rc == CR_ERROR) { evalStack.elems[evalStack.len - 1].kind = VSK_COND; - Parse_Error(PARSE_FATAL, "Bad condition"); + if (parseErrorsAfter == parseErrorsBefore) + Parse_Error(PARSE_FATAL, "Bad condition"); LazyBuf_Done(&thenBuf); LazyBuf_Done(&elseBuf); return AMR_CLEANUP; Index: src/usr.bin/make/unit-tests/cond-func-empty.exp diff -u src/usr.bin/make/unit-tests/cond-func-empty.exp:1.8 src/usr.bin/make/unit-tests/cond-func-empty.exp:1.9 --- src/usr.bin/make/unit-tests/cond-func-empty.exp:1.8 Tue Aug 6 18:00:16 2024 +++ src/usr.bin/make/unit-tests/cond-func-empty.exp Sat Jan 11 20:54:45 2025 @@ -1,5 +1,4 @@ -make: "cond-func-empty.mk" line 168: Unclosed variable "WORD" -make: "cond-func-empty.mk" line 168: Malformed conditional 'empty(WORD' +make: "cond-func-empty.mk" line 167: Unclosed variable "WORD" make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 Index: src/usr.bin/make/unit-tests/cond-func-empty.mk diff -u src/usr.bin/make/unit-tests/cond-func-empty.mk:1.27 src/usr.bin/make/unit-tests/cond-func-empty.mk:1.28 --- src/usr.bin/make/unit-tests/cond-func-empty.mk:1.27 Fri Jan 10 23:00:38 2025 +++ src/usr.bin/make/unit-tests/cond-func-empty.mk Sat Jan 11 20:54:45 2025 @@ -1,4 +1,4 @@ -# $NetBSD: cond-func-empty.mk,v 1.27 2025/01/10 23:00:38 rillig Exp $ +# $NetBSD: cond-func-empty.mk,v 1.28 2025/01/11 20:54:45 rillig Exp $ # # Tests for the empty() function in .if conditions, which tests an # expression for emptiness. @@ -163,8 +163,7 @@ ${:U WORD }= variable name with spaces . error .endif -# expect+2: Unclosed variable "WORD" -# expect+1: Malformed conditional 'empty(WORD' +# expect+1: Unclosed variable "WORD" .if empty(WORD . error .else Index: src/usr.bin/make/unit-tests/cond-token-string.exp diff -u src/usr.bin/make/unit-tests/cond-token-string.exp:1.16 src/usr.bin/make/unit-tests/cond-token-string.exp:1.17 --- src/usr.bin/make/unit-tests/cond-token-string.exp:1.16 Thu Aug 29 20:20:36 2024 +++ src/usr.bin/make/unit-tests/cond-token-string.exp Sat Jan 11 20:54:45 2025 @@ -1,19 +1,18 @@ -make: "cond-token-string.mk" line 15: Unknown modifier "Z" +make: "cond-token-string.mk" line 14: Unknown modifier "Z" while evaluating "${:Uvalue:Z}"" with value "value" -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} == ""' -make: "cond-token-string.mk" line 42: Expected. +make: "cond-token-string.mk" line 24: xvalue is not defined. +make: "cond-token-string.mk" line 31: Malformed conditional 'x${:Uvalue} == ""' +make: "cond-token-string.mk" line 41: Expected. CondParser_Eval: "UNDEF" -make: "cond-token-string.mk" line 52: The string literal "UNDEF" is not empty. +make: "cond-token-string.mk" line 51: The string literal "UNDEF" is not empty. CondParser_Eval: " " -make: "cond-token-string.mk" line 61: The string literal " " is not empty, even though it consists of whitespace only. +make: "cond-token-string.mk" line 60: The string literal " " is not empty, even though it consists of whitespace only. CondParser_Eval: "${UNDEF}" -make: "cond-token-string.mk" line 71: An undefined variable in quotes expands to an empty string, which then evaluates to false. +make: "cond-token-string.mk" line 70: An undefined variable in quotes expands to an empty string, which then evaluates to false. CondParser_Eval: "${:Uvalue}" -make: "cond-token-string.mk" line 77: A nonempty expression evaluates to true. +make: "cond-token-string.mk" line 76: A nonempty expression evaluates to true. CondParser_Eval: "${:U}" -make: "cond-token-string.mk" line 86: An empty variable evaluates to false. +make: "cond-token-string.mk" line 85: An empty variable evaluates to false. CondParser_Eval: ("${VAR}") CondParser_Eval: "quoted" == quoted Comparing "quoted" == "quoted" Index: src/usr.bin/make/unit-tests/var-eval-short.mk diff -u src/usr.bin/make/unit-tests/var-eval-short.mk:1.16 src/usr.bin/make/unit-tests/var-eval-short.mk:1.17 --- src/usr.bin/make/unit-tests/var-eval-short.mk:1.16 Thu Aug 29 20:20:36 2024 +++ src/usr.bin/make/unit-tests/var-eval-short.mk Sat Jan 11 20:54:45 2025 @@ -1,4 +1,4 @@ -# $NetBSD: var-eval-short.mk,v 1.16 2024/08/29 20:20:36 rillig Exp $ +# $NetBSD: var-eval-short.mk,v 1.17 2025/01/11 20:54:45 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,8 +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: In the :@ modifier, the variable name "${FAIL}" must not contain a dollar -# expect+1: Malformed conditional '0 && ${:Uword:@${FAIL}@expr@}' +# expect+1: In the :@ modifier, the variable name "${FAIL}" must not contain a dollar .if 0 && ${:Uword:@${FAIL}@expr@} .endif Index: src/usr.bin/make/unit-tests/varmod-order.exp diff -u src/usr.bin/make/unit-tests/varmod-order.exp:1.16 src/usr.bin/make/unit-tests/varmod-order.exp:1.17 --- src/usr.bin/make/unit-tests/varmod-order.exp:1.16 Thu Aug 29 20:20:36 2024 +++ src/usr.bin/make/unit-tests/varmod-order.exp Sat Jan 11 20:54:46 2025 @@ -8,30 +8,22 @@ make: "varmod-order.mk" line 22: Unclose while evaluating variable "NUMBERS" with value "1 2 3 4 5 6 7 8 9 10" make: "varmod-order.mk" line 24: Unclosed expression, expecting '}' for modifier "Onr" while evaluating variable "NUMBERS" with value "10 9 8 7 6 5 4 3 2 1" -make: "varmod-order.mk" line 31: Bad modifier ":Oxn" +make: "varmod-order.mk" line 30: Bad modifier ":Oxn" while evaluating variable "NUMBERS" with value "8 5 4 9 1 7 6 10 3 2" -make: "varmod-order.mk" line 31: Malformed conditional '${NUMBERS:Oxn}' -make: "varmod-order.mk" line 41: Bad modifier ":On_typo" +make: "varmod-order.mk" line 39: Bad modifier ":On_typo" while evaluating variable "NUMBERS" with value "8 5 4 9 1 7 6 10 3 2" -make: "varmod-order.mk" line 41: Malformed conditional '${NUMBERS:On_typo}' -make: "varmod-order.mk" line 51: Bad modifier ":Onr_typo" +make: "varmod-order.mk" line 48: Bad modifier ":Onr_typo" while evaluating variable "NUMBERS" with value "8 5 4 9 1 7 6 10 3 2" -make: "varmod-order.mk" line 51: Malformed conditional '${NUMBERS:Onr_typo}' -make: "varmod-order.mk" line 61: Bad modifier ":Orn_typo" +make: "varmod-order.mk" line 57: Bad modifier ":Orn_typo" while evaluating variable "NUMBERS" with value "8 5 4 9 1 7 6 10 3 2" -make: "varmod-order.mk" line 61: Malformed conditional '${NUMBERS:Orn_typo}' -make: "varmod-order.mk" line 73: Bad modifier ":Onn" +make: "varmod-order.mk" line 68: Bad modifier ":Onn" while evaluating variable "NUMBERS" with value "8 5 4 9 1 7 6 10 3 2" -make: "varmod-order.mk" line 73: Malformed conditional '${NUMBERS:Onn}' -make: "varmod-order.mk" line 83: Bad modifier ":Onrr" +make: "varmod-order.mk" line 77: Bad modifier ":Onrr" while evaluating variable "NUMBERS" with value "8 5 4 9 1 7 6 10 3 2" -make: "varmod-order.mk" line 83: Malformed conditional '${NUMBERS:Onrr}' -make: "varmod-order.mk" line 93: Bad modifier ":Orrn" +make: "varmod-order.mk" line 86: Bad modifier ":Orrn" while evaluating variable "NUMBERS" with value "8 5 4 9 1 7 6 10 3 2" -make: "varmod-order.mk" line 93: Malformed conditional '${NUMBERS:Orrn}' -make: "varmod-order.mk" line 108: Bad modifier ":On=Off" +make: "varmod-order.mk" line 100: Bad modifier ":On=Off" while evaluating variable "SWITCH" with value "On" -make: "varmod-order.mk" line 108: Malformed conditional '${SWITCH:On=Off} != "Off"' make: Fatal errors encountered -- cannot continue make: stopped making "all" in unit-tests exit status 1 Index: src/usr.bin/make/unit-tests/varmod-sysv.exp diff -u src/usr.bin/make/unit-tests/varmod-sysv.exp:1.16 src/usr.bin/make/unit-tests/varmod-sysv.exp:1.17 --- src/usr.bin/make/unit-tests/varmod-sysv.exp:1.16 Thu Aug 29 20:20:37 2024 +++ src/usr.bin/make/unit-tests/varmod-sysv.exp Sat Jan 11 20:54:46 2025 @@ -1,6 +1,5 @@ -make: "varmod-sysv.mk" line 216: Unfinished modifier ('=' missing) +make: "varmod-sysv.mk" line 215: Unfinished modifier ('=' missing) while evaluating variable "word216" with value "word216" -make: "varmod-sysv.mk" line 216: Malformed conditional '${word216:L:from${:D=}to}' word modifier result '' = "" suffix = "suffix" @@ -146,9 +145,8 @@ pre-middle-suffix pre%ffix=NPre% suffix pre%ffix=NPre%NS "suffix" prefix pre%ffix=NPre%NS "prefix" pre-middle-suffix pre%ffix=NPre%NS "NPre-middle-suNS" -make: "varmod-sysv.mk" line 261: Unfinished modifier ('}' missing) +make: "varmod-sysv.mk" line 259: Unfinished modifier ('}' missing) while evaluating variable "error" with value "error" -make: "varmod-sysv.mk" line 261: Malformed conditional '${error:L:from=$(})' make: Fatal errors encountered -- cannot continue make: stopped making "all" in unit-tests exit status 1 Index: src/usr.bin/make/unit-tests/cond-token-string.mk diff -u src/usr.bin/make/unit-tests/cond-token-string.mk:1.14 src/usr.bin/make/unit-tests/cond-token-string.mk:1.15 --- src/usr.bin/make/unit-tests/cond-token-string.mk:1.14 Sat Jan 11 20:16:40 2025 +++ src/usr.bin/make/unit-tests/cond-token-string.mk Sat Jan 11 20:54:45 2025 @@ -1,4 +1,4 @@ -# $NetBSD: cond-token-string.mk,v 1.14 2025/01/11 20:16:40 rillig Exp $ +# $NetBSD: cond-token-string.mk,v 1.15 2025/01/11 20:54:45 rillig Exp $ # # Tests for quoted string literals in .if conditions. # @@ -10,8 +10,7 @@ # Cover the code in CondParser_String that frees the memory after parsing # an expression based on an undefined variable. -# expect+2: Unknown modifier "Z" -# expect+1: Malformed conditional '"" != "${:Uvalue:Z}"' +# expect+1: Unknown modifier "Z" .if "" != "${:Uvalue:Z}" . error .else Index: src/usr.bin/make/unit-tests/vardebug.mk diff -u src/usr.bin/make/unit-tests/vardebug.mk:1.14 src/usr.bin/make/unit-tests/vardebug.mk:1.15 --- src/usr.bin/make/unit-tests/vardebug.mk:1.14 Sat Jan 11 20:16:40 2025 +++ src/usr.bin/make/unit-tests/vardebug.mk Sat Jan 11 20:54:45 2025 @@ -1,4 +1,4 @@ -# $NetBSD: vardebug.mk,v 1.14 2025/01/11 20:16:40 rillig Exp $ +# $NetBSD: vardebug.mk,v 1.15 2025/01/11 20:54:45 rillig Exp $ # # Demonstrates the debugging output for var.c. @@ -58,8 +58,7 @@ VAR+= 3 # When ApplyModifiers results in an error, this appears in the debug log # as "is error", without surrounding quotes. # expect: Result of ${:unknown} is error (eval-defined, defined) -# expect+2: Unknown modifier "unknown" -# expect+1: Malformed conditional '${:Uvariable:unknown}' +# expect+1: Unknown modifier "unknown" .if ${:Uvariable:unknown} .endif Index: src/usr.bin/make/unit-tests/cond-undef-lint.exp diff -u src/usr.bin/make/unit-tests/cond-undef-lint.exp:1.7 src/usr.bin/make/unit-tests/cond-undef-lint.exp:1.8 --- src/usr.bin/make/unit-tests/cond-undef-lint.exp:1.7 Tue Aug 6 18:00:17 2024 +++ src/usr.bin/make/unit-tests/cond-undef-lint.exp Sat Jan 11 20:54:45 2025 @@ -1,10 +1,7 @@ -make: "cond-undef-lint.mk" line 25: Variable "UNDEF" is undefined -make: "cond-undef-lint.mk" line 25: Malformed conditional '${UNDEF}' -make: "cond-undef-lint.mk" line 43: Variable "UNDEF" is undefined -make: "cond-undef-lint.mk" line 43: Variable "VAR." is undefined -make: "cond-undef-lint.mk" line 43: Malformed conditional '${VAR.${UNDEF}}' -make: "cond-undef-lint.mk" line 56: Variable "VAR.defined" is undefined -make: "cond-undef-lint.mk" line 56: Malformed conditional '${VAR.${DEF}}' +make: "cond-undef-lint.mk" line 24: Variable "UNDEF" is undefined +make: "cond-undef-lint.mk" line 41: Variable "UNDEF" is undefined +make: "cond-undef-lint.mk" line 41: Variable "VAR." is undefined +make: "cond-undef-lint.mk" line 53: Variable "VAR.defined" is undefined make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 Index: src/usr.bin/make/unit-tests/cond-undef-lint.mk diff -u src/usr.bin/make/unit-tests/cond-undef-lint.mk:1.6 src/usr.bin/make/unit-tests/cond-undef-lint.mk:1.7 --- src/usr.bin/make/unit-tests/cond-undef-lint.mk:1.6 Sat Jan 11 20:16:40 2025 +++ src/usr.bin/make/unit-tests/cond-undef-lint.mk Sat Jan 11 20:54:45 2025 @@ -1,4 +1,4 @@ -# $NetBSD: cond-undef-lint.mk,v 1.6 2025/01/11 20:16:40 rillig Exp $ +# $NetBSD: cond-undef-lint.mk,v 1.7 2025/01/11 20:54:45 rillig Exp $ # # Tests for defined and undefined variables in .if conditions, in lint mode. # @@ -20,8 +20,7 @@ DEF= defined .endif # Since the condition fails to evaluate, neither of the branches is taken. -# expect+2: Variable "UNDEF" is undefined -# expect+1: Malformed conditional '${UNDEF}' +# expect+1: Variable "UNDEF" is undefined .if ${UNDEF} . error .else @@ -37,9 +36,8 @@ DEF= defined # # TODO: Suppress the error message "Variable VAR. is undefined". That part # of the expression must not be evaluated at all. -# expect+3: Variable "UNDEF" is undefined -# expect+2: Variable "VAR." is undefined -# expect+1: Malformed conditional '${VAR.${UNDEF}}' +# expect+2: Variable "UNDEF" is undefined +# expect+1: Variable "VAR." is undefined .if ${VAR.${UNDEF}} . error .else @@ -51,8 +49,7 @@ DEF= defined # TODO: This pattern looks a lot like CFLAGS.${OPSYS}, which is at least # debatable. Or would any practical use of CFLAGS.${OPSYS} be via an indirect # expression, as in the next example? -# expect+2: Variable "VAR.defined" is undefined -# expect+1: Malformed conditional '${VAR.${DEF}}' +# expect+1: Variable "VAR.defined" is undefined .if ${VAR.${DEF}} . error .else Index: src/usr.bin/make/unit-tests/opt-debug-lint.exp diff -u src/usr.bin/make/unit-tests/opt-debug-lint.exp:1.22 src/usr.bin/make/unit-tests/opt-debug-lint.exp:1.23 --- src/usr.bin/make/unit-tests/opt-debug-lint.exp:1.22 Thu Aug 29 20:20:36 2024 +++ src/usr.bin/make/unit-tests/opt-debug-lint.exp Sat Jan 11 20:54:45 2025 @@ -1,12 +1,10 @@ -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: Missing delimiter ':' after modifier "L" +make: "opt-debug-lint.mk" line 20: Variable "X" is undefined +make: "opt-debug-lint.mk" line 43: Variable "UNDEF" is undefined +make: "opt-debug-lint.mk" line 65: Missing delimiter ':' after modifier "L" while evaluating variable "value" with value "value" -make: "opt-debug-lint.mk" line 67: Missing delimiter ':' after modifier "P" +make: "opt-debug-lint.mk" line 65: Missing delimiter ':' after modifier "P" while evaluating variable "value" with value "value" -make: "opt-debug-lint.mk" line 76: Unknown modifier "${" +make: "opt-debug-lint.mk" line 74: Unknown modifier "${" while evaluating variable "value" with value "" make: Fatal errors encountered -- cannot continue make: stopped in unit-tests Index: src/usr.bin/make/unit-tests/varmod-gmtime.exp diff -u src/usr.bin/make/unit-tests/varmod-gmtime.exp:1.22 src/usr.bin/make/unit-tests/varmod-gmtime.exp:1.23 --- src/usr.bin/make/unit-tests/varmod-gmtime.exp:1.22 Thu Aug 29 20:20:36 2024 +++ src/usr.bin/make/unit-tests/varmod-gmtime.exp Sat Jan 11 20:54:45 2025 @@ -1,18 +1,13 @@ -make: "varmod-gmtime.mk" line 61: Invalid time value "-1" +make: "varmod-gmtime.mk" line 60: Invalid time value "-1" while evaluating "${:L:gmtime=-1} != """ with value "" -make: "varmod-gmtime.mk" line 61: Malformed conditional '${:L:gmtime=-1} != ""' -make: "varmod-gmtime.mk" line 72: Invalid time value " 1" +make: "varmod-gmtime.mk" line 70: Invalid time value " 1" while evaluating "${:L:gmtime= 1} != """ with value "" -make: "varmod-gmtime.mk" line 72: Malformed conditional '${:L:gmtime= 1} != ""' -make: "varmod-gmtime.mk" line 120: Invalid time value "10000000000000000000000000000000" +make: "varmod-gmtime.mk" line 117: Invalid time value "10000000000000000000000000000000" while evaluating "${:L:gmtime=10000000000000000000000000000000} != """ with value "" -make: "varmod-gmtime.mk" line 120: Malformed conditional '${:L:gmtime=10000000000000000000000000000000} != ""' -make: "varmod-gmtime.mk" line 133: Invalid time value "error" +make: "varmod-gmtime.mk" line 129: Invalid time value "error" while evaluating "${:L:gmtime=error} != """ with value "" -make: "varmod-gmtime.mk" line 133: Malformed conditional '${:L:gmtime=error} != ""' -make: "varmod-gmtime.mk" line 144: Invalid time value "100000S,1970,bad," +make: "varmod-gmtime.mk" line 139: Invalid time value "100000S,1970,bad," while evaluating variable "%Y" with value "%Y" -make: "varmod-gmtime.mk" line 144: Malformed conditional '${%Y:L:gmtime=100000S,1970,bad,} != "bad"' make: Fatal errors encountered -- cannot continue make: stopped making "all" in unit-tests exit status 1 Index: src/usr.bin/make/unit-tests/varmod-match.exp diff -u src/usr.bin/make/unit-tests/varmod-match.exp:1.22 src/usr.bin/make/unit-tests/varmod-match.exp:1.23 --- src/usr.bin/make/unit-tests/varmod-match.exp:1.22 Thu Aug 29 20:20:36 2024 +++ src/usr.bin/make/unit-tests/varmod-match.exp Sat Jan 11 20:54:46 2025 @@ -14,11 +14,10 @@ make: "varmod-match.mk" line 344: Unfini while evaluating variable "WORDS" with value "[x- x x- y" make: "varmod-match.mk" line 356: Unfinished character range in pattern '[^x-' of modifier ':M' while evaluating variable "WORDS" with value "[x- x x- y yyyyy" -make: "varmod-match.mk" line 364: Unfinished character list in pattern '[' of modifier ':M' +make: "varmod-match.mk" line 363: Unfinished character list in pattern '[' of modifier ':M' while evaluating variable " : :: " with value " : :: " -make: "varmod-match.mk" line 364: Unknown modifier "]" +make: "varmod-match.mk" line 363: Unknown modifier "]" while evaluating variable " : :: " with value "" -make: "varmod-match.mk" line 364: Malformed conditional '${ ${:U\:} ${:U\:\:} :L:M[:]} != ":"' make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 Index: src/usr.bin/make/unit-tests/opt-debug-lint.mk diff -u src/usr.bin/make/unit-tests/opt-debug-lint.mk:1.21 src/usr.bin/make/unit-tests/opt-debug-lint.mk:1.22 --- src/usr.bin/make/unit-tests/opt-debug-lint.mk:1.21 Sat Jan 11 20:16:40 2025 +++ src/usr.bin/make/unit-tests/opt-debug-lint.mk Sat Jan 11 20:54:45 2025 @@ -1,4 +1,4 @@ -# $NetBSD: opt-debug-lint.mk,v 1.21 2025/01/11 20:16:40 rillig Exp $ +# $NetBSD: opt-debug-lint.mk,v 1.22 2025/01/11 20:54:45 rillig Exp $ # # Tests for the -dL command line option, which runs additional checks # to catch common mistakes, such as unclosed expressions. @@ -16,8 +16,7 @@ # # See also: # cond-undef-lint.mk -# expect+2: Variable "X" is undefined -# expect+1: Malformed conditional '$X' +# expect+1: Variable "X" is undefined .if $X . error .endif @@ -40,8 +39,7 @@ # hoping for the caller to print an error message. This resulted in the # well-known "Malformed conditional" error message, even though the # conditional was well-formed and the only error was an undefined variable. -# expect+2: Variable "UNDEF" is undefined -# expect+1: Malformed conditional '${UNDEF}' +# expect+1: Variable "UNDEF" is undefined .if ${UNDEF} . error .endif Index: src/usr.bin/make/unit-tests/varmod-sysv.mk diff -u src/usr.bin/make/unit-tests/varmod-sysv.mk:1.21 src/usr.bin/make/unit-tests/varmod-sysv.mk:1.22 --- src/usr.bin/make/unit-tests/varmod-sysv.mk:1.21 Thu Aug 29 20:20:37 2024 +++ src/usr.bin/make/unit-tests/varmod-sysv.mk Sat Jan 11 20:54:46 2025 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-sysv.mk,v 1.21 2024/08/29 20:20:37 rillig Exp $ +# $NetBSD: varmod-sysv.mk,v 1.22 2025/01/11 20:54:46 rillig Exp $ # # Tests for the variable modifier ':from=to', which replaces the suffix # "from" with "to". It can also use '%' as a wildcard. @@ -211,8 +211,7 @@ # 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+2: Unfinished modifier ('=' missing) -# expect+1: Malformed conditional '${word216:L:from${:D=}to}' +# expect+1: Unfinished modifier ('=' missing) .if ${word216:L:from${:D=}to} . error .endif @@ -256,8 +255,7 @@ INDIRECT= 1:${VALUE} 2:$${VALUE} 4:$$$${ # The error case of an unfinished ':from=to' modifier after the '=' requires # an expression that is missing the closing '}'. -# expect+2: Unfinished modifier ('}' missing) -# expect+1: Malformed conditional '${error:L:from=$(})' +# expect+1: Unfinished modifier ('}' missing) .if ${error:L:from=$(}) .endif Index: src/usr.bin/make/unit-tests/varmod.mk diff -u src/usr.bin/make/unit-tests/varmod.mk:1.21 src/usr.bin/make/unit-tests/varmod.mk:1.22 --- src/usr.bin/make/unit-tests/varmod.mk:1.21 Sat Jan 11 20:16:40 2025 +++ src/usr.bin/make/unit-tests/varmod.mk Sat Jan 11 20:54:46 2025 @@ -1,4 +1,4 @@ -# $NetBSD: varmod.mk,v 1.21 2025/01/11 20:16:40 rillig Exp $ +# $NetBSD: varmod.mk,v 1.22 2025/01/11 20:54:46 rillig Exp $ # # Tests for variable modifiers, such as :Q, :S,from,to or :Ufallback. # @@ -121,27 +121,23 @@ 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: Bad modifier ":[99333000222000111000]" -# expect+1: Malformed conditional '${word:L:[99333000222000111000]}' +# expect+1: Bad modifier ":[99333000222000111000]" .if ${word:L:[99333000222000111000]} .endif -# expect+2: Bad modifier ":[2147483648]" -# expect+1: Malformed conditional '${word:L:[2147483648]}' +# expect+1: Bad modifier ":[2147483648]" .if ${word:L:[2147483648]} .endif # Test the range generation modifier ':range=n' with a very large number that # is larger than SIZE_MAX for any supported platform. -# expect+2: Invalid number "99333000222000111000}" for ':range' modifier -# expect+1: Malformed conditional '${word:L:range=99333000222000111000}' +# expect+1: 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: Invalid time value "\" -# expect+1: Malformed conditional '${:${:Ugmtime=\\}}' +# expect+1: Invalid time value "\" .if ${:${:Ugmtime=\\}} . error .endif @@ -176,8 +172,7 @@ ${:U }= <space> .if ${word:L:@w@$w$@} != "word" . error .endif -# expect+2: Bad modifier ":[$]" -# expect+1: Malformed conditional '${word:[$]}' +# expect+1: Bad modifier ":[$]" .if ${word:[$]} . error .else @@ -202,15 +197,13 @@ VAR_DOLLAR= VAR$$ .if ${:Ufallback$} != "fallback" . error .endif -# expect+2: Invalid time value "1000$" -# expect+1: Malformed conditional '${%y:L:gmtime=1000$}' +# expect+1: Invalid time value "1000$" .if ${%y:L:gmtime=1000$} . error .else . error .endif -# expect+2: Invalid time value "1000$" -# expect+1: Malformed conditional '${%y:L:localtime=1000$}' +# expect+1: Invalid time value "1000$" .if ${%y:L:localtime=1000$} . error .else @@ -224,8 +217,7 @@ VAR_DOLLAR= VAR$$ .if ${word:L:NX*$} != "word" . error .endif -# expect+2: Invalid argument 'fallback$' for modifier ':mtime' -# expect+1: Malformed conditional '${.:L:mtime=fallback$}' +# expect+1: Invalid argument 'fallback$' for modifier ':mtime' .if ${.:L:mtime=fallback$} . error .else Index: src/usr.bin/make/unit-tests/var-eval-short.exp diff -u src/usr.bin/make/unit-tests/var-eval-short.exp:1.32 src/usr.bin/make/unit-tests/var-eval-short.exp:1.33 --- src/usr.bin/make/unit-tests/var-eval-short.exp:1.32 Thu Oct 31 09:12:13 2024 +++ src/usr.bin/make/unit-tests/var-eval-short.exp Sat Jan 11 20:54:45 2025 @@ -1,7 +1,6 @@ -make: "var-eval-short.mk" line 46: In the :@ modifier, the variable name "${FAIL}" must not contain a dollar +make: "var-eval-short.mk" line 45: In the :@ modifier, the variable name "${FAIL}" must not contain a dollar while parsing "${:Uword:@${FAIL}@expr@}" -make: "var-eval-short.mk" line 46: Malformed conditional '0 && ${:Uword:@${FAIL}@expr@}' -Parsing var-eval-short.mk:159: .if 0 && ${0:?${FAIL}then:${FAIL}else} +Parsing var-eval-short.mk:158: .if 0 && ${0:?${FAIL}then:${FAIL}else} CondParser_Eval: 0 && ${0:?${FAIL}then:${FAIL}else} Var_Parse: ${0:?${FAIL}then:${FAIL}else} (parse) Parsing modifier ${0:?...} @@ -10,9 +9,9 @@ Modifier part: "${FAIL}then" Var_Parse: ${FAIL}else} (parse) Modifier part: "${FAIL}else" Result of ${0:?${FAIL}then:${FAIL}else} is "" (parse, defined) -Parsing var-eval-short.mk:167: DEFINED= defined +Parsing var-eval-short.mk:166: DEFINED= defined Global: DEFINED = defined -Parsing var-eval-short.mk:168: .if 0 && ${DEFINED:L:?${FAIL}then:${FAIL}else} +Parsing var-eval-short.mk:167: .if 0 && ${DEFINED:L:?${FAIL}then:${FAIL}else} CondParser_Eval: 0 && ${DEFINED:L:?${FAIL}then:${FAIL}else} Var_Parse: ${DEFINED:L:?${FAIL}then:${FAIL}else} (parse) Parsing modifier ${DEFINED:L} @@ -23,7 +22,7 @@ Modifier part: "${FAIL}then" Var_Parse: ${FAIL}else} (parse) Modifier part: "${FAIL}else" Result of ${DEFINED:?${FAIL}then:${FAIL}else} is "defined" (parse, regular) -Parsing var-eval-short.mk:170: .MAKEFLAGS: -d0 +Parsing var-eval-short.mk:169: .MAKEFLAGS: -d0 ParseDependency(.MAKEFLAGS: -d0) Global: .MAKEFLAGS = -r -k -d cpv -d Global: .MAKEFLAGS = -r -k -d cpv -d 0 Index: src/usr.bin/make/unit-tests/varmod-edge.mk diff -u src/usr.bin/make/unit-tests/varmod-edge.mk:1.32 src/usr.bin/make/unit-tests/varmod-edge.mk:1.33 --- src/usr.bin/make/unit-tests/varmod-edge.mk:1.32 Sat Jan 11 20:16:40 2025 +++ src/usr.bin/make/unit-tests/varmod-edge.mk Sat Jan 11 20:54:45 2025 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-edge.mk,v 1.32 2025/01/11 20:16:40 rillig Exp $ +# $NetBSD: varmod-edge.mk,v 1.33 2025/01/11 20:54:45 rillig Exp $ # # Tests for edge cases in variable modifiers. # @@ -196,10 +196,7 @@ EXP= # empty .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: Unknown modifier "Z" -# expect+1: Malformed conditional '${:Z}' +# expect+1: Unknown modifier "Z" .if ${:Z} . error .else @@ -212,8 +209,7 @@ EXP= # empty # variable name with quotes, leading to the rather confusing "Unfinished # modifier for (',' missing)", having two spaces in a row. # -# expect+2: Unfinished modifier (',' missing) -# expect+1: Malformed conditional '${:S,}' +# expect+1: Unfinished modifier (',' missing) .if ${:S,} . error .else Index: src/usr.bin/make/unit-tests/vardebug.exp diff -u src/usr.bin/make/unit-tests/vardebug.exp:1.38 src/usr.bin/make/unit-tests/vardebug.exp:1.39 --- src/usr.bin/make/unit-tests/vardebug.exp:1.38 Thu Aug 29 20:20:36 2024 +++ src/usr.bin/make/unit-tests/vardebug.exp Sat Jan 11 20:54:45 2025 @@ -54,12 +54,11 @@ Var_Parse: ${:Uvariable:unknown} (eval-d 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: Unknown modifier "unknown" +make: "vardebug.mk" line 62: Unknown modifier "unknown" while evaluating "${:Uvariable:unknown}" with value "variable" Result of ${:unknown} is error (eval-defined, defined) -make: "vardebug.mk" line 63: Malformed conditional '${:Uvariable:unknown}' Var_Parse: ${UNDEFINED} (eval-defined) -make: "vardebug.mk" line 73: Malformed conditional '${UNDEFINED}' +make: "vardebug.mk" line 72: Malformed conditional '${UNDEFINED}' Global: ignoring delete '.SHELL' as it is not found Command: .SHELL = </path/to/shell> Command: ignoring '.SHELL = overwritten' as it is read-only Index: src/usr.bin/make/unit-tests/varmod-edge.exp diff -u src/usr.bin/make/unit-tests/varmod-edge.exp:1.28 src/usr.bin/make/unit-tests/varmod-edge.exp:1.29 --- src/usr.bin/make/unit-tests/varmod-edge.exp:1.28 Thu Aug 29 20:20:36 2024 +++ src/usr.bin/make/unit-tests/varmod-edge.exp Sat Jan 11 20:54:45 2025 @@ -14,12 +14,10 @@ make: "varmod-edge.mk" line 194: Unknown make: "varmod-edge.mk" line 194: Unknown modifier ":" while evaluating variable "INP" with value "" while evaluating variable "MOD" with value "${INP::::}" -make: "varmod-edge.mk" line 203: Unknown modifier "Z" +make: "varmod-edge.mk" line 200: Unknown modifier "Z" while evaluating "${:Z}" with value "" -make: "varmod-edge.mk" line 203: Malformed conditional '${:Z}' -make: "varmod-edge.mk" line 217: Unfinished modifier (',' missing) +make: "varmod-edge.mk" line 213: Unfinished modifier (',' missing) while evaluating "${:S,}" with value "" -make: "varmod-edge.mk" line 217: Malformed conditional '${:S,}' make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 Index: src/usr.bin/make/unit-tests/varmod-match.mk diff -u src/usr.bin/make/unit-tests/varmod-match.mk:1.28 src/usr.bin/make/unit-tests/varmod-match.mk:1.29 --- src/usr.bin/make/unit-tests/varmod-match.mk:1.28 Thu Aug 29 20:20:36 2024 +++ src/usr.bin/make/unit-tests/varmod-match.mk Sat Jan 11 20:54:46 2025 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-match.mk,v 1.28 2024/08/29 20:20:36 rillig Exp $ +# $NetBSD: varmod-match.mk,v 1.29 2025/01/11 20:54:46 rillig Exp $ # # Tests for the ':M' modifier, which keeps only those words that match the # given pattern. @@ -358,9 +358,8 @@ WORDS= [x- x x- y yyyyy .endif # [:] matches never since the ':' starts the next modifier -# expect+3: Unfinished character list in pattern '[' of modifier ':M' -# expect+2: Unknown modifier "]" -# expect+1: Malformed conditional '${ ${:U\:} ${:U\:\:} :L:M[:]} != ":"' +# expect+2: Unfinished character list in pattern '[' of modifier ':M' +# expect+1: Unknown modifier "]" .if ${ ${:U\:} ${:U\:\:} :L:M[:]} != ":" . error .else Index: src/usr.bin/make/unit-tests/varmod-gmtime.mk diff -u src/usr.bin/make/unit-tests/varmod-gmtime.mk:1.26 src/usr.bin/make/unit-tests/varmod-gmtime.mk:1.27 --- src/usr.bin/make/unit-tests/varmod-gmtime.mk:1.26 Thu Aug 29 20:20:36 2024 +++ src/usr.bin/make/unit-tests/varmod-gmtime.mk Sat Jan 11 20:54:45 2025 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-gmtime.mk,v 1.26 2024/08/29 20:20:36 rillig Exp $ +# $NetBSD: varmod-gmtime.mk,v 1.27 2025/01/11 20:54:45 rillig Exp $ # # Tests for the :gmtime variable modifier, which formats a timestamp # using strftime(3) in UTC. @@ -56,8 +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: Invalid time value "-1" -# expect+1: Malformed conditional '${:L:gmtime=-1} != ""' +# expect+1: Invalid time value "-1" .if ${:L:gmtime=-1} != "" . error .else @@ -67,8 +66,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: Invalid time value " 1" -# expect+1: Malformed conditional '${:L:gmtime= 1} != ""' +# expect+1: Invalid time value " 1" .if ${:L:gmtime= 1} != "" . error .else @@ -115,8 +113,7 @@ # # Since var.c 1.631 from 2020-10-31, the overflow is detected and produces a # parse error. -# expect+2: Invalid time value "10000000000000000000000000000000" -# expect+1: Malformed conditional '${:L:gmtime=10000000000000000000000000000000} != ""' +# expect+1: Invalid time value "10000000000000000000000000000000" .if ${:L:gmtime=10000000000000000000000000000000} != "" . error .else @@ -128,8 +125,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: Invalid time value "error" -# expect+1: Malformed conditional '${:L:gmtime=error} != ""' +# expect+1: Invalid time value "error" .if ${:L:gmtime=error} != "" . error .else @@ -139,8 +135,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: Invalid time value "100000S,1970,bad," -# expect+1: Malformed conditional '${%Y:L:gmtime=100000S,1970,bad,} != "bad"' +# expect+1: Invalid time value "100000S,1970,bad," .if ${%Y:L:gmtime=100000S,1970,bad,} != "bad" . error .endif Index: src/usr.bin/make/unit-tests/varmod-ifelse.exp diff -u src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.25 src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.26 --- src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.25 Thu Aug 29 20:20:36 2024 +++ src/usr.bin/make/unit-tests/varmod-ifelse.exp Sat Jan 11 20:54:45 2025 @@ -1,42 +1,37 @@ -make: "varmod-ifelse.mk" line 29: Bad condition +make: "varmod-ifelse.mk" line 28: Bad condition while evaluating condition "bare words == "literal"" -make: "varmod-ifelse.mk" line 29: Malformed conditional '${${:Ubare words} == "literal":?bad:bad}' -make: "varmod-ifelse.mk" line 40: Bad condition +make: "varmod-ifelse.mk" line 39: Bad condition while evaluating condition " == """ -make: "varmod-ifelse.mk" line 49: Bad condition +make: "varmod-ifelse.mk" line 47: Bad condition while evaluating condition " == """ -make: "varmod-ifelse.mk" line 49: Malformed conditional '${${UNDEF} == "":?bad-cond:bad-cond}' -make: "varmod-ifelse.mk" line 73: Bad condition +make: "varmod-ifelse.mk" line 70: Bad condition while evaluating condition "1 == == 2" -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: "varmod-ifelse.mk" line 97: Bad condition +make: "varmod-ifelse.mk" line 94: Bad condition while evaluating condition "1 == == 2" Comparing "" != "" -make: "varmod-ifelse.mk" line 101: warning: Oops, the parse error should have been propagated. +make: "varmod-ifelse.mk" line 98: 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 163: no. -make: "varmod-ifelse.mk" line 167: Comparison with '>=' requires both operands 'no' and '10' to be numeric +make: "varmod-ifelse.mk" line 160: no. +make: "varmod-ifelse.mk" line 163: Comparison with '>=' requires both operands 'no' and '10' to be numeric while evaluating condition "string == "literal" || no >= 10" -make: "varmod-ifelse.mk" line 167: Bad condition - while evaluating condition "string == "literal" || no >= 10" -make: "varmod-ifelse.mk" line 167: . -make: "varmod-ifelse.mk" line 174: Bad condition +make: "varmod-ifelse.mk" line 163: . +make: "varmod-ifelse.mk" line 170: Bad condition while evaluating condition "string == "literal" && >= 10" -make: "varmod-ifelse.mk" line 174: . -make: "varmod-ifelse.mk" line 177: Bad condition +make: "varmod-ifelse.mk" line 170: . +make: "varmod-ifelse.mk" line 173: Bad condition while evaluating condition "string == "literal" || >= 10" -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: Bad condition +make: "varmod-ifelse.mk" line 173: . +make: "varmod-ifelse.mk" line 181: <true> +make: "varmod-ifelse.mk" line 184: <false> +make: "varmod-ifelse.mk" line 188: Bad condition while evaluating condition " " -make: "varmod-ifelse.mk" line 192: <> +make: "varmod-ifelse.mk" line 188: <> CondParser_Eval: 0 && ${1:?${:Uthen0:S,}},,}:${:Uelse0:S,}},,}} != "not evaluated" CondParser_Eval: 1 && ${0:?${:Uthen1:S,}},,}:${:Uelse1:S,}},,}} != "else1" CondParser_Eval: 0 @@ -46,20 +41,20 @@ CondParser_Eval: 1 Comparing "then2" != "then2" CondParser_Eval: ${DELAYED} == "one" Comparing "two" == "one" -make: "varmod-ifelse.mk" line 288: no +make: "varmod-ifelse.mk" line 284: no CondParser_Eval: ${DELAYED} == "two" Comparing "two" == "two" -make: "varmod-ifelse.mk" line 290: yes +make: "varmod-ifelse.mk" line 286: yes CondParser_Eval: ${DELAYED} == "one" Comparing "two" == "one" -make: "varmod-ifelse.mk" line 293: no +make: "varmod-ifelse.mk" line 289: no CondParser_Eval: ${DELAYED} == "two" Comparing "two" == "two" -make: "varmod-ifelse.mk" line 296: yes -make: "varmod-ifelse.mk" line 318: Unknown modifier "X-then" +make: "varmod-ifelse.mk" line 292: yes +make: "varmod-ifelse.mk" line 314: Unknown modifier "X-then" while evaluating "${:X-then}:${:X-else}}" with value "" while evaluating then-branch of condition "1" -make: "varmod-ifelse.mk" line 318: Unknown modifier "X-else" +make: "varmod-ifelse.mk" line 314: Unknown modifier "X-else" while parsing "${:X-else}}" while evaluating else-branch of condition "1" make: Fatal errors encountered -- cannot continue Index: src/usr.bin/make/unit-tests/varmod-ifelse.mk diff -u src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.34 src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.35 --- src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.34 Thu Aug 29 20:20:36 2024 +++ src/usr.bin/make/unit-tests/varmod-ifelse.mk Sat Jan 11 20:54:45 2025 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-ifelse.mk,v 1.34 2024/08/29 20:20:36 rillig Exp $ +# $NetBSD: varmod-ifelse.mk,v 1.35 2025/01/11 20:54:45 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,8 +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: Bad condition -# expect+1: Malformed conditional '${${:Ubare words} == "literal":?bad:bad}' +# expect+1: Bad condition .if ${${:Ubare words} == "literal":?bad:bad} . error .else @@ -44,8 +43,7 @@ COND:= ${${UNDEF} == "":?bad-assign:bad- # "Undefined variable" error message is generated. # The difference to the ':=' variable assignment is the additional # "Malformed conditional" error message. -# expect+2: Bad condition -# expect+1: Malformed conditional '${${UNDEF} == "":?bad-cond:bad-cond}' +# expect+1: Bad condition .if ${${UNDEF} == "":?bad-cond:bad-cond} . error .else @@ -68,8 +66,7 @@ COND:= ${${UNDEF} == "":?bad-assign:bad- # conditional therefore returns a parse error from Var_Parse, and this parse # error propagates to CondEvalExpression, where the "Malformed conditional" # comes from. -# expect+2: Bad condition -# expect+1: Malformed conditional '${1 == == 2:?yes:no} != ""' +# expect+1: Bad condition .if ${1 == == 2:?yes:no} != "" . error .else @@ -161,8 +158,7 @@ STRING= string NUMBER= no # not really a number # expect+1: no. .info ${${STRING} == "literal" && ${NUMBER} >= 10:?yes:no}. -# expect+3: Comparison with '>=' requires both operands 'no' and '10' to be numeric -# expect+2: Bad condition +# expect+2: Comparison with '>=' requires both operands 'no' and '10' to be numeric # expect+1: . .info ${${STRING} == "literal" || ${NUMBER} >= 10:?yes:no}. Index: src/usr.bin/make/unit-tests/varmod-localtime.exp diff -u src/usr.bin/make/unit-tests/varmod-localtime.exp:1.19 src/usr.bin/make/unit-tests/varmod-localtime.exp:1.20 --- src/usr.bin/make/unit-tests/varmod-localtime.exp:1.19 Thu Aug 29 20:20:36 2024 +++ src/usr.bin/make/unit-tests/varmod-localtime.exp Sat Jan 11 20:54:45 2025 @@ -1,18 +1,13 @@ -make: "varmod-localtime.mk" line 61: Invalid time value "-1" +make: "varmod-localtime.mk" line 60: Invalid time value "-1" while evaluating "${:L:localtime=-1} != """ with value "" -make: "varmod-localtime.mk" line 61: Malformed conditional '${:L:localtime=-1} != ""' -make: "varmod-localtime.mk" line 72: Invalid time value " 1" +make: "varmod-localtime.mk" line 70: Invalid time value " 1" while evaluating "${:L:localtime= 1} != """ with value "" -make: "varmod-localtime.mk" line 72: Malformed conditional '${:L:localtime= 1} != ""' -make: "varmod-localtime.mk" line 120: Invalid time value "10000000000000000000000000000000" +make: "varmod-localtime.mk" line 117: Invalid time value "10000000000000000000000000000000" while evaluating "${:L:localtime=10000000000000000000000000000000} != """ with value "" -make: "varmod-localtime.mk" line 120: Malformed conditional '${:L:localtime=10000000000000000000000000000000} != ""' -make: "varmod-localtime.mk" line 133: Invalid time value "error" +make: "varmod-localtime.mk" line 129: Invalid time value "error" while evaluating "${:L:localtime=error} != """ with value "" -make: "varmod-localtime.mk" line 133: Malformed conditional '${:L:localtime=error} != ""' -make: "varmod-localtime.mk" line 144: Invalid time value "100000S,1970,bad," +make: "varmod-localtime.mk" line 139: Invalid time value "100000S,1970,bad," while evaluating variable "%Y" with value "%Y" -make: "varmod-localtime.mk" line 144: Malformed conditional '${%Y:L:localtime=100000S,1970,bad,} != "bad"' make: Fatal errors encountered -- cannot continue make: stopped making "all" in unit-tests exit status 1 Index: src/usr.bin/make/unit-tests/varmod-localtime.mk diff -u src/usr.bin/make/unit-tests/varmod-localtime.mk:1.19 src/usr.bin/make/unit-tests/varmod-localtime.mk:1.20 --- src/usr.bin/make/unit-tests/varmod-localtime.mk:1.19 Thu Aug 29 20:20:36 2024 +++ src/usr.bin/make/unit-tests/varmod-localtime.mk Sat Jan 11 20:54:46 2025 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-localtime.mk,v 1.19 2024/08/29 20:20:36 rillig Exp $ +# $NetBSD: varmod-localtime.mk,v 1.20 2025/01/11 20:54:46 rillig Exp $ # # Tests for the :localtime variable modifier, which formats a timestamp # using strftime(3) in local time. @@ -56,8 +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: Invalid time value "-1" -# expect+1: Malformed conditional '${:L:localtime=-1} != ""' +# expect+1: Invalid time value "-1" .if ${:L:localtime=-1} != "" . error .else @@ -67,8 +66,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: Invalid time value " 1" -# expect+1: Malformed conditional '${:L:localtime= 1} != ""' +# expect+1: Invalid time value " 1" .if ${:L:localtime= 1} != "" . error .else @@ -115,8 +113,7 @@ # # Since var.c 1.631 from 2020-10-31, the overflow is detected and produces a # parse error. -# expect+2: Invalid time value "10000000000000000000000000000000" -# expect+1: Malformed conditional '${:L:localtime=10000000000000000000000000000000} != ""' +# expect+1: Invalid time value "10000000000000000000000000000000" .if ${:L:localtime=10000000000000000000000000000000} != "" . error .else @@ -128,8 +125,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: Invalid time value "error" -# expect+1: Malformed conditional '${:L:localtime=error} != ""' +# expect+1: Invalid time value "error" .if ${:L:localtime=error} != "" . error .else @@ -139,8 +135,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: Invalid time value "100000S,1970,bad," -# expect+1: Malformed conditional '${%Y:L:localtime=100000S,1970,bad,} != "bad"' +# expect+1: Invalid time value "100000S,1970,bad," .if ${%Y:L:localtime=100000S,1970,bad,} != "bad" . error .endif Index: src/usr.bin/make/unit-tests/varmod-loop-varname.exp diff -u src/usr.bin/make/unit-tests/varmod-loop-varname.exp:1.12 src/usr.bin/make/unit-tests/varmod-loop-varname.exp:1.13 --- src/usr.bin/make/unit-tests/varmod-loop-varname.exp:1.12 Thu Aug 29 20:20:36 2024 +++ src/usr.bin/make/unit-tests/varmod-loop-varname.exp Sat Jan 11 20:54:46 2025 @@ -1,15 +1,11 @@ -make: "varmod-loop-varname.mk" line 18: In the :@ modifier, the variable name "${:Ubar:S,b,v,}" must not contain a dollar +make: "varmod-loop-varname.mk" line 17: In the :@ modifier, the variable name "${:Ubar:S,b,v,}" must not contain a dollar while evaluating "${:Uone two three:@${:Ubar:S,b,v,}@+${var}+@} != "+one+ +two+ +three+"" with value "one two three" -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: In the :@ modifier, the variable name "v$" must not contain a dollar +make: "varmod-loop-varname.mk" line 87: In the :@ modifier, the variable name "v$" must not contain a dollar while evaluating variable "1 2 3" with value "1 2 3" -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: In the :@ modifier, the variable name "v$$" must not contain a dollar +make: "varmod-loop-varname.mk" line 93: In the :@ modifier, the variable name "v$$" must not contain a dollar while evaluating variable "1 2 3" with value "1 2 3" -make: "varmod-loop-varname.mk" line 96: Malformed conditional '${1 2 3:L:@v$$@($v)@} != "() () ()"' -make: "varmod-loop-varname.mk" line 103: In the :@ modifier, the variable name "v$$$" must not contain a dollar +make: "varmod-loop-varname.mk" line 99: In the :@ modifier, the variable name "v$$$" must not contain a dollar while evaluating variable "1 2 3" with value "1 2 3" -make: "varmod-loop-varname.mk" line 103: Malformed conditional '${1 2 3:L:@v$$$@($v)@} != "() () ()"' make: Fatal errors encountered -- cannot continue make: stopped making "all" in unit-tests exit status 1 Index: src/usr.bin/make/unit-tests/varmod-loop-varname.mk diff -u src/usr.bin/make/unit-tests/varmod-loop-varname.mk:1.11 src/usr.bin/make/unit-tests/varmod-loop-varname.mk:1.12 --- src/usr.bin/make/unit-tests/varmod-loop-varname.mk:1.11 Thu Aug 29 20:20:36 2024 +++ src/usr.bin/make/unit-tests/varmod-loop-varname.mk Sat Jan 11 20:54:46 2025 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-loop-varname.mk,v 1.11 2024/08/29 20:20:36 rillig Exp $ +# $NetBSD: varmod-loop-varname.mk,v 1.12 2025/01/11 20:54:46 rillig Exp $ # # Tests for the first part of the variable modifier ':@var@...@', which # contains the variable name to use during the loop. @@ -13,8 +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: 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+"' +# expect+1: In the :@ modifier, the variable name "${:Ubar:S,b,v,}" must not contain a dollar .if ${:Uone two three:@${:Ubar:S,b,v,}@+${var}+@} != "+one+ +two+ +three+" . error .else @@ -84,22 +83,19 @@ 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: 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)"' +# expect+1: In the :@ modifier, the variable name "v$" must not contain a dollar .if ${1 2 3:L:@v$@($v)@} != "(1) (2) (3)" . error .else . error .endif -# expect+2: In the :@ modifier, the variable name "v$$" must not contain a dollar -# expect+1: Malformed conditional '${1 2 3:L:@v$$@($v)@} != "() () ()"' +# expect+1: In the :@ modifier, the variable name "v$$" must not contain a dollar .if ${1 2 3:L:@v$$@($v)@} != "() () ()" . error .else . error .endif -# expect+2: In the :@ modifier, the variable name "v$$$" must not contain a dollar -# expect+1: Malformed conditional '${1 2 3:L:@v$$$@($v)@} != "() () ()"' +# expect+1: In the :@ modifier, the variable name "v$$$" must not contain a dollar .if ${1 2 3:L:@v$$$@($v)@} != "() () ()" . error .else Index: src/usr.bin/make/unit-tests/varmod-mtime.exp diff -u src/usr.bin/make/unit-tests/varmod-mtime.exp:1.11 src/usr.bin/make/unit-tests/varmod-mtime.exp:1.12 --- src/usr.bin/make/unit-tests/varmod-mtime.exp:1.11 Thu Aug 29 20:20:36 2024 +++ src/usr.bin/make/unit-tests/varmod-mtime.exp Sat Jan 11 20:54:46 2025 @@ -1,20 +1,15 @@ -make: "varmod-mtime.mk" line 47: Invalid argument '123x' for modifier ':mtime' +make: "varmod-mtime.mk" line 46: Invalid argument '123x' for modifier ':mtime' while evaluating variable "no/such/file" with value "no/such/file" -make: "varmod-mtime.mk" line 47: Malformed conditional '${no/such/file:L:mtime=123x}' -make: "varmod-mtime.mk" line 70: Cannot determine mtime for 'no/such/file1': <ENOENT> +make: "varmod-mtime.mk" line 68: Cannot determine mtime for 'no/such/file1': <ENOENT> while evaluating variable "no/such/file1 no/such/file2" with value "no/such/file1 no/such/file2" -make: "varmod-mtime.mk" line 70: Cannot determine mtime for 'no/such/file2': <ENOENT> +make: "varmod-mtime.mk" line 68: Cannot determine mtime for 'no/such/file2': <ENOENT> while evaluating variable "no/such/file1 no/such/file2" with value "no/such/file1 no/such/file2" -make: "varmod-mtime.mk" line 70: Malformed conditional '${no/such/file1 no/such/file2:L:mtime=error}' -make: "varmod-mtime.mk" line 81: Invalid argument 'errorhandler-no' for modifier ':mtime' +make: "varmod-mtime.mk" line 78: Invalid argument 'errorhandler-no' for modifier ':mtime' while evaluating variable "MAKEFILE" with value "varmod-mtime.mk" -make: "varmod-mtime.mk" line 81: Malformed conditional '${MAKEFILE:mtime=errorhandler-no} > 0' -make: "varmod-mtime.mk" line 90: Invalid argument 'warn' for modifier ':mtime' +make: "varmod-mtime.mk" line 86: Invalid argument 'warn' for modifier ':mtime' while evaluating variable "MAKEFILE" with value "varmod-mtime.mk" -make: "varmod-mtime.mk" line 90: Malformed conditional '${MAKEFILE:mtime=warn} > 0' -make: "varmod-mtime.mk" line 115: Unknown modifier "mtim" +make: "varmod-mtime.mk" line 110: Unknown modifier "mtim" while evaluating variable "anything" with value "anything" -make: "varmod-mtime.mk" line 115: Malformed conditional '${anything:L:mtim}' make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 Index: src/usr.bin/make/unit-tests/varmod-mtime.mk diff -u src/usr.bin/make/unit-tests/varmod-mtime.mk:1.13 src/usr.bin/make/unit-tests/varmod-mtime.mk:1.14 --- src/usr.bin/make/unit-tests/varmod-mtime.mk:1.13 Thu Aug 29 20:20:36 2024 +++ src/usr.bin/make/unit-tests/varmod-mtime.mk Sat Jan 11 20:54:46 2025 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-mtime.mk,v 1.13 2024/08/29 20:20:36 rillig Exp $ +# $NetBSD: varmod-mtime.mk,v 1.14 2025/01/11 20:54:46 rillig Exp $ # # Tests for the ':mtime' variable modifier, which maps each word of the # expression to that file's modification time. @@ -42,8 +42,7 @@ not_found_mtime:= ${no/such/file:L:mtime # The fallback timestamp must only be an integer, without trailing characters. -# expect+2: Invalid argument '123x' for modifier ':mtime' -# expect+1: Malformed conditional '${no/such/file:L:mtime=123x}' +# expect+1: Invalid argument '123x' for modifier ':mtime' .if ${no/such/file:L:mtime=123x} . error .else @@ -64,9 +63,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: Cannot determine mtime for 'no/such/file1': <ENOENT> -# expect+2: Cannot determine mtime for 'no/such/file2': <ENOENT> -# expect+1: Malformed conditional '${no/such/file1 no/such/file2:L:mtime=error}' +# expect+2: Cannot determine mtime for 'no/such/file1': <ENOENT> +# expect+1: Cannot determine mtime for 'no/such/file2': <ENOENT> .if ${no/such/file1 no/such/file2:L:mtime=error} . error .else @@ -76,8 +74,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: Invalid argument 'errorhandler-no' for modifier ':mtime' -# expect+1: Malformed conditional '${MAKEFILE:mtime=errorhandler-no} > 0' +# expect+1: Invalid argument 'errorhandler-no' for modifier ':mtime' .if ${MAKEFILE:mtime=errorhandler-no} > 0 .else . error @@ -85,8 +82,7 @@ _!= rm -f ${COOKIE} # Only the word 'error' can be used as a fallback argument to the modifier. -# expect+2: Invalid argument 'warn' for modifier ':mtime' -# expect+1: Malformed conditional '${MAKEFILE:mtime=warn} > 0' +# expect+1: Invalid argument 'warn' for modifier ':mtime' .if ${MAKEFILE:mtime=warn} > 0 . error .else @@ -110,8 +106,7 @@ end:= ${%s:L:gmtime} # If there is a typo in the modifier name, it does not match. -# expect+2: Unknown modifier "mtim" -# expect+1: Malformed conditional '${anything:L:mtim}' +# expect+1: Unknown modifier "mtim" .if ${anything:L:mtim} . error .else Index: src/usr.bin/make/unit-tests/varmod-order.mk diff -u src/usr.bin/make/unit-tests/varmod-order.mk:1.17 src/usr.bin/make/unit-tests/varmod-order.mk:1.18 --- src/usr.bin/make/unit-tests/varmod-order.mk:1.17 Thu Aug 29 20:20:36 2024 +++ src/usr.bin/make/unit-tests/varmod-order.mk Sat Jan 11 20:54:46 2025 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-order.mk,v 1.17 2024/08/29 20:20:36 rillig Exp $ +# $NetBSD: varmod-order.mk,v 1.18 2025/01/11 20:54:46 rillig Exp $ # # Tests for the :O variable modifier and its variants, which either sort the # words of the value or shuffle them. @@ -26,8 +26,7 @@ _:= ${NUMBERS:Onr # Shuffling numerically doesn't make sense, so don't allow 'x' and 'n' to be # combined. # -# expect+2: Bad modifier ":Oxn" -# expect+1: Malformed conditional '${NUMBERS:Oxn}' +# expect+1: Bad modifier ":Oxn" .if ${NUMBERS:Oxn} . error .else @@ -36,8 +35,7 @@ _:= ${NUMBERS:Onr # Extra characters after ':On' are detected and diagnosed. # -# expect+2: Bad modifier ":On_typo" -# expect+1: Malformed conditional '${NUMBERS:On_typo}' +# expect+1: Bad modifier ":On_typo" .if ${NUMBERS:On_typo} . error .else @@ -46,8 +44,7 @@ _:= ${NUMBERS:Onr # Extra characters after ':Onr' are detected and diagnosed. # -# expect+2: Bad modifier ":Onr_typo" -# expect+1: Malformed conditional '${NUMBERS:Onr_typo}' +# expect+1: Bad modifier ":Onr_typo" .if ${NUMBERS:Onr_typo} . error .else @@ -56,8 +53,7 @@ _:= ${NUMBERS:Onr # Extra characters after ':Orn' are detected and diagnosed. # -# expect+2: Bad modifier ":Orn_typo" -# expect+1: Malformed conditional '${NUMBERS:Orn_typo}' +# expect+1: Bad modifier ":Orn_typo" .if ${NUMBERS:Orn_typo} . error .else @@ -68,8 +64,7 @@ _:= ${NUMBERS:Onr # criteria are fixed, not computed, therefore allowing this redundancy does # not make sense. # -# expect+2: Bad modifier ":Onn" -# expect+1: Malformed conditional '${NUMBERS:Onn}' +# expect+1: Bad modifier ":Onn" .if ${NUMBERS:Onn} . error .else @@ -78,8 +73,7 @@ _:= ${NUMBERS:Onr # Repeating the 'r' is not supported as well, for the same reasons as above. # -# expect+2: Bad modifier ":Onrr" -# expect+1: Malformed conditional '${NUMBERS:Onrr}' +# expect+1: Bad modifier ":Onrr" .if ${NUMBERS:Onrr} . error .else @@ -88,8 +82,7 @@ _:= ${NUMBERS:Onr # Repeating the 'r' is not supported as well, for the same reasons as above. # -# expect+2: Bad modifier ":Orrn" -# expect+1: Malformed conditional '${NUMBERS:Orrn}' +# expect+1: Bad modifier ":Orrn" .if ${NUMBERS:Orrn} . error .else @@ -103,8 +96,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+2: Bad modifier ":On=Off" -# expect+1: Malformed conditional '${SWITCH:On=Off} != "Off"' +# expect+1: Bad modifier ":On=Off" .if ${SWITCH:On=Off} != "Off" . error .else Index: src/usr.bin/make/unit-tests/varmod-range.exp diff -u src/usr.bin/make/unit-tests/varmod-range.exp:1.17 src/usr.bin/make/unit-tests/varmod-range.exp:1.18 --- src/usr.bin/make/unit-tests/varmod-range.exp:1.17 Thu Aug 29 20:20:36 2024 +++ src/usr.bin/make/unit-tests/varmod-range.exp Sat Jan 11 20:54:46 2025 @@ -1,19 +1,14 @@ make: "varmod-range.mk" line 43: Malformed conditional '${:range=5} != ""' -make: "varmod-range.mk" line 67: Invalid number "x}Rest" != "Rest"" for ':range' modifier +make: "varmod-range.mk" line 66: Invalid number "x}Rest" != "Rest"" for ':range' modifier while evaluating "${:U:range=x}Rest" != "Rest"" with value "" -make: "varmod-range.mk" line 67: Malformed conditional '"${:U:range=x}Rest" != "Rest"' -make: "varmod-range.mk" line 78: Unknown modifier "x0" +make: "varmod-range.mk" line 76: Unknown modifier "x0" while evaluating "${:U:range=0x0}Rest" != "Rest"" with value "1" -make: "varmod-range.mk" line 78: Malformed conditional '"${:U:range=0x0}Rest" != "Rest"' -make: "varmod-range.mk" line 96: Unknown modifier "rang" +make: "varmod-range.mk" line 93: Unknown modifier "rang" while evaluating variable "a b c" with value "a b c" -make: "varmod-range.mk" line 96: Malformed conditional '"${a b c:L:rang}Rest" != "Rest"' -make: "varmod-range.mk" line 105: Unknown modifier "rango" +make: "varmod-range.mk" line 101: Unknown modifier "rango" while evaluating variable "a b c" with value "a b c" -make: "varmod-range.mk" line 105: Malformed conditional '"${a b c:L:rango}Rest" != "Rest"' -make: "varmod-range.mk" line 114: Unknown modifier "ranger" +make: "varmod-range.mk" line 109: Unknown modifier "ranger" while evaluating variable "a b c" with value "a b c" -make: "varmod-range.mk" line 114: Malformed conditional '"${a b c:L:ranger}Rest" != "Rest"' make: Fatal errors encountered -- cannot continue make: stopped making "all" in unit-tests exit status 1 Index: src/usr.bin/make/unit-tests/varmod.exp diff -u src/usr.bin/make/unit-tests/varmod.exp:1.17 src/usr.bin/make/unit-tests/varmod.exp:1.18 --- src/usr.bin/make/unit-tests/varmod.exp:1.17 Thu Aug 29 20:20:37 2024 +++ src/usr.bin/make/unit-tests/varmod.exp Sat Jan 11 20:54:46 2025 @@ -5,48 +5,40 @@ make: "varmod.mk" line 107: Dollar follo make: "varmod.mk" line 117: Missing delimiter ':' after modifier "P" while evaluating variable "VAR" with value "VAR" make: "varmod.mk" line 119: Missing argument for ".error" -make: "varmod.mk" line 126: Bad modifier ":[99333000222000111000]" +make: "varmod.mk" line 125: Bad modifier ":[99333000222000111000]" while evaluating variable "word" with value "word" -make: "varmod.mk" line 126: Malformed conditional '${word:L:[99333000222000111000]}' -make: "varmod.mk" line 130: Bad modifier ":[2147483648]" +make: "varmod.mk" line 128: Bad modifier ":[2147483648]" while evaluating variable "word" with value "word" -make: "varmod.mk" line 130: Malformed conditional '${word:L:[2147483648]}' -make: "varmod.mk" line 137: Invalid number "99333000222000111000}" for ':range' modifier +make: "varmod.mk" line 134: Invalid number "99333000222000111000}" for ':range' modifier while evaluating variable "word" with value "word" -make: "varmod.mk" line 137: Malformed conditional '${word:L:range=99333000222000111000}' -make: "varmod.mk" line 145: Invalid time value "\" +make: "varmod.mk" line 141: Invalid time value "\" while evaluating "${:${:Ugmtime=\\}}" with value "" -make: "varmod.mk" line 145: Malformed conditional '${:${:Ugmtime=\\}}' -make: "varmod.mk" line 160: Dollar followed by nothing +make: "varmod.mk" line 156: Dollar followed by nothing while evaluating variable "VAR" with value "value$" -make: "varmod.mk" line 166: Dollar followed by nothing +make: "varmod.mk" line 162: Dollar followed by nothing while evaluating variable "VAR" with value "value$" -make: "varmod.mk" line 166: Dollar followed by nothing +make: "varmod.mk" line 162: Dollar followed by nothing while evaluating variable "VAR" with value "value$ appended$" -make: "varmod.mk" line 176: Dollar followed by nothing +make: "varmod.mk" line 172: Dollar followed by nothing while evaluating variable "word" with value "word" -make: "varmod.mk" line 181: Bad modifier ":[$]" +make: "varmod.mk" line 176: Bad modifier ":[$]" while evaluating variable "word" with value "" -make: "varmod.mk" line 181: Malformed conditional '${word:[$]}' -make: "varmod.mk" line 198: Dollar followed by nothing +make: "varmod.mk" line 193: Dollar followed by nothing while evaluating variable "VAR" with value "value$ appended$" -make: "varmod.mk" line 198: Invalid variable name '}', at "$} != "set"" +make: "varmod.mk" line 193: Invalid variable name '}', at "$} != "set"" while evaluating variable "VAR" with value "value<space>appended" -make: "varmod.mk" line 202: Invalid variable name '}', at "$} != "fallback"" +make: "varmod.mk" line 197: Invalid variable name '}', at "$} != "fallback"" while evaluating "${:Ufallback$} != "fallback"" with value "" -make: "varmod.mk" line 207: Invalid time value "1000$" +make: "varmod.mk" line 201: Invalid time value "1000$" while evaluating variable "%y" with value "%y" -make: "varmod.mk" line 207: Malformed conditional '${%y:L:gmtime=1000$}' -make: "varmod.mk" line 214: Invalid time value "1000$" +make: "varmod.mk" line 207: Invalid time value "1000$" while evaluating variable "%y" with value "%y" -make: "varmod.mk" line 214: Malformed conditional '${%y:L:localtime=1000$}' -make: "varmod.mk" line 220: Dollar followed by nothing +make: "varmod.mk" line 213: Dollar followed by nothing while evaluating variable "word" with value "word" -make: "varmod.mk" line 224: Dollar followed by nothing +make: "varmod.mk" line 217: Dollar followed by nothing while evaluating variable "word" with value "word" -make: "varmod.mk" line 229: Invalid argument 'fallback$' for modifier ':mtime' +make: "varmod.mk" line 221: Invalid argument 'fallback$' for modifier ':mtime' while evaluating variable "." with value "." -make: "varmod.mk" line 229: Malformed conditional '${.:L:mtime=fallback$}' make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 Index: src/usr.bin/make/unit-tests/varmod-range.mk diff -u src/usr.bin/make/unit-tests/varmod-range.mk:1.15 src/usr.bin/make/unit-tests/varmod-range.mk:1.16 --- src/usr.bin/make/unit-tests/varmod-range.mk:1.15 Thu Aug 29 20:20:36 2024 +++ src/usr.bin/make/unit-tests/varmod-range.mk Sat Jan 11 20:54:46 2025 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-range.mk,v 1.15 2024/08/29 20:20:36 rillig Exp $ +# $NetBSD: varmod-range.mk,v 1.16 2025/01/11 20:54:46 rillig Exp $ # # Tests for the :range variable modifier, which generates sequences # of integers from the given range. @@ -62,8 +62,7 @@ # # Since 2020-11-01, the parser issues a more precise "Invalid number" error # instead. -# expect+2: Invalid number "x}Rest" != "Rest"" for ':range' modifier -# expect+1: Malformed conditional '"${:U:range=x}Rest" != "Rest"' +# expect+1: Invalid number "x}Rest" != "Rest"" for ':range' modifier .if "${:U:range=x}Rest" != "Rest" . error .else @@ -73,8 +72,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: Unknown modifier "x0" -# expect+1: Malformed conditional '"${:U:range=0x0}Rest" != "Rest"' +# expect+1: Unknown modifier "x0" .if "${:U:range=0x0}Rest" != "Rest" . error .else @@ -91,8 +89,7 @@ #.endif # modifier name too short -# expect+2: Unknown modifier "rang" -# expect+1: Malformed conditional '"${a b c:L:rang}Rest" != "Rest"' +# expect+1: Unknown modifier "rang" .if "${a b c:L:rang}Rest" != "Rest" . error .else @@ -100,8 +97,7 @@ .endif # misspelled modifier name -# expect+2: Unknown modifier "rango" -# expect+1: Malformed conditional '"${a b c:L:rango}Rest" != "Rest"' +# expect+1: Unknown modifier "rango" .if "${a b c:L:rango}Rest" != "Rest" . error .else @@ -109,8 +105,7 @@ .endif # modifier name too long -# expect+2: Unknown modifier "ranger" -# expect+1: Malformed conditional '"${a b c:L:ranger}Rest" != "Rest"' +# expect+1: Unknown modifier "ranger" .if "${a b c:L:ranger}Rest" != "Rest" . error .else Index: src/usr.bin/make/unit-tests/varmod-to-separator.exp diff -u src/usr.bin/make/unit-tests/varmod-to-separator.exp:1.18 src/usr.bin/make/unit-tests/varmod-to-separator.exp:1.19 --- src/usr.bin/make/unit-tests/varmod-to-separator.exp:1.18 Thu Aug 29 20:20:37 2024 +++ src/usr.bin/make/unit-tests/varmod-to-separator.exp Sat Jan 11 20:54:46 2025 @@ -1,42 +1,29 @@ -make: "varmod-to-separator.mk" line 155: Invalid character number at "400:tu}" +make: "varmod-to-separator.mk" line 154: Invalid character number at "400:tu}" while evaluating variable "WORDS" with value "one two three" -make: "varmod-to-separator.mk" line 155: Malformed conditional '${WORDS:[1..3]:ts\400:tu}' -make: "varmod-to-separator.mk" line 171: Invalid character number at "100:tu}" +make: "varmod-to-separator.mk" line 169: Invalid character number at "100:tu}" while evaluating variable "WORDS" with value "one two three" -make: "varmod-to-separator.mk" line 171: Malformed conditional '${WORDS:[1..3]:ts\x100:tu}' -make: "varmod-to-separator.mk" line 180: Invalid character number at ",}" +make: "varmod-to-separator.mk" line 177: Invalid character number at ",}" while evaluating variable "word" with value "word" -make: "varmod-to-separator.mk" line 180: Malformed conditional '${word:L:ts\x,}' -make: "varmod-to-separator.mk" line 187: Invalid character number at "112233445566778899}" +make: "varmod-to-separator.mk" line 183: Invalid character number at "112233445566778899}" while evaluating variable "word" with value "word" -make: "varmod-to-separator.mk" line 187: Malformed conditional '${word:L:ts\x112233445566778899}' -make: "varmod-to-separator.mk" line 193: Bad modifier ":ts\-300" +make: "varmod-to-separator.mk" line 188: Bad modifier ":ts\-300" while evaluating variable "WORDS" with value "one two three" -make: "varmod-to-separator.mk" line 193: Malformed conditional '${WORDS:[1..3]:ts\-300:tu}' -make: "varmod-to-separator.mk" line 203: Bad modifier ":ts\8" +make: "varmod-to-separator.mk" line 197: Bad modifier ":ts\8" while evaluating variable "1 2 3" with value "1 2 3" -make: "varmod-to-separator.mk" line 203: Malformed conditional '${1 2 3:L:ts\8:tu}' -make: "varmod-to-separator.mk" line 212: Bad modifier ":ts\100L" +make: "varmod-to-separator.mk" line 205: Bad modifier ":ts\100L" while evaluating variable "1 2 3" with value "1 2 3" -make: "varmod-to-separator.mk" line 212: Malformed conditional '${1 2 3:L:ts\100L}' -make: "varmod-to-separator.mk" line 221: Bad modifier ":ts\x40g" +make: "varmod-to-separator.mk" line 213: Bad modifier ":ts\x40g" while evaluating variable "1 2 3" with value "1 2 3" -make: "varmod-to-separator.mk" line 221: Malformed conditional '${1 2 3:L:ts\x40g}' -make: "varmod-to-separator.mk" line 231: Bad modifier ":tx" +make: "varmod-to-separator.mk" line 222: Bad modifier ":tx" while evaluating variable "WORDS" with value "one two three four five six" -make: "varmod-to-separator.mk" line 231: Malformed conditional '${WORDS:tx}' -make: "varmod-to-separator.mk" line 240: Bad modifier ":ts\X" +make: "varmod-to-separator.mk" line 230: Bad modifier ":ts\X" while evaluating variable "WORDS" with value "one two three four five six" -make: "varmod-to-separator.mk" line 240: Malformed conditional '${WORDS:ts\X}' -make: "varmod-to-separator.mk" line 250: Bad modifier ":t\X" +make: "varmod-to-separator.mk" line 239: Bad modifier ":t\X" while evaluating variable "WORDS" with value "one two three four five six" -make: "varmod-to-separator.mk" line 250: Malformed conditional '${WORDS:t\X} != "anything"' -make: "varmod-to-separator.mk" line 267: Bad modifier ":ts\69" +make: "varmod-to-separator.mk" line 255: Bad modifier ":ts\69" while evaluating "${:Ua b:ts\69}" with value "a b" -make: "varmod-to-separator.mk" line 267: Malformed conditional '${:Ua b:ts\69}' -make: "varmod-to-separator.mk" line 276: Invalid character number at "1F60E}" +make: "varmod-to-separator.mk" line 263: Invalid character number at "1F60E}" while evaluating "${:Ua b:ts\x1F60E}" with value "a b" -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 Index: src/usr.bin/make/unit-tests/varmod-to-separator.mk diff -u src/usr.bin/make/unit-tests/varmod-to-separator.mk:1.20 src/usr.bin/make/unit-tests/varmod-to-separator.mk:1.21 --- src/usr.bin/make/unit-tests/varmod-to-separator.mk:1.20 Thu Aug 29 20:20:37 2024 +++ src/usr.bin/make/unit-tests/varmod-to-separator.mk Sat Jan 11 20:54:46 2025 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-to-separator.mk,v 1.20 2024/08/29 20:20:37 rillig Exp $ +# $NetBSD: varmod-to-separator.mk,v 1.21 2025/01/11 20:54:46 rillig Exp $ # # Tests for the :ts variable modifier, which joins the words of the variable # using an arbitrary character as word separator. @@ -150,8 +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: Invalid character number at "400:tu}" -# expect+1: Malformed conditional '${WORDS:[1..3]:ts\400:tu}' +# expect+1: Invalid character number at "400:tu}" .if ${WORDS:[1..3]:ts\400:tu} . warning The separator \400 is accepted even though it is out of bounds. .else @@ -166,8 +165,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: Invalid character number at "100:tu}" -# expect+1: Malformed conditional '${WORDS:[1..3]:ts\x100:tu}' +# expect+1: Invalid character number at "100:tu}" .if ${WORDS:[1..3]:ts\x100:tu} . warning The separator \x100 is accepted even though it is out of bounds. .else @@ -175,21 +173,18 @@ WORDS= one two three four five six .endif # The number after ':ts\x' must be hexadecimal. -# expect+2: Invalid character number at ",}" -# expect+1: Malformed conditional '${word:L:ts\x,}' +# expect+1: Invalid character number at ",}" .if ${word:L:ts\x,} .endif # The hexadecimal number must be in the range of 'unsigned long' on all # supported platforms. -# expect+2: Invalid character number at "112233445566778899}" -# expect+1: Malformed conditional '${word:L:ts\x112233445566778899}' +# expect+1: Invalid character number at "112233445566778899}" .if ${word:L:ts\x112233445566778899} .endif # Negative numbers are not allowed for the separator character. -# expect+2: Bad modifier ":ts\-300" -# expect+1: Malformed conditional '${WORDS:[1..3]:ts\-300:tu}' +# expect+1: Bad modifier ":ts\-300" .if ${WORDS:[1..3]:ts\-300:tu} . warning The separator \-300 is accepted even though it is negative. .else @@ -198,8 +193,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: Bad modifier ":ts\8" -# expect+1: Malformed conditional '${1 2 3:L:ts\8:tu}' +# expect+1: Bad modifier ":ts\8" .if ${1 2 3:L:ts\8:tu} . warning The separator \8 is accepted even though it is not octal. .else @@ -207,8 +201,7 @@ WORDS= one two three four five six .endif # Trailing characters after the octal character number are rejected. -# expect+2: Bad modifier ":ts\100L" -# expect+1: Malformed conditional '${1 2 3:L:ts\100L}' +# expect+1: Bad modifier ":ts\100L" .if ${1 2 3:L:ts\100L} . warning The separator \100L is accepted even though it contains an 'L'. .else @@ -216,8 +209,7 @@ WORDS= one two three four five six .endif # Trailing characters after the hexadecimal character number are rejected. -# expect+2: Bad modifier ":ts\x40g" -# expect+1: Malformed conditional '${1 2 3:L:ts\x40g}' +# expect+1: Bad modifier ":ts\x40g" .if ${1 2 3:L:ts\x40g} . warning The separator \x40g is accepted even though it contains a 'g'. .else @@ -226,8 +218,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+2: Bad modifier ":tx" -# expect+1: Malformed conditional '${WORDS:tx}' +# expect+1: Bad modifier ":tx" .if ${WORDS:tx} . error .else @@ -235,8 +226,7 @@ WORDS= one two three four five six .endif # The word separator can only be a single character. -# expect+2: Bad modifier ":ts\X" -# expect+1: Malformed conditional '${WORDS:ts\X}' +# expect+1: Bad modifier ":ts\X" .if ${WORDS:ts\X} . error .else @@ -245,8 +235,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: Bad modifier ":t\X" -# expect+1: Malformed conditional '${WORDS:t\X} != "anything"' +# expect+1: Bad modifier ":t\X" .if ${WORDS:t\X} != "anything" . info This line is not reached. .endif @@ -262,8 +251,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+2: Bad modifier ":ts\69" -# expect+1: Malformed conditional '${:Ua b:ts\69}' +# expect+1: Bad modifier ":ts\69" .if ${:Ua b:ts\69} . error .else @@ -271,8 +259,7 @@ WORDS= one two three four five six .endif # Try whether bmake is Unicode-ready. -# expect+2: Invalid character number at "1F60E}" -# expect+1: Malformed conditional '${:Ua b:ts\x1F60E}' +# expect+1: Invalid character number at "1F60E}" .if ${:Ua b:ts\x1F60E} # U+1F60E "smiling face with sunglasses" . error .else