head 1.20; access; symbols netbsd-11-0-RC4:1.20 netbsd-11-0-RC3:1.20 netbsd-11-0-RC2:1.20 netbsd-11-0-RC1:1.20 perseant-exfatfs-base-20250801:1.20 netbsd-11:1.20.0.2 netbsd-11-base:1.20 netbsd-10-1-RELEASE:1.9 perseant-exfatfs-base-20240630:1.12 perseant-exfatfs:1.12.0.2 perseant-exfatfs-base:1.12 netbsd-10-0-RELEASE:1.9 netbsd-10-0-RC6:1.9 netbsd-10-0-RC5:1.9 netbsd-10-0-RC4:1.9 netbsd-10-0-RC3:1.9 netbsd-10-0-RC2:1.9 netbsd-10-0-RC1:1.9 netbsd-10:1.9.0.2 netbsd-10-base:1.9 cjep_sun2x-base1:1.6 cjep_sun2x:1.6.0.4 cjep_sun2x-base:1.6 cjep_staticlib_x-base1:1.6 cjep_staticlib_x:1.6.0.2 cjep_staticlib_x-base:1.6; locks; strict; comment @# @; 1.20 date 2025.06.28.22.39.28; author rillig; state Exp; branches; next 1.19; commitid CDDpACH2g2jV3I0G; 1.19 date 2025.03.30.09.51.50; author rillig; state Exp; branches; next 1.18; commitid veGmSzVhPiW2G4PF; 1.18 date 2025.03.29.19.08.52; author rillig; state Exp; branches; next 1.17; commitid y95n9TsA04p0PZOF; 1.17 date 2025.01.11.20.54.45; author rillig; state Exp; branches; next 1.16; commitid v92duHXtj62ZR6FF; 1.16 date 2024.08.29.20.20.36; author rillig; state Exp; branches; next 1.15; commitid EaMgk7FrF8mB1LnF; 1.15 date 2024.08.06.18.00.17; author rillig; state Exp; branches; next 1.14; commitid 1R0ZDok3menTZMkF; 1.14 date 2024.07.05.19.47.22; author rillig; state Exp; branches; next 1.13; commitid ey8c5i7vJGMuCGgF; 1.13 date 2024.07.04.20.18.40; author rillig; state Exp; branches; next 1.12; commitid 75IS4XOhTa8VOygF; 1.12 date 2024.04.20.10.18.55; author rillig; state Exp; branches 1.12.2.1; next 1.11; commitid 2fCjOO5HMlf2VR6F; 1.11 date 2023.11.19.21.47.52; author rillig; state Exp; branches; next 1.10; commitid Af4ieJ6RMFvXDgNE; 1.10 date 2023.06.01.20.56.35; author rillig; state Exp; branches; next 1.9; commitid j3tIvMRlxolKQhrE; 1.9 date 2022.05.08.06.57.00; author rillig; state Exp; branches; next 1.8; commitid TchxzwjlBunIIdDD; 1.8 date 2022.05.08.06.51.27; author rillig; state Exp; branches; next 1.7; commitid X9v7QTHwhWLcGdDD; 1.7 date 2022.01.08.20.21.34; author rillig; state Exp; branches; next 1.6; commitid 2srbM2pUaIgw0SnD; 1.6 date 2021.02.23.15.19.41; author rillig; state Exp; branches; next 1.5; commitid wGJlKlrQTIQeBQIC; 1.5 date 2021.01.21.00.38.28; author rillig; state Exp; branches; next 1.4; commitid a8FEXSdtl1txNwEC; 1.4 date 2020.12.20.19.47.34; author rillig; state Exp; branches; next 1.3; commitid OfU1BUgRB8hOawAC; 1.3 date 2020.11.11.07.10.19; author rillig; state Exp; branches; next 1.2; commitid xdtgCUYcpXItfrvC; 1.2 date 2020.11.10.22.23.37; author rillig; state Exp; branches; next 1.1; commitid rEzDHOWu9CqSiovC; 1.1 date 2020.08.16.12.07.51; author rillig; state Exp; branches; next ; commitid coEgPk3hgfeYGhkC; 1.12.2.1 date 2025.08.02.05.58.32; author perseant; state Exp; branches; next ; commitid 23j6GFaDws3O875G; desc @@ 1.20 log @make: consistently use double quotes in error messages Previously, some error messages used single quotes, very few used backticks or parentheses, most already used double quotes. While here, reword a few error messages to be clearer or more consistent with related error messages. @ text @make: cond-token-string.mk:14: Unknown modifier ":Z" while evaluating "${:Uvalue:Z}"" with value "value" make: cond-token-string.mk:24: xvalue is not defined. make: cond-token-string.mk:31: Malformed conditional "x${:Uvalue} == """ make: cond-token-string.mk:41: Expected. CondParser_Eval: "UNDEF" make: cond-token-string.mk:51: The string literal "UNDEF" is not empty. CondParser_Eval: " " make: cond-token-string.mk:60: The string literal " " is not empty, even though it consists of whitespace only. CondParser_Eval: "${UNDEF}" make: cond-token-string.mk:70: An undefined variable in quotes expands to an empty string, which then evaluates to false. CondParser_Eval: "${:Uvalue}" make: cond-token-string.mk:76: A nonempty expression evaluates to true. CondParser_Eval: "${:U}" make: cond-token-string.mk:85: An empty variable evaluates to false. CondParser_Eval: ("${VAR}") CondParser_Eval: "quoted" == quoted Comparing "quoted" == "quoted" make: Fatal errors encountered -- cannot continue make: stopped making "all" in unit-tests exit status 1 @ 1.19 log @make: use '"filename" line 123' for locations instead of 'filename:123' The format 'filename:123' is commonly used for identifying a location in a file. Text editors recognize it and allow quick navigation through it. The previous format was specific to make and would have required custom support in editors. The new format was already used in stack traces, except for the first line. Now all lines use the same format. @ text @d4 1 a4 1 make: cond-token-string.mk:31: Malformed conditional 'x${:Uvalue} == ""' @ 1.18 log @make: add ":" to error message about unknown modifier In the manual page, the modifiers are listed with a preceding ":", so use the same pattern in the error message. This removes an inconsistency between the error messages "Unknown modifier" and "Bad modifier". @ text @d1 1 a1 1 make: "cond-token-string.mk" line 14: Unknown modifier ":Z" d3 3 a5 3 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. d7 1 a7 1 make: "cond-token-string.mk" line 51: The string literal "UNDEF" is not empty. d9 1 a9 1 make: "cond-token-string.mk" line 60: The string literal " " is not empty, even though it consists of whitespace only. d11 1 a11 1 make: "cond-token-string.mk" line 70: An undefined variable in quotes expands to an empty string, which then evaluates to false. d13 1 a13 1 make: "cond-token-string.mk" line 76: A nonempty expression evaluates to true. d15 1 a15 1 make: "cond-token-string.mk" line 85: An empty variable evaluates to false. @ 1.17 log @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. @ text @d1 1 a1 1 make: "cond-token-string.mk" line 14: Unknown modifier "Z" @ 1.16 log @make: reduce line length in error messages The error messages for deeply nested parse errors were hard to decipher, due to the large amount of text. Split these messages into individual lines, just as in the backtrace for .include files and .for loops. This unified backtrace makes the output more uniform. @ text @d1 1 a1 1 make: "cond-token-string.mk" line 15: Unknown modifier "Z" d3 3 a5 4 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. d7 1 a7 1 make: "cond-token-string.mk" line 52: The string literal "UNDEF" is not empty. d9 1 a9 1 make: "cond-token-string.mk" line 61: The string literal " " is not empty, even though it consists of whitespace only. d11 1 a11 1 make: "cond-token-string.mk" line 71: An undefined variable in quotes expands to an empty string, which then evaluates to false. d13 1 a13 1 make: "cond-token-string.mk" line 77: A nonempty expression evaluates to true. d15 1 a15 1 make: "cond-token-string.mk" line 86: An empty variable evaluates to false. @ 1.15 log @make: in error message about conditionals, use single quotes Single quotes are used less often in the conditionals themselves, which leads to fewer confusions. @ text @d1 2 a2 1 make: "cond-token-string.mk" line 15: while evaluating "${:Uvalue:Z}"" with value "value": Unknown modifier "Z" @ 1.14 log @make: in error messages for anonymous variables, log the value @ text @d2 1 a2 1 make: "cond-token-string.mk" line 15: Malformed conditional ("" != "${:Uvalue:Z}") d4 1 a4 1 make: "cond-token-string.mk" line 32: Malformed conditional (x${:Uvalue} == "") @ 1.13 log @make: on error, print the targets to be made This helps to understand situations with several nested sub-makes in varying directories. @ text @d1 1 a1 1 make: "cond-token-string.mk" line 15: while evaluating "${:Uvalue:Z}"": Unknown modifier "Z" @ 1.12 log @make: provide more context information for parse/evaluate errors @ text @d20 1 a20 1 make: stopped in unit-tests @ 1.12.2.1 log @Sync with HEAD @ text @d1 5 a5 5 make: cond-token-string.mk:14: Unknown modifier ":Z" while evaluating "${:Uvalue:Z}"" with value "value" make: cond-token-string.mk:24: xvalue is not defined. make: cond-token-string.mk:31: Malformed conditional "x${:Uvalue} == """ make: cond-token-string.mk:41: Expected. d7 1 a7 1 make: cond-token-string.mk:51: The string literal "UNDEF" is not empty. d9 1 a9 1 make: cond-token-string.mk:60: The string literal " " is not empty, even though it consists of whitespace only. d11 1 a11 1 make: cond-token-string.mk:70: An undefined variable in quotes expands to an empty string, which then evaluates to false. d13 1 a13 1 make: cond-token-string.mk:76: A nonempty expression evaluates to true. d15 1 a15 1 make: cond-token-string.mk:85: An empty variable evaluates to false. d20 1 a20 1 make: stopped making "all" in unit-tests @ 1.11 log @tests/make: replace 'variable expression' with 'expression' Each expression is based on a variable, there's no need for the verbosity. The wording in make's diagnostics will be changed in a follow-up commit. @ text @d1 1 a1 1 make: "cond-token-string.mk" line 15: Unknown modifier "Z" @ 1.10 log @tests/make: force line-based diagnostics to be listed in the tests This way, contradictions between the intended output and the actual output are closer together and have a better chance of being spotted. @ text @d13 1 a13 1 make: "cond-token-string.mk" line 77: A nonempty variable expression evaluates to true. @ 1.9 log @tests/make: fix typo in variable name @ text @d1 5 a5 5 make: "cond-token-string.mk" line 13: Unknown modifier "Z" make: "cond-token-string.mk" line 13: Malformed conditional ("" != "${:Uvalue:Z}") make: "cond-token-string.mk" line 22: xvalue is not defined. make: "cond-token-string.mk" line 28: Malformed conditional (x${:Uvalue} == "") make: "cond-token-string.mk" line 37: Expected. d7 1 a7 1 make: "cond-token-string.mk" line 46: The string literal "UNDEF" is not empty. d9 1 a9 1 make: "cond-token-string.mk" line 54: The string literal " " is not empty, even though it consists of whitespace only. d11 1 a11 1 make: "cond-token-string.mk" line 63: An undefined variable in quotes expands to an empty string, which then evaluates to false. d13 1 a13 1 make: "cond-token-string.mk" line 68: A nonempty variable expression evaluates to true. d15 1 a15 1 make: "cond-token-string.mk" line 76: An empty variable evaluates to false. @ 1.8 log @tests/make: migrate cond1 test to other, more specific tests The tests in cond1 were a mixture of "everything related to conditions", and the test cases were heavily dependent on each other, which made them hard to understand. Move each test case to its corresponding special-purpose test. @ text @d16 1 a16 2 CondParser_Eval: ("${VALUE}") make: "cond-token-string.mk" line 84: Missing argument for ".error" @ 1.7 log @make: fix reported line numbers of continuation lines (since 2002) Previously, multi-line directives like '.info' or '.error' reported the line number of their last line instead of their first line, which is more usual. This also affected the debug log from '-dp'. @ text @d16 4 @ 1.6 log @make: improve error message for unknown modifier Back in 1995, the modifiers were all single-character, and it made sense to print only the first character. Nowadays, with ':S', ':@@var@@...@@', '::=' and several others, a little more context is useful to see where the exact error is. The actual modifier is still guessed, and the guess may be wrong as soon as backslashes get involved, but it is still better than before. @ text @d9 1 a9 1 make: "cond-token-string.mk" line 55: The string literal " " is not empty, even though it consists of whitespace only. d11 1 a11 1 make: "cond-token-string.mk" line 64: An undefined variable in quotes expands to an empty string, which then evaluates to false. @ 1.5 log @make(1): add more tests for tokens in conditionals @ text @d1 1 a1 1 make: "cond-token-string.mk" line 13: Unknown modifier 'Z' @ 1.4 log @make(1): error out on unknown variable modifiers at parse time Before, make printed an "error message" that did not include the word error and thus was not easily identified as such. This "error message" also did not influence the exit status in the default mode but only in -dL mode. The error message also didn't include any line number information and was thus rude. @ text @d1 15 a15 5 make: "cond-token-string.mk" line 9: Unknown modifier 'Z' make: "cond-token-string.mk" line 9: Malformed conditional ("" != "${:Uvalue:Z}") make: "cond-token-string.mk" line 18: xvalue is not defined. make: "cond-token-string.mk" line 24: Malformed conditional (x${:Uvalue} == "") make: "cond-token-string.mk" line 33: Expected. @ 1.3 log @make(1): fix line numbers in test cond-token-string @ text @d1 1 a1 1 make: Unknown modifier 'Z' @ 1.2 log @make(1): add more tests for parsing .if directives The details of parsing are quite tricky and not documented in the manual page. Record the current behavior to be a little safer in future refactorings. @ text @d2 4 a5 4 make: "cond-token-string.mk" line 12: Malformed conditional ("" != "${:Uvalue:Z}") make: "cond-token-string.mk" line 21: xvalue is not defined. make: "cond-token-string.mk" line 27: Malformed conditional (x${:Uvalue} == "") make: "cond-token-string.mk" line 34: Expected. @ 1.1 log @make(1): add dummies for fine-grained tests, one per single feature The test names have been derived from the current manual page. All these tests are dummies right now, and the code from the existing tests will be moved into the new tests step by step. This is done to prevent modmisc, escape, varmod-edge and varmisc from growing without any bounds, and to reduce the side-effects of one test to the others. @ text @d1 8 a8 1 exit status 0 @