head 1.16; access; symbols netbsd-11-0-RELEASE:1.16 netbsd-11-0-RC7:1.16 netbsd-11-0-RC6:1.16 netbsd-11-0-RC5:1.16 netbsd-11-0-RC4:1.16 netbsd-11-0-RC3:1.16 netbsd-11-0-RC2:1.16 netbsd-11-0-RC1:1.16 perseant-exfatfs-base-20250801:1.16 netbsd-11:1.16.0.2 netbsd-11-base:1.16 netbsd-10-1-RELEASE:1.7 perseant-exfatfs-base-20240630:1.9 perseant-exfatfs:1.9.0.2 perseant-exfatfs-base:1.9 netbsd-10-0-RELEASE:1.7 netbsd-10-0-RC6:1.7 netbsd-10-0-RC5:1.7 netbsd-10-0-RC4:1.7 netbsd-10-0-RC3:1.7 netbsd-10-0-RC2:1.7 netbsd-10-0-RC1:1.7 netbsd-10:1.7.0.2 netbsd-10-base:1.7 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.16 date 2025.06.29.11.27.21; author rillig; state Exp; branches; next 1.15; commitid MRlEV7sRXSprjM0G; 1.15 date 2025.04.30.06.01.07; author rillig; state Exp; branches; next 1.14; commitid 2V0stGWJlTlyq2TF; 1.14 date 2025.03.30.09.51.50; author rillig; state Exp; branches; next 1.13; commitid veGmSzVhPiW2G4PF; 1.13 date 2025.03.29.19.08.52; author rillig; state Exp; branches; next 1.12; commitid y95n9TsA04p0PZOF; 1.12 date 2024.08.29.20.20.36; author rillig; state Exp; branches; next 1.11; commitid EaMgk7FrF8mB1LnF; 1.11 date 2024.07.04.20.18.40; author rillig; state Exp; branches; next 1.10; commitid 75IS4XOhTa8VOygF; 1.10 date 2024.07.04.17.47.54; author rillig; state Exp; branches; next 1.9; commitid mjDGVMgldk7QYxgF; 1.9 date 2024.04.20.10.18.55; author rillig; state Exp; branches 1.9.2.1; next 1.8; commitid 2fCjOO5HMlf2VR6F; 1.8 date 2023.06.01.20.56.35; author rillig; state Exp; branches; next 1.7; commitid j3tIvMRlxolKQhrE; 1.7 date 2022.09.08.20.23.45; author rillig; state Exp; branches; next 1.6; commitid smX5ku5k13qle6TD; 1.6 date 2021.11.30.23.52.19; author rillig; state Exp; branches; next 1.5; commitid t0HbaH5RaOzQrSiD; 1.5 date 2021.11.20.17.47.33; author rillig; state Exp; branches; next 1.4; commitid JRCPLzt67seFKyhD; 1.4 date 2021.11.13.18.37.42; author rillig; state Exp; branches; next 1.3; commitid oi3CdrudMLZt9FgD; 1.3 date 2020.12.27.21.31.27; author rillig; state Exp; branches; next 1.2; commitid 3hWht9CafSeZwqBC; 1.2 date 2020.11.08.13.46.15; author rillig; state Exp; branches; next 1.1; commitid BH9RI7VxXRvax5vC; 1.1 date 2020.08.16.12.07.51; author rillig; state Exp; branches; next ; commitid coEgPk3hgfeYGhkC; 1.9.2.1 date 2025.08.02.05.58.38; author perseant; state Exp; branches; next ; commitid 23j6GFaDws3O875G; desc @@ 1.16 log @make: if a condition is erroneous, skip the whole .if/.endif @ text @make: var-op-expand.mk:274: Unknown modifier ":s,value,replaced," while evaluating variable "later" with value "" while evaluating variable "indirect" with value "${later:s,value,replaced,} ok ${later:value=sysv}" make: var-op-expand.mk:282: Unknown modifier ":s,value,replaced," while evaluating variable "later" with value "lowercase-value" while evaluating variable "indirect" with value "${later:s,value,replaced,} ok ${later:value=sysv}" make: var-op-expand.mk:295: Bad condition while evaluating condition " < 0 " make: var-op-expand.mk:295: Unknown modifier ":Z1" while parsing "${:Z1}:${:Z2}}" while evaluating then-branch of condition " < 0 " make: var-op-expand.mk:295: Unknown modifier ":Z2" while parsing "${:Z2}}" while evaluating else-branch of condition " < 0 " make: var-op-expand.mk:295: Unknown modifier ":Z1" while evaluating "${:Z1}:${:Z2}}" with value "" make: var-op-expand.mk:295: Unknown modifier ":Z2" while evaluating "${:Z2}}" with value "" make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 @ 1.15 log @make: fix order of error messages in the ":?" modifier While here: In Var_Parse, EvalStack_Pop needs to be called before freeing the short-lived variable, as its name is part of the evaluation stack. @ text @d4 1 a4 2 make: var-op-expand.mk:278: warning: XXX Neither branch should be taken. make: var-op-expand.mk:283: Unknown modifier ":s,value,replaced," d7 1 a7 2 make: var-op-expand.mk:285: warning: XXX Neither branch should be taken. make: var-op-expand.mk:297: Bad condition d9 1 a9 1 make: var-op-expand.mk:297: Unknown modifier ":Z1" d12 1 a12 1 make: var-op-expand.mk:297: Unknown modifier ":Z2" d15 1 a15 1 make: var-op-expand.mk:297: Unknown modifier ":Z1" d17 1 a17 1 make: var-op-expand.mk:297: Unknown modifier ":Z2" @ 1.14 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 @d9 12 d22 1 a22 1 make: stopped making "all" in unit-tests @ 1.13 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: "var-op-expand.mk" line 274: Unknown modifier ":s,value,replaced," d4 2 a5 2 make: "var-op-expand.mk" line 278: warning: XXX Neither branch should be taken. make: "var-op-expand.mk" line 283: Unknown modifier ":s,value,replaced," d8 1 a8 1 make: "var-op-expand.mk" line 285: warning: XXX Neither branch should be taken. @ 1.12 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: "var-op-expand.mk" line 274: Unknown modifier "s,value,replaced," d5 1 a5 1 make: "var-op-expand.mk" line 283: Unknown modifier "s,value,replaced," @ 1.11 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 3 a3 1 make: "var-op-expand.mk" line 274: while evaluating variable "indirect" with value "${later:s,value,replaced,} ok ${later:value=sysv}": while evaluating variable "later" with value "": Unknown modifier "s,value,replaced," d5 3 a7 1 make: "var-op-expand.mk" line 283: while evaluating variable "indirect" with value "${later:s,value,replaced,} ok ${later:value=sysv}": while evaluating variable "later" with value "lowercase-value": Unknown modifier "s,value,replaced," @ 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 @d6 1 a6 1 make: stopped in unit-tests @ 1.9 log @make: provide more context information for parse/evaluate errors @ text @d1 1 a1 1 make: "var-op-expand.mk" line 274: while evaluating variable "indirect": while evaluating variable "later": Unknown modifier "s,value,replaced," d3 1 a3 1 make: "var-op-expand.mk" line 283: while evaluating variable "indirect": while evaluating variable "later": Unknown modifier "s,value,replaced," @ 1.9.2.1 log @Sync with HEAD @ text @d1 4 a4 18 make: var-op-expand.mk:274: Unknown modifier ":s,value,replaced," while evaluating variable "later" with value "" while evaluating variable "indirect" with value "${later:s,value,replaced,} ok ${later:value=sysv}" make: var-op-expand.mk:282: Unknown modifier ":s,value,replaced," while evaluating variable "later" with value "lowercase-value" while evaluating variable "indirect" with value "${later:s,value,replaced,} ok ${later:value=sysv}" make: var-op-expand.mk:295: Bad condition while evaluating condition " < 0 " make: var-op-expand.mk:295: Unknown modifier ":Z1" while parsing "${:Z1}:${:Z2}}" while evaluating then-branch of condition " < 0 " make: var-op-expand.mk:295: Unknown modifier ":Z2" while parsing "${:Z2}}" while evaluating else-branch of condition " < 0 " make: var-op-expand.mk:295: Unknown modifier ":Z1" while evaluating "${:Z1}:${:Z2}}" with value "" make: var-op-expand.mk:295: Unknown modifier ":Z2" while evaluating "${:Z2}}" with value "" @ 1.8 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 @d1 1 a1 1 make: "var-op-expand.mk" line 274: Unknown modifier "s,value,replaced," d3 1 a3 1 make: "var-op-expand.mk" line 283: Unknown modifier "s,value,replaced," @ 1.7 log @tests/make: extend tests for the ':=' assignment operator @ text @d2 3 a4 3 make: "var-op-expand.mk" line 277: warning: XXX Neither branch should be taken. make: "var-op-expand.mk" line 282: Unknown modifier "s,value,replaced," make: "var-op-expand.mk" line 283: warning: XXX Neither branch should be taken. @ 1.6 log @tests/make: test and document .MAKE.SAVE_DOLLARS and ':=' @ text @d1 4 a4 4 make: "var-op-expand.mk" line 265: Unknown modifier "s,value,replaced," make: "var-op-expand.mk" line 268: warning: XXX Neither branch should be taken. make: "var-op-expand.mk" line 273: Unknown modifier "s,value,replaced," make: "var-op-expand.mk" line 274: warning: XXX Neither branch should be taken. @ 1.5 log @tests/make: finish a previously unfinished sentence in a comment @ text @d1 1 a1 3 make: "var-op-expand.mk" line 259: Unknown modifier "s,value,replaced," make: "var-op-expand.mk" line 262: warning: XXX Neither branch should be taken. make: "var-op-expand.mk" line 267: Unknown modifier "s,value,replaced," d3 2 @ 1.4 log @tests/make: test double indirection in ':=' with undefined variable Reported by Simon J Gerraty via private mail. This edge case has been handled in essentially the same way since at least 2000-05-30, probably several years earlier as well. The test file is: ---- snip ---- .undef LATER .undef later INDIRECT:= ${LATER:S,value,replaced,} indirect:= ${INDIRECT:C,S,s,} # expect+1: Unknown modifier "s,value,replaced," .if ${indirect} != "" . error .else . warning XXX Neither branch should be taken. .endif LATER= uppercase-value later= lowercase-value # expect+1: Unknown modifier "s,value,replaced," .if ${indirect} != "uppercase-replaced" . warning XXX Neither branch should be taken. .else . error .endif all: @@:; ---- snap ---- The output from 'make -r -f later.mk' is: make-2000.05.30.02.32.21 | make: Unknown modifier 's' | | "later.mk", line 9: Need an operator | make: Unknown modifier 's' | | "later.mk", line 15: Need an operator | Fatal errors encountered -- cannot continue | exit status 1 make-2000.12.30.16.38.22 The pathnames in the error message gets absolute: make-2001.01.23.02.48.05 | make: Unknown modifier 's' | | ".../later.mk", line 9: Need an operator | make: Unknown modifier 's' | | ".../later.mk", line 15: Need an operator | Fatal errors encountered -- cannot continue | exit status 1 make-2001.01.23.02.48.05 All error messages get 'make:' as a common prefix: make-2001.02.23.21.11.38 | make: Unknown modifier 's' | | make: ".../later.mk" line 9: Need an operator | make: Unknown modifier 's' | | make: ".../later.mk" line 15: Need an operator | make: Fatal errors encountered -- cannot continue | exit status 1 make-2001.05.29.17.37.52 The 'stopped in' gets added: make-2001.06.12.23.36.18 | make: Unknown modifier 's' | | make: ".../later.mk" line 9: Need an operator | make: Unknown modifier 's' | | make: ".../later.mk" line 15: Need an operator | make: Fatal errors encountered -- cannot continue | | make: stopped in ... | exit status 1 make-2002.02.21.22.21.34 The empty lines between the error messages get removed. make-2002.03.21.11.42.21 | make: Unknown modifier 's' | make: ".../later.mk" line 9: Need an operator | make: Unknown modifier 's' | make: ".../later.mk" line 15: Need an operator | make: Fatal errors encountered -- cannot continue | | make: stopped in ... | exit status 1 make-2009.10.15.02.27.44 The error message for unknown directives gets more helpful: make-2009.11.19.06.48.37 | make: Unknown modifier 's' | make: ".../later.mk" line 9: Unknown directive | make: Unknown modifier 's' | make: ".../later.mk" line 15: Unknown directive | make: Fatal errors encountered -- cannot continue | | make: stopped in ... | exit status 1 make-2010.02.22.19.20.33 The directives '.error', '.warning' and '.info' get added: make-2010.04.29.23.12.21 | make: Unknown modifier 's' | make: ".../later.mk" line 9: warning: XXX Neither branch should be taken. | make: Unknown modifier 's' | make: ".../later.mk" line 15: warning: XXX Neither branch should be taken. | exit status 0 make-2020.12.20.19.37.23 The error message about an unknown variable modifier gets line number information: make-2020.12.20.19.47.34 | make: ".../later.mk" line 6: Unknown modifier 's' | make: ".../later.mk" line 9: warning: XXX Neither branch should be taken. | make: ".../later.mk" line 14: Unknown modifier 's' | make: ".../later.mk" line 15: warning: XXX Neither branch should be taken. | make: Fatal errors encountered -- cannot continue | make: stopped in ... | exit status 1 make-2021.02.23.15.07.58 The error message about an unknown variable modifier gets more context than only a single letter: make-2021.02.23.15.19.41 | make: ".../later.mk" line 6: Unknown modifier "s,value,replaced," | make: ".../later.mk" line 9: warning: XXX Neither branch should be taken. | make: ".../later.mk" line 14: Unknown modifier "s,value,replaced," | make: ".../later.mk" line 15: warning: XXX Neither branch should be taken. | make: Fatal errors encountered -- cannot continue | make: stopped in ... | exit status 1 @ text @d1 4 a4 4 make: "var-op-expand.mk" line 229: Unknown modifier "s,value,replaced," make: "var-op-expand.mk" line 232: warning: XXX Neither branch should be taken. make: "var-op-expand.mk" line 237: Unknown modifier "s,value,replaced," make: "var-op-expand.mk" line 238: warning: XXX Neither branch should be taken. @ 1.3 log @make(1): move test result of var-op-expand.mk from exp to mk This makes it easier to run this test in older versions of make. Empty output means success. @ text @d1 7 a7 1 exit status 0 @ 1.2 log @make(1): add test for edge case in resolving undefined variables @ text @a0 9 Var_Parse: ${UNDEF} with VARE_WANTRES Global:VAR_ASSIGN_ = undef value Var_Parse: ${UNDEF} with VARE_WANTRES Var_Parse: ${UNDEF} with VARE_WANTRES Global:VAR_SUBST_${UNDEF} = Var_Parse: ${UNDEF} with VARE_WANTRES Global:VAR_SUBST_ = undef value Global:.MAKEFLAGS = -r -k -d v -d Global:.MAKEFLAGS = -r -k -d v -d 0 @ 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 9 @