head 1.18; access; symbols netbsd-11-0-RC4:1.17 netbsd-11-0-RC3:1.17 netbsd-11-0-RC2:1.17 netbsd-11-0-RC1:1.17 perseant-exfatfs-base-20250801:1.17 netbsd-11:1.17.0.2 netbsd-11-base:1.17 netbsd-10-1-RELEASE:1.6 perseant-exfatfs-base-20240630:1.9 perseant-exfatfs:1.9.0.2 perseant-exfatfs-base:1.9 netbsd-10-0-RELEASE:1.6 netbsd-10-0-RC6:1.6 netbsd-10-0-RC5:1.6 netbsd-10-0-RC4:1.6 netbsd-10-0-RC3:1.6 netbsd-10-0-RC2:1.6 netbsd-10-0-RC1:1.6 netbsd-10:1.6.0.2 netbsd-10-base:1.6 cjep_sun2x-base1:1.5 cjep_sun2x:1.5.0.4 cjep_sun2x-base:1.5 cjep_staticlib_x-base1:1.5 cjep_staticlib_x:1.5.0.2 cjep_staticlib_x-base:1.5; locks; strict; comment @# @; 1.18 date 2026.02.01.16.42.35; author rillig; state Exp; branches; next 1.17; commitid QDTzAMUxdyOj5HsG; 1.17 date 2025.06.28.22.39.28; author rillig; state Exp; branches; next 1.16; commitid CDDpACH2g2jV3I0G; 1.16 date 2025.03.29.19.08.52; author rillig; state Exp; branches; next 1.15; commitid y95n9TsA04p0PZOF; 1.15 date 2025.03.29.10.39.48; author rillig; state Exp; branches; next 1.14; commitid 22Yp9aLGm4mSZWOF; 1.14 date 2024.08.29.20.20.35; author rillig; state Exp; branches; next 1.13; commitid EaMgk7FrF8mB1LnF; 1.13 date 2024.07.20.11.05.11; author rillig; state Exp; branches; next 1.12; commitid Bey1UaNE0WVGeziF; 1.12 date 2024.07.09.19.43.01; author rillig; state Exp; branches; next 1.11; commitid qrdgBafp1onZqchF; 1.11 date 2024.07.05.18.59.33; author rillig; state Exp; branches; next 1.10; commitid GYmxMWv9KnPylGgF; 1.10 date 2024.07.04.17.47.54; author rillig; state Exp; branches; next 1.9; commitid mjDGVMgldk7QYxgF; 1.9 date 2024.04.23.22.51.28; author rillig; state Exp; branches 1.9.2.1; next 1.8; commitid 4KO7gVEQREzhZj7F; 1.8 date 2024.04.20.10.18.55; author rillig; state Exp; branches; next 1.7; commitid 2fCjOO5HMlf2VR6F; 1.7 date 2023.11.19.22.06.15; author rillig; state Exp; branches; next 1.6; commitid orhWVt8YK9haKgNE; 1.6 date 2022.09.25.12.51.37; author rillig; state Exp; branches; next 1.5; commitid 6WsJ8dpGoZZnbfVD; 1.5 date 2021.02.23.15.19.41; author rillig; state Exp; branches; next 1.4; commitid wGJlKlrQTIQeBQIC; 1.4 date 2020.11.09.23.36.34; author rillig; state Exp; branches; next 1.3; commitid 312yVCpgxDSJLgvC; 1.3 date 2020.11.02.20.48.36; author rillig; state Exp; branches; next 1.2; commitid nwuDfqBIycAZ3muC; 1.2 date 2020.11.02.20.37.50; author rillig; state Exp; branches; next 1.1; commitid o5wJACTc573o0muC; 1.1 date 2020.11.02.20.20.42; author rillig; state Exp; branches; next ; commitid MNoXd5h1o3vwUluC; 1.9.2.1 date 2025.08.02.05.58.30; author perseant; state Exp; branches; next ; commitid 23j6GFaDws3O875G; desc @@ 1.18 log @make: in stack traces, add location information for targets @ text @: undefined--eol make: Unclosed variable "UNCLOSED" in command ": $@@-${UNCLOSED" in target "unclosed-expression" from cmd-errors.mk:17 make: Unclosed expression, expecting "}" while evaluating variable "UNCLOSED" with value "" in command ": $@@-${UNCLOSED:" in target "unclosed-modifier" from cmd-errors.mk:22 make: Unknown modifier ":Z" while evaluating variable "UNKNOWN" with value "" in command ": $@@-${UNKNOWN:Z}-eol" in target "unknown-modifier" from cmd-errors.mk:27 : end-eol exit status 2 @ 1.17 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.16 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.15 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.14 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.13 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.12 log @make: error out on parse/evaluation errors in shell commands The expression ${VAR:X} has an unknown modifier ':X'. Previously, this expression errored out when the expression was evaluated at parse time, but not when the expression was evaluated when generating the commands to bring a target up to date. The errors were previously reported, they didn't affect the exit status, though. Now, errors in expressions are handled in the same way, regardless of the time at which they are evaluated. @ text @a2 1 : unclosed-expression- a3 1 : unclosed-modifier- a4 1 : unknown-modifier--eol @ 1.11 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 @d9 1 a9 1 exit status 0 @ 1.10 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.9 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.9.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}-eol" in target "unknown-modifier" d9 1 a9 1 exit status 2 @ 1.8 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.7 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.6 log @tests/make: reduce trailing whitespace @ text @d4 1 a4 1 make: Unclosed variable expression (expecting '}') for "UNCLOSED" @ 1.5 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 @d1 1 a1 1 : undefined eol d3 1 a3 1 : unclosed-variable d5 1 a5 1 : unclosed-modifier d7 2 a8 2 : unknown-modifier eol : end eol @ 1.4 log @make(1): add test that parsing continues after a parse error @ text @d6 1 a6 1 make: Unknown modifier 'Z' @ 1.3 log @make(1): error out on unclosed expressions after the colon @ text @d1 1 a1 1 : undefined d7 2 a8 2 : unknown-modifier : end @ 1.2 log @make(1): add test for unclosed variable after a colon @ text @d4 1 @ 1.1 log @make(1): add test for parse errors in shell commands, compat mode @ text @d2 3 a4 1 : unclosed @