head 1.14; access; symbols netbsd-11-0-RC6:1.13 netbsd-11-0-RC5:1.13 netbsd-11-0-RC4:1.13 netbsd-11-0-RC3:1.13 netbsd-11-0-RC2:1.13 netbsd-11-0-RC1:1.13 perseant-exfatfs-base-20250801:1.13 netbsd-11:1.13.0.2 netbsd-11-base:1.13 netbsd-10-1-RELEASE:1.3 perseant-exfatfs-base-20240630:1.6 perseant-exfatfs:1.6.0.2 perseant-exfatfs-base:1.6 netbsd-10-0-RELEASE:1.3 netbsd-10-0-RC6:1.3 netbsd-10-0-RC5:1.3 netbsd-10-0-RC4:1.3 netbsd-10-0-RC3:1.3 netbsd-10-0-RC2:1.3 netbsd-10-0-RC1:1.3 netbsd-10:1.3.0.6 netbsd-10-base:1.3 cjep_sun2x-base1:1.3 cjep_sun2x:1.3.0.4 cjep_sun2x-base:1.3 cjep_staticlib_x-base1:1.3 cjep_staticlib_x:1.3.0.2 cjep_staticlib_x-base:1.3; locks; strict; comment @# @; 1.14 date 2026.02.01.16.42.35; author rillig; state Exp; branches; next 1.13; commitid QDTzAMUxdyOj5HsG; 1.13 date 2025.06.28.22.39.28; author rillig; state Exp; branches; next 1.12; commitid CDDpACH2g2jV3I0G; 1.12 date 2025.03.29.19.08.52; author rillig; state Exp; branches; next 1.11; commitid y95n9TsA04p0PZOF; 1.11 date 2025.03.29.10.39.48; author rillig; state Exp; branches; next 1.10; commitid 22Yp9aLGm4mSZWOF; 1.10 date 2024.08.29.20.20.35; author rillig; state Exp; branches; next 1.9; commitid EaMgk7FrF8mB1LnF; 1.9 date 2024.07.20.11.05.11; author rillig; state Exp; branches; next 1.8; commitid Bey1UaNE0WVGeziF; 1.8 date 2024.07.05.18.59.33; author rillig; state Exp; branches; next 1.7; commitid GYmxMWv9KnPylGgF; 1.7 date 2024.07.04.17.47.54; author rillig; state Exp; branches; next 1.6; commitid mjDGVMgldk7QYxgF; 1.6 date 2024.04.23.22.51.28; author rillig; state Exp; branches 1.6.2.1; next 1.5; commitid 4KO7gVEQREzhZj7F; 1.5 date 2024.04.20.10.18.55; author rillig; state Exp; branches; next 1.4; commitid 2fCjOO5HMlf2VR6F; 1.4 date 2023.11.19.22.06.15; author rillig; state Exp; branches; next 1.3; commitid orhWVt8YK9haKgNE; 1.3 date 2021.02.23.15.19.41; author rillig; state Exp; branches; next 1.2; commitid wGJlKlrQTIQeBQIC; 1.2 date 2020.11.02.20.48.36; author rillig; state Exp; branches; next 1.1; commitid nwuDfqBIycAZ3muC; 1.1 date 2020.11.02.20.43.27; author rillig; state Exp; branches; next ; commitid fVYQg3LIBSJa2muC; 1.6.2.1 date 2025.08.02.05.58.30; author perseant; state Exp; branches; next ; commitid 23j6GFaDws3O875G; desc @@ 1.14 log @make: in stack traces, add location information for targets @ text @: undefined make: Unclosed variable "UNCLOSED" in command ": $@@ ${UNCLOSED" in target "unclosed-expression" from cmd-errors-lint.mk:19 make: Unclosed expression, expecting "}" while evaluating variable "UNCLOSED" with value "" in command ": $@@ ${UNCLOSED:" in target "unclosed-modifier" from cmd-errors-lint.mk:24 make: Unknown modifier ":Z" while evaluating variable "UNKNOWN" with value "" in command ": $@@ ${UNKNOWN:Z}" in target "unknown-modifier" from cmd-errors-lint.mk:29 : end exit status 2 @ 1.13 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 @d4 1 a4 1 in target "unclosed-expression" d8 1 a8 1 in target "unclosed-modifier" d12 1 a12 1 in target "unknown-modifier" @ 1.12 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 @d5 1 a5 1 make: Unclosed expression, expecting '}' @ 1.11 log @make: in stack traces from target commands, add the command level A target can contain several commands, and these commands are likely to contain the same expressions. To distinguish them, add one more line to the stack trace, to narrow down the source of the error. @ text @d9 1 a9 1 make: Unknown modifier "Z" @ 1.10 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 @d3 1 d7 1 d11 1 @ 1.9 log @make: don't run erroneous commands in compat mode When there is a parse or evaluation error in an expression that becomes part of the command, don't run that command, as the result of the failed evaluation typically contains garbage characters. Skip the remaining commands from that target as well, as they may depend on the erroneous command. @ text @d2 8 a9 3 make: in target "unclosed-expression": Unclosed variable "UNCLOSED" make: in target "unclosed-modifier": while evaluating variable "UNCLOSED" with value "": Unclosed expression, expecting '}' make: in target "unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z" @ 1.8 log @make: error out on unclosed expressions during parse time In exchange, this adds location information. For unnamed expressions, the value is no longer printed. This will be added back in a follow-up commit. @ text @a2 1 : unclosed-expression a3 1 : unclosed-modifier a4 1 : unknown-modifier @ 1.7 log @make: add more context information to error messages In case of a parse error or evaluation error, print the variable value in addition to the variable name, to see the effects of previous expression modifiers. In nested make calls, print the current directory at the bottom of a stack trace, as that information is otherwise hard to get in a parallel build spanning multiple directories. @ text @d4 1 a4 1 make: Unclosed expression, expecting '}' for "UNCLOSED" @ 1.6 log @make: clean up comments, code and tests @ text @d6 1 a6 1 make: in target "unknown-modifier": while evaluating variable "UNKNOWN": Unknown modifier "Z" @ 1.6.2.1 log @Sync with HEAD @ text @d2 6 a7 11 make: Unclosed variable "UNCLOSED" in command ": $@@ ${UNCLOSED" in target "unclosed-expression" make: Unclosed expression, expecting "}" while evaluating variable "UNCLOSED" with value "" in command ": $@@ ${UNCLOSED:" in target "unclosed-modifier" make: Unknown modifier ":Z" while evaluating variable "UNKNOWN" with value "" in command ": $@@ ${UNKNOWN:Z}" in target "unknown-modifier" @ 1.5 log @make: provide more context information for parse/evaluate errors @ text @d2 2 a3 2 make: in target "unclosed-variable": Unclosed variable "UNCLOSED" : unclosed-variable @ 1.4 log @make: replace 'variable expression' with 'expression' in diagnostics @ text @d2 1 a2 1 make: Unclosed variable "UNCLOSED" d6 1 a6 1 make: Unknown modifier "Z" @ 1.3 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 @d4 1 a4 1 make: Unclosed variable expression (expecting '}') for "UNCLOSED" @ 1.2 log @make(1): error out on unclosed expressions after the colon @ text @d6 1 a6 1 make: Unknown modifier 'Z' @ 1.1 log @make(1): add test for parse errors in commands in lint mode (-dL) The difference to non-lint mode is that the exit status is now 2 instead of 0. @ text @d4 1 @