head 1.19; access; symbols netbsd-11-0-RELEASE:1.18 netbsd-11-0-RC7:1.18 netbsd-11-0-RC6:1.18 netbsd-11-0-RC5:1.18 netbsd-11-0-RC4:1.18 netbsd-11-0-RC3:1.18 netbsd-11-0-RC2:1.18 netbsd-11-0-RC1:1.18 perseant-exfatfs-base-20250801:1.18 netbsd-11:1.18.0.2 netbsd-11-base:1.18 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.2 netbsd-10-base:1.3 cjep_sun2x-base1:1.2 cjep_sun2x:1.2.0.4 cjep_sun2x-base:1.2 cjep_staticlib_x-base1:1.2 cjep_staticlib_x:1.2.0.2 cjep_staticlib_x-base:1.2; locks; strict; comment @# @; 1.19 date 2026.02.01.16.42.35; author rillig; state Exp; branches; next 1.18; commitid QDTzAMUxdyOj5HsG; 1.18 date 2025.06.28.22.39.28; author rillig; state Exp; branches; next 1.17; commitid CDDpACH2g2jV3I0G; 1.17 date 2025.06.13.03.51.18; author rillig; state Exp; branches; next 1.16; commitid Dmn2d9jxc5gaiGYF; 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.22.18.11.15; author rillig; state Exp; branches; next 1.12; commitid uk14bJ5ilKgKxRiF; 1.12 date 2024.07.22.18.02.51; author rillig; state Exp; branches; next 1.11; commitid ER3UHHKBOg0TuRiF; 1.11 date 2024.07.20.14.09.27; author rillig; state Exp; branches; next 1.10; commitid gCcaIctsJPtNgAiF; 1.10 date 2024.07.20.13.59.31; author rillig; state Exp; branches; next 1.9; commitid xrsYYKle4uE19AiF; 1.9 date 2024.07.09.19.43.01; author rillig; state Exp; branches; next 1.8; commitid qrdgBafp1onZqchF; 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 2022.09.25.12.51.37; author rillig; state Exp; branches; next 1.2; commitid 6WsJ8dpGoZZnbfVD; 1.2 date 2021.02.23.15.19.41; author rillig; state Exp; branches; next 1.1; commitid wGJlKlrQTIQeBQIC; 1.1 date 2020.12.27.05.11.40; author rillig; state Exp; branches; next ; commitid KP1EqmIL4wQG6lBC; 1.6.2.1 date 2025.08.02.05.58.30; author perseant; state Exp; branches; next ; commitid 23j6GFaDws3O875G; desc @@ 1.19 log @make: in stack traces, add location information for targets @ text @begin undefined-direct : undefined-direct--eol end undefined-direct with status 0 begin undefined-indirect : undefined-direct--eol end undefined-indirect with status 0 begin parse-error-direct make: Unclosed variable "UNCLOSED" in command ": unexpected $@@-${UNCLOSED" in target "parse-error-unclosed-expression" from cmd-errors-jobs.mk:42 in make[1] in directory "" make: Unclosed expression, expecting "}" while evaluating variable "UNCLOSED" with value "" in command ": unexpected $@@-${UNCLOSED:" in target "parse-error-unclosed-modifier" from cmd-errors-jobs.mk:45 in make[1] in directory "" make: Unknown modifier ":Z" while evaluating variable "UNKNOWN" with value "" in command ": unexpected $@@-${UNKNOWN:Z}-eol" in target "parse-error-unknown-modifier" from cmd-errors-jobs.mk:48 in make[1] in directory "" end parse-error-direct with status 2 begin parse-error-indirect make: Unclosed variable "UNCLOSED" in command ": unexpected $@@-${UNCLOSED" in target "parse-error-unclosed-expression" from cmd-errors-jobs.mk:42 in make[1] in directory "" make: Unclosed expression, expecting "}" while evaluating variable "UNCLOSED" with value "" in command ": unexpected $@@-${UNCLOSED:" in target "parse-error-unclosed-modifier" from cmd-errors-jobs.mk:45 in make[1] in directory "" make: Unknown modifier ":Z" while evaluating variable "UNKNOWN" with value "" in command ": unexpected $@@-${UNKNOWN:Z}-eol" in target "parse-error-unknown-modifier" from cmd-errors-jobs.mk:48 in make[1] in directory "" end parse-error-indirect with status 2 begin begin-direct (exit 13) # .BEGIN *** Error code 13 (continuing) Stop. make: stopped making "begin-direct" in unit-tests end begin-direct with status 1 begin begin-indirect (exit 13) # before-begin *** Error code 13 (continuing) Stop. make: stopped making "begin-indirect" in unit-tests end begin-indirect with status 1 begin end-direct (exit 13) # .END *** Error code 13 (continuing) Stop. make: stopped making "end-direct" in unit-tests end end-direct with status 1 begin end-indirect (exit 13) # before-end *** Error code 13 (continuing) Stop. make: stopped making "end-indirect" in unit-tests end end-indirect with status 1 exit status 0 @ 1.18 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 @d12 1 a12 1 in target "parse-error-unclosed-expression" d17 1 a17 1 in target "parse-error-unclosed-modifier" d22 1 a22 1 in target "parse-error-unknown-modifier" d29 1 a29 1 in target "parse-error-unclosed-expression" d34 1 a34 1 in target "parse-error-unclosed-modifier" d39 1 a39 1 in target "parse-error-unknown-modifier" @ 1.17 log @make: add on-demand inter-process stack traces When debugging a build that heavily uses nested calls to sub-makes, the chain of calls is useful to quickly assess the situation. If explicitly requested, include the actions from any parent processes in the stack traces. Reviewed by: sjg @ text @d14 1 a14 1 make: Unclosed expression, expecting '}' d31 1 a31 1 make: Unclosed expression, expecting '}' @ 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 @d13 1 d18 1 d23 1 d30 1 d35 1 d40 1 @ 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 @d17 1 a17 1 make: Unknown modifier "Z" d31 1 a31 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 @d11 1 d15 1 d19 1 d25 1 d29 1 d33 1 @ 1.13 log @make: fix exit status for error in .BEGIN/.END prerequisite @ text @d10 8 a17 3 make: in target "parse-error-unclosed-expression": Unclosed variable "UNCLOSED" make: in target "parse-error-unclosed-modifier": while evaluating variable "UNCLOSED" with value "": Unclosed expression, expecting '}' make: in target "parse-error-unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z" d21 8 a28 3 make: in target "parse-error-unclosed-expression": Unclosed variable "UNCLOSED" make: in target "parse-error-unclosed-modifier": while evaluating variable "UNCLOSED" with value "": Unclosed expression, expecting '}' make: in target "parse-error-unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z" @ 1.12 log @tests/make: demonstrate wrong exit status for .END dependency @ text @d33 5 a37 1 end begin-indirect with status 0 d51 5 a55 1 end end-indirect with status 0 @ 1.11 log @make: don't run erroneous commands in parallel mode @ text @d1 49 a49 9 : undefined--eol 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" make: in target "depend-source": while evaluating variable "UNCLOSED" with value "": Unclosed expression, expecting '}' : end-eol : Making depend-target : .END-eol exit status 2 @ 1.10 log @tests/make: demonstrate failing dependency in parallel mode In parallel mode, when generating the commands for a target, parse or evaluation errors still continue generating and executing the commands. And if the commands succeed, the targets that depend on this target are still made. @ text @a2 1 : unclosed-expression- a3 1 : unclosed-modifier- a4 1 : unknown-modifier--eol a5 1 : depend-source- @ 1.9 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 @d8 2 d11 2 @ 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 @d9 1 a9 1 exit status 0 @ 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 @d1 8 a8 78 begin undefined-direct : undefined-direct--eol end undefined-direct with status 0 begin undefined-indirect : undefined-direct--eol end undefined-indirect with status 0 begin parse-error-direct make: Unclosed variable "UNCLOSED" in command ": unexpected $@@-${UNCLOSED" in target "parse-error-unclosed-expression" in make[1] in directory "" make: Unclosed expression, expecting "}" while evaluating variable "UNCLOSED" with value "" in command ": unexpected $@@-${UNCLOSED:" in target "parse-error-unclosed-modifier" in make[1] in directory "" make: Unknown modifier ":Z" while evaluating variable "UNKNOWN" with value "" in command ": unexpected $@@-${UNKNOWN:Z}-eol" in target "parse-error-unknown-modifier" in make[1] in directory "" end parse-error-direct with status 2 begin parse-error-indirect make: Unclosed variable "UNCLOSED" in command ": unexpected $@@-${UNCLOSED" in target "parse-error-unclosed-expression" in make[1] in directory "" make: Unclosed expression, expecting "}" while evaluating variable "UNCLOSED" with value "" in command ": unexpected $@@-${UNCLOSED:" in target "parse-error-unclosed-modifier" in make[1] in directory "" make: Unknown modifier ":Z" while evaluating variable "UNKNOWN" with value "" in command ": unexpected $@@-${UNKNOWN:Z}-eol" in target "parse-error-unknown-modifier" in make[1] in directory "" end parse-error-indirect with status 2 begin begin-direct (exit 13) # .BEGIN *** Error code 13 (continuing) Stop. make: stopped making "begin-direct" in unit-tests end begin-direct with status 1 begin begin-indirect (exit 13) # before-begin *** Error code 13 (continuing) Stop. make: stopped making "begin-indirect" in unit-tests end begin-indirect with status 1 begin end-direct (exit 13) # .END *** Error code 13 (continuing) Stop. make: stopped making "end-direct" in unit-tests end end-direct with status 1 begin end-indirect (exit 13) # before-end *** Error code 13 (continuing) Stop. make: stopped making "end-indirect" in unit-tests end end-indirect with status 1 @ 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 @tests/make: reduce trailing whitespace @ text @d4 1 a4 1 make: Unclosed variable expression (expecting '}') for "UNCLOSED" @ 1.2 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.1 log @make(1): add test for expansion errors in jobs mode Since compat mode and jobs mode are implemented separately and vary in lots of small details, each of them needs to be tested on its own. @ text @d6 1 a6 1 make: Unknown modifier 'Z' @