head 1.21; access; symbols netbsd-10-2-RELEASE:1.9 netbsd-11-0-RELEASE:1.21 netbsd-11-0-RC7:1.21 netbsd-11-0-RC6:1.21 netbsd-11-0-RC5:1.21 netbsd-11-0-RC4:1.21 netbsd-11-0-RC3:1.21 netbsd-11-0-RC2:1.21 netbsd-11-0-RC1:1.21 perseant-exfatfs-base-20250801:1.21 netbsd-11:1.21.0.2 netbsd-11-base:1.21 netbsd-10-1-RELEASE:1.9 perseant-exfatfs-base-20240630:1.14 perseant-exfatfs:1.14.0.2 perseant-exfatfs-base:1.14 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.8 cjep_sun2x:1.8.0.4 cjep_sun2x-base:1.8 cjep_staticlib_x-base1:1.8 cjep_staticlib_x:1.8.0.2 cjep_staticlib_x-base:1.8; locks; strict; comment @# @; 1.21 date 2025.03.30.09.51.51; author rillig; state Exp; branches; next 1.20; commitid veGmSzVhPiW2G4PF; 1.20 date 2025.01.11.20.54.45; author rillig; state Exp; branches; next 1.19; commitid v92duHXtj62ZR6FF; 1.19 date 2024.08.29.20.20.36; author rillig; state Exp; branches; next 1.18; commitid EaMgk7FrF8mB1LnF; 1.18 date 2024.08.06.18.00.17; author rillig; state Exp; branches; next 1.17; commitid 1R0ZDok3menTZMkF; 1.17 date 2024.07.05.19.47.22; author rillig; state Exp; branches; next 1.16; commitid ey8c5i7vJGMuCGgF; 1.16 date 2024.07.04.20.18.40; author rillig; state Exp; branches; next 1.15; commitid 75IS4XOhTa8VOygF; 1.15 date 2024.07.04.17.47.54; author rillig; state Exp; branches; next 1.14; commitid mjDGVMgldk7QYxgF; 1.14 date 2024.04.20.10.18.55; author rillig; state Exp; branches 1.14.2.1; next 1.13; commitid 2fCjOO5HMlf2VR6F; 1.13 date 2023.06.01.20.56.35; author rillig; state Exp; branches; next 1.12; commitid j3tIvMRlxolKQhrE; 1.12 date 2023.05.09.16.31.41; author rillig; state Exp; branches; next 1.11; commitid EsfPWM3ks6ov8joE; 1.11 date 2023.05.09.16.27.00; author rillig; state Exp; branches; next 1.10; commitid Bc3DWBFcd1Ba5joE; 1.10 date 2023.05.09.08.26.14; author rillig; state Exp; branches; next 1.9; commitid I5hnd0OF1agSrgoE; 1.9 date 2021.12.09.20.27.01; author rillig; state Exp; branches; next 1.8; commitid eGc9hIGv1NMc11kD; 1.8 date 2021.01.19.05.26.34; author rillig; state Exp; branches; next 1.7; commitid n3yc5PuIo2WWriEC; 1.7 date 2020.12.21.21.04.18; author rillig; state Exp; branches; next 1.6; commitid JCxnYai5KT0fyEAC; 1.6 date 2020.12.21.20.47.29; author rillig; state Exp; branches; next 1.5; commitid 3UVy6lprARqStEAC; 1.5 date 2020.11.30.21.10.15; author rillig; state Exp; branches; next 1.4; commitid aMSOVwkswCUBhXxC; 1.4 date 2020.10.31.21.40.20; author rillig; state Exp; branches; next 1.3; commitid lnKVYPwW5Vx3n6uC; 1.3 date 2020.10.31.20.30.06; author rillig; state Exp; branches; next 1.2; commitid 1AgLoLe2zyUI16uC; 1.2 date 2020.08.23.15.13.21; author rillig; state Exp; branches; next 1.1; commitid ZRXUa0Z7hEKBuclC; 1.1 date 2020.08.16.12.07.51; author rillig; state Exp; branches; next ; commitid coEgPk3hgfeYGhkC; 1.14.2.1 date 2025.08.02.05.58.38; author perseant; state Exp; branches; next ; commitid 23j6GFaDws3O875G; desc @@ 1.21 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 @make: varmod-localtime.mk:60: Invalid time value "-1" while evaluating "${:L:localtime=-1} != """ with value "" make: varmod-localtime.mk:70: Invalid time value " 1" while evaluating "${:L:localtime= 1} != """ with value "" make: varmod-localtime.mk:117: Invalid time value "10000000000000000000000000000000" while evaluating "${:L:localtime=10000000000000000000000000000000} != """ with value "" make: varmod-localtime.mk:129: Invalid time value "error" while evaluating "${:L:localtime=error} != """ with value "" make: varmod-localtime.mk:139: Invalid time value "100000S,1970,bad," while evaluating variable "%Y" with value "%Y" make: Fatal errors encountered -- cannot continue make: stopped making "all" in unit-tests exit status 1 @ 1.20 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: "varmod-localtime.mk" line 60: Invalid time value "-1" d3 1 a3 1 make: "varmod-localtime.mk" line 70: Invalid time value " 1" d5 1 a5 1 make: "varmod-localtime.mk" line 117: Invalid time value "10000000000000000000000000000000" d7 1 a7 1 make: "varmod-localtime.mk" line 129: Invalid time value "error" d9 1 a9 1 make: "varmod-localtime.mk" line 139: Invalid time value "100000S,1970,bad," @ 1.19 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: "varmod-localtime.mk" line 61: Invalid time value "-1" d3 1 a3 2 make: "varmod-localtime.mk" line 61: Malformed conditional '${:L:localtime=-1} != ""' make: "varmod-localtime.mk" line 72: Invalid time value " 1" d5 1 a5 2 make: "varmod-localtime.mk" line 72: Malformed conditional '${:L:localtime= 1} != ""' make: "varmod-localtime.mk" line 120: Invalid time value "10000000000000000000000000000000" d7 1 a7 2 make: "varmod-localtime.mk" line 120: Malformed conditional '${:L:localtime=10000000000000000000000000000000} != ""' make: "varmod-localtime.mk" line 133: Invalid time value "error" d9 1 a9 2 make: "varmod-localtime.mk" line 133: Malformed conditional '${:L:localtime=error} != ""' make: "varmod-localtime.mk" line 144: Invalid time value "100000S,1970,bad," a10 1 make: "varmod-localtime.mk" line 144: Malformed conditional '${%Y:L:localtime=100000S,1970,bad,} != "bad"' @ 1.18 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: "varmod-localtime.mk" line 61: while evaluating "${:L:localtime=-1} != """ with value "": Invalid time value "-1" d4 2 a5 1 make: "varmod-localtime.mk" line 72: while evaluating "${:L:localtime= 1} != """ with value "": Invalid time value " 1" d7 2 a8 1 make: "varmod-localtime.mk" line 120: while evaluating "${:L:localtime=10000000000000000000000000000000} != """ with value "": Invalid time value "10000000000000000000000000000000" d10 2 a11 1 make: "varmod-localtime.mk" line 133: while evaluating "${:L:localtime=error} != """ with value "": Invalid time value "error" d13 2 a14 1 make: "varmod-localtime.mk" line 144: while evaluating variable "%Y" with value "%Y": Invalid time value "100000S,1970,bad," @ 1.17 log @make: in error messages for anonymous variables, log the value @ text @d2 1 a2 1 make: "varmod-localtime.mk" line 61: Malformed conditional (${:L:localtime=-1} != "") d4 1 a4 1 make: "varmod-localtime.mk" line 72: Malformed conditional (${:L:localtime= 1} != "") d6 1 a6 1 make: "varmod-localtime.mk" line 120: Malformed conditional (${:L:localtime=10000000000000000000000000000000} != "") d8 1 a8 1 make: "varmod-localtime.mk" line 133: Malformed conditional (${:L:localtime=error} != "") d10 1 a10 1 make: "varmod-localtime.mk" line 144: Malformed conditional (${%Y:L:localtime=100000S,1970,bad,} != "bad") @ 1.16 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: "varmod-localtime.mk" line 61: while evaluating "${:L:localtime=-1} != """: Invalid time value "-1" d3 1 a3 1 make: "varmod-localtime.mk" line 72: while evaluating "${:L:localtime= 1} != """: Invalid time value " 1" d5 1 a5 1 make: "varmod-localtime.mk" line 120: while evaluating "${:L:localtime=10000000000000000000000000000000} != """: Invalid time value "10000000000000000000000000000000" d7 1 a7 1 make: "varmod-localtime.mk" line 133: while evaluating "${:L:localtime=error} != """: Invalid time value "error" @ 1.15 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 @d12 1 a12 1 make: stopped in unit-tests @ 1.14 log @make: provide more context information for parse/evaluate errors @ text @d9 1 a9 1 make: "varmod-localtime.mk" line 144: while evaluating variable "%Y": Invalid time value "100000S,1970,bad," @ 1.14.2.1 log @Sync with HEAD @ text @d1 10 a10 10 make: varmod-localtime.mk:60: Invalid time value "-1" while evaluating "${:L:localtime=-1} != """ with value "" make: varmod-localtime.mk:70: Invalid time value " 1" while evaluating "${:L:localtime= 1} != """ with value "" make: varmod-localtime.mk:117: Invalid time value "10000000000000000000000000000000" while evaluating "${:L:localtime=10000000000000000000000000000000} != """ with value "" make: varmod-localtime.mk:129: Invalid time value "error" while evaluating "${:L:localtime=error} != """ with value "" make: varmod-localtime.mk:139: Invalid time value "100000S,1970,bad," while evaluating variable "%Y" with value "%Y" d12 1 a12 1 make: stopped making "all" in unit-tests @ 1.13 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: "varmod-localtime.mk" line 61: Invalid time value "-1" d3 1 a3 1 make: "varmod-localtime.mk" line 72: Invalid time value " 1" d5 1 a5 1 make: "varmod-localtime.mk" line 120: Invalid time value "10000000000000000000000000000000" d7 1 a7 1 make: "varmod-localtime.mk" line 133: Invalid time value "error" d9 1 a9 1 make: "varmod-localtime.mk" line 144: Invalid time value "100000S,1970,bad," @ 1.12 log @tests/make: clean up tests for ':gmtime' and ':localtime' @ text @d1 10 a10 10 make: "varmod-localtime.mk" line 59: Invalid time value "-1" make: "varmod-localtime.mk" line 59: Malformed conditional (${:L:localtime=-1} != "") make: "varmod-localtime.mk" line 68: Invalid time value " 1" make: "varmod-localtime.mk" line 68: Malformed conditional (${:L:localtime= 1} != "") make: "varmod-localtime.mk" line 114: Invalid time value "10000000000000000000000000000000" make: "varmod-localtime.mk" line 114: Malformed conditional (${:L:localtime=10000000000000000000000000000000} != "") make: "varmod-localtime.mk" line 125: Invalid time value "error" make: "varmod-localtime.mk" line 125: Malformed conditional (${:L:localtime=error} != "") make: "varmod-localtime.mk" line 134: Invalid time value "100000S,1970,bad," make: "varmod-localtime.mk" line 134: Malformed conditional (${%Y:L:localtime=100000S,1970,bad,} != "bad") @ 1.11 log @make: allow ':gmtime' and ':localtime' with dynamic argument This allows ${%Y:L:gmtime=${mtime}} instead of the indirect ${%Y:L:${:Ugmtime=${mtime}}}. The direct form also prevents any ':' from the nested expression to be interpreted as a separator, which doesn't matter for the ':gmtime' and ':localtime' modifiers but will prove useful for other modifiers that follow the same pattern. @ text @d1 10 a10 10 make: "varmod-localtime.mk" line 70: Invalid time value "-1" make: "varmod-localtime.mk" line 70: Malformed conditional (${:L:localtime=-1} != "") make: "varmod-localtime.mk" line 79: Invalid time value " 1" make: "varmod-localtime.mk" line 79: Malformed conditional (${:L:localtime= 1} != "") make: "varmod-localtime.mk" line 125: Invalid time value "10000000000000000000000000000000" make: "varmod-localtime.mk" line 125: Malformed conditional (${:L:localtime=10000000000000000000000000000000} != "") make: "varmod-localtime.mk" line 136: Invalid time value "error" make: "varmod-localtime.mk" line 136: Malformed conditional (${:L:localtime=error} != "") make: "varmod-localtime.mk" line 145: Invalid time value "100000S,1970,bad," make: "varmod-localtime.mk" line 145: Malformed conditional (${%Y:L:localtime=100000S,1970,bad,} != "bad") @ 1.10 log @tests/make: demonstrate parse bug in :gmtime and :localtime modifiers @ text @d1 1 a1 3 make: "varmod-localtime.mk" line 60: Invalid time value at "${:U1593536400}} != "mtime=11593536400}"" make: "varmod-localtime.mk" line 60: Malformed conditional (${%Y:L:localtime=${:U1593536400}} != "mtime=11593536400}") make: "varmod-localtime.mk" line 70: Invalid time value at "-1} != """ d3 1 a3 1 make: "varmod-localtime.mk" line 79: Invalid time value at " 1} != """ d5 1 a5 1 make: "varmod-localtime.mk" line 125: Invalid time value at "10000000000000000000000000000000} != """ d7 1 a7 1 make: "varmod-localtime.mk" line 136: Invalid time value at "error} != """ d9 2 @ 1.9 log @make: in parse errors, mark whitespace more clearly This prevents any trailing whitespace from going unnoticed. It also marks leading whitespace more clearly, as in the examples with the time value " 1". @ text @d1 10 a10 10 make: "varmod-localtime.mk" line 57: Invalid time value at "${:U1593536400}} != "mtime=11593536400}"" make: "varmod-localtime.mk" line 57: Malformed conditional (${%Y:L:localtime=${:U1593536400}} != "mtime=11593536400}") make: "varmod-localtime.mk" line 67: Invalid time value at "-1} != """ make: "varmod-localtime.mk" line 67: Malformed conditional (${:L:localtime=-1} != "") make: "varmod-localtime.mk" line 76: Invalid time value at " 1} != """ make: "varmod-localtime.mk" line 76: Malformed conditional (${:L:localtime= 1} != "") make: "varmod-localtime.mk" line 119: Invalid time value at "10000000000000000000000000000000} != """ make: "varmod-localtime.mk" line 119: Malformed conditional (${:L:localtime=10000000000000000000000000000000} != "") make: "varmod-localtime.mk" line 130: Invalid time value at "error} != """ make: "varmod-localtime.mk" line 130: Malformed conditional (${:L:localtime=error} != "") @ 1.8 log @make(1): fix tests for :gmtime and :localtime for 32-bit time_t The comparison operator had accidentally been '!=' instead of '=='. While here, proofread the documentation and add references for where the 32-bit time_t is defined on Linux and FreeBSD. @ text @d1 1 a1 1 make: "varmod-localtime.mk" line 57: Invalid time value: ${:U1593536400}} != "mtime=11593536400}" d3 1 a3 1 make: "varmod-localtime.mk" line 67: Invalid time value: -1} != "" d5 1 a5 1 make: "varmod-localtime.mk" line 76: Invalid time value: 1} != "" d7 1 a7 1 make: "varmod-localtime.mk" line 119: Invalid time value: 10000000000000000000000000000000} != "" d9 1 a9 1 make: "varmod-localtime.mk" line 130: Invalid time value: error} != "" @ 1.7 log @make(1): remove excess newline from parse errors (since 2020-11-01) For the modifiers :gmtime and :localtime, the excess newline had been added in var.c 1.631 from 2020-10-31 21:40:20. For the modifiers :range and :ts, the excess newline had been added in var.c 1.635 from 2020-11-01 14:36:25. @ text @d1 10 a10 10 make: "varmod-localtime.mk" line 60: Invalid time value: ${:U1593536400}} != "mtime=11593536400}" make: "varmod-localtime.mk" line 60: Malformed conditional (${%Y:L:localtime=${:U1593536400}} != "mtime=11593536400}") make: "varmod-localtime.mk" line 70: Invalid time value: -1} != "" make: "varmod-localtime.mk" line 70: Malformed conditional (${:L:localtime=-1} != "") make: "varmod-localtime.mk" line 79: Invalid time value: 1} != "" make: "varmod-localtime.mk" line 79: Malformed conditional (${:L:localtime= 1} != "") make: "varmod-localtime.mk" line 118: Invalid time value: 10000000000000000000000000000000} != "" make: "varmod-localtime.mk" line 118: Malformed conditional (${:L:localtime=10000000000000000000000000000000} != "") make: "varmod-localtime.mk" line 129: Invalid time value: error} != "" make: "varmod-localtime.mk" line 129: Malformed conditional (${:L:localtime=error} != "") @ 1.6 log @make(1): align tests for :localtime with those for :gmtime These tests had been almost the same before, now they are as similar as possible again. @ text @a1 1 a3 1 a5 1 a7 1 a9 1 @ 1.5 log @make(1): fix tests for :gmtime and :localtime for 32-bit time_t https://bugs.freebsd.org/251465 @ text @d1 1 a1 7 mod-localtime %Y 2020 %Y gmtime == gmtime mod-localtime-indirect: make: Invalid time value: ${:U1593536400}} d3 2 a4 3 ocaltime=1593536400} parse-errors: make: Invalid time value: -1}. d6 2 a7 2 : -1 becomes ocaltime=-1}. make: Invalid time value: 1}. d9 2 a10 6 : space 1 becomes ocaltime= 1}. : 0 becomes ok. : 1 becomes Thu Jan 1 01:00:01 1970. : INT32_MAX becomes Tue Jan 19 04:14:07 2038. : INT32_MAX + 1 becomes . make: Invalid time value: 10000000000000000000000000000000}. d12 2 a13 2 : overflow becomes ocaltime=10000000000000000000000000000000}. make: Invalid time value: error}. d15 4 a18 2 : letter becomes ocaltime=error}. exit status 0 @ 1.4 log @make(1): make parsing of the :gmtime and :localtime modifiers stricter These variable modifiers accept an optional timestamp in seconds, to select which date to print. This feature is only used very rarely. The NetBSD build doesn't use it at all, and the FreeBSD build mainly uses the plain modifiers :gmtime and :localtime, but not their optional argument :gmtime=1500000000. Therefore, this change is not going to affect many builds. Those that are indeed affected had been wrong all the time anyway. At parse time, these errors stop the build, as intended. After that, when the actual shell commands of the targets are expanded and run, these errors don't stop anything, the build just continues as if nothing had happened. This is a general problem with Var_Parse, see the many "handle errors" markers in the code. Another problem is that on parse errors, parsing continues and spits out spurious strings of the form "mtime" and "ocaltime". This as well is a general problem with error handling in make. ok sjg @ text @d20 1 a20 1 : INT32_MAX + 1 becomes Tue Jan 19 04:14:08 2038. @ 1.3 log @make(1): add more tests for the variable modifier :localtime @ text @d7 1 a7 1 make: Unknown modifier '1' d9 1 d11 6 a16 2 : -1 becomes Thu Jan 1 00:59:59 1970. : space 1 becomes Thu Jan 1 01:00:01 1970. d21 6 a26 3 : overflow becomes Thu Jan 1 00:59:59 1970. make: Unknown modifier 'e' : letter becomes . @ 1.2 log @make(1): move tests for :hash :range :localtime into separate files @ text @d1 1 d5 14 @ 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 3 @