head	1.26;
access;
symbols
	netbsd-10-2-RELEASE:1.6
	netbsd-11-0-RELEASE:1.26
	netbsd-11-0-RC7:1.26
	netbsd-11-0-RC6:1.26
	netbsd-11-0-RC5:1.26
	netbsd-11-0-RC4:1.26
	netbsd-11-0-RC3:1.26
	netbsd-11-0-RC2:1.26
	netbsd-11-0-RC1:1.26
	perseant-exfatfs-base-20250801:1.26
	netbsd-11:1.26.0.2
	netbsd-11-base:1.26
	netbsd-10-1-RELEASE:1.6
	perseant-exfatfs-base-20240630:1.12
	perseant-exfatfs:1.12.0.2
	perseant-exfatfs-base:1.12
	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.4
	cjep_sun2x:1.4.0.4
	cjep_sun2x-base:1.4
	cjep_staticlib_x-base1:1.4
	cjep_staticlib_x:1.4.0.2
	cjep_staticlib_x-base:1.4;
locks; strict;
comment	@# @;


1.26
date	2025.06.29.11.27.21;	author rillig;	state Exp;
branches;
next	1.25;
commitid	MRlEV7sRXSprjM0G;

1.25
date	2025.06.29.11.02.18;	author rillig;	state Exp;
branches;
next	1.24;
commitid	FGTolXPDCDz3aM0G;

1.24
date	2025.06.29.10.45.46;	author rillig;	state Exp;
branches;
next	1.23;
commitid	sExislU3VFUk4M0G;

1.23
date	2025.06.28.22.39.29;	author rillig;	state Exp;
branches;
next	1.22;
commitid	CDDpACH2g2jV3I0G;

1.22
date	2025.03.30.09.51.51;	author rillig;	state Exp;
branches;
next	1.21;
commitid	veGmSzVhPiW2G4PF;

1.21
date	2025.03.30.01.27.13;	author rillig;	state Exp;
branches;
next	1.20;
commitid	6EuALUPPSAIsU1PF;

1.20
date	2025.03.29.20.19.58;	author rillig;	state Exp;
branches;
next	1.19;
commitid	Rz0GGlqQtGAKb0PF;

1.19
date	2025.03.29.11.24.34;	author rillig;	state Exp;
branches;
next	1.18;
commitid	wU3uo9bK4hUDfXOF;

1.18
date	2025.01.11.20.54.46;	author rillig;	state Exp;
branches;
next	1.17;
commitid	v92duHXtj62ZR6FF;

1.17
date	2024.08.29.20.20.37;	author rillig;	state Exp;
branches;
next	1.16;
commitid	EaMgk7FrF8mB1LnF;

1.16
date	2024.08.06.18.00.17;	author rillig;	state Exp;
branches;
next	1.15;
commitid	1R0ZDok3menTZMkF;

1.15
date	2024.07.05.19.47.22;	author rillig;	state Exp;
branches;
next	1.14;
commitid	ey8c5i7vJGMuCGgF;

1.14
date	2024.07.04.18.53.37;	author rillig;	state Exp;
branches;
next	1.13;
commitid	7qUZd0dIKoMjlygF;

1.13
date	2024.07.04.17.47.54;	author rillig;	state Exp;
branches;
next	1.12;
commitid	mjDGVMgldk7QYxgF;

1.12
date	2024.06.06.20.41.50;	author rillig;	state Exp;
branches
	1.12.2.1;
next	1.11;
commitid	D11OPGcw2n2QPXcF;

1.11
date	2024.06.02.11.25.03;	author rillig;	state Exp;
branches;
next	1.10;
commitid	iV3kIQHugxV3UocF;

1.10
date	2024.06.01.18.44.05;	author rillig;	state Exp;
branches;
next	1.9;
commitid	qwnhrPOop3gEmjcF;

1.9
date	2024.04.20.10.18.56;	author rillig;	state Exp;
branches;
next	1.8;
commitid	2fCjOO5HMlf2VR6F;

1.8
date	2024.02.03.00.20.23;	author sjg;	state Exp;
branches;
next	1.7;
commitid	wfoEEnEuxTIg5VWE;

1.7
date	2023.06.01.20.56.35;	author rillig;	state Exp;
branches;
next	1.6;
commitid	j3tIvMRlxolKQhrE;

1.6
date	2022.08.24.21.38.06;	author rillig;	state Exp;
branches;
next	1.5;
commitid	rcUgMIfWuC7m7bRD;

1.5
date	2022.08.06.07.06.58;	author rillig;	state Exp;
branches;
next	1.4;
commitid	1Gk03WYhTaNzRMOD;

1.4
date	2020.12.19.22.33.11;	author rillig;	state Exp;
branches;
next	1.3;
commitid	34F1Pdf67eh68pAC;

1.3
date	2020.11.02.17.30.22;	author rillig;	state Exp;
branches;
next	1.2;
commitid	dOg9brWBh5Y4YkuC;

1.2
date	2020.09.13.07.42.20;	author rillig;	state Exp;
branches;
next	1.1;
commitid	MvH19ugzkjBchRnC;

1.1
date	2020.08.16.12.07.51;	author rillig;	state Exp;
branches;
next	;
commitid	coEgPk3hgfeYGhkC;

1.12.2.1
date	2025.08.02.05.58.40;	author perseant;	state Exp;
branches;
next	;
commitid	23j6GFaDws3O875G;


desc
@@


1.26
log
@make: if a condition is erroneous, skip the whole .if/.endif
@
text
@make: varmod.mk:111: To escape a dollar, use \$, not $$, at "$$:L} != """
make: varmod.mk:111: Invalid variable name ":", at "$:L} != """
make: varmod.mk:117: Dollar followed by nothing
	while evaluating "${:Uword:@@word@@${word}$@@} != "word"" with value "word"
make: varmod.mk:125: Missing delimiter ":" after modifier "P"
	while evaluating variable "VAR" with value "VAR"
make: varmod.mk:134: Invalid modifier ":[99333000222000111000]"
	while evaluating variable "word" with value "word"
make: varmod.mk:137: Invalid modifier ":[2147483648]"
	while evaluating variable "word" with value "word"
make: varmod.mk:143: Invalid number "99333000222000111000}" for modifier ":range"
	while evaluating variable "word" with value "word"
make: varmod.mk:150: Invalid time value "\"
	while evaluating indirect modifiers "gmtime=\"
	while evaluating "${:${:Ugmtime=\\}}" with value ""
make: varmod.mk:165: Dollar followed by nothing
	while evaluating variable "VAR" with value "value$"
make: varmod.mk:171: Dollar followed by nothing
	while evaluating variable "VAR" with value "value$"
make: varmod.mk:171: Dollar followed by nothing
	while evaluating variable "VAR" with value "value$ appended$"
make: varmod.mk:181: Dollar followed by nothing
	while evaluating variable "word" with value "word"
make: varmod.mk:185: Invalid modifier ":[$]"
	while evaluating variable "word" with value ""
make: varmod.mk:202: Dollar followed by nothing
	while evaluating variable "VAR" with value "value$ appended$"
make: varmod.mk:202: Invalid variable name "}", at "$} != "set""
	while evaluating variable "VAR" with value "value<space>appended"
make: varmod.mk:206: Invalid variable name "}", at "$} != "fallback""
	while evaluating "${:Ufallback$} != "fallback"" with value ""
make: varmod.mk:210: Invalid time value "1000$"
	while evaluating variable "%y" with value "%y"
make: varmod.mk:216: Invalid time value "1000$"
	while evaluating variable "%y" with value "%y"
make: varmod.mk:222: Dollar followed by nothing
	while evaluating variable "word" with value "word"
make: varmod.mk:226: Dollar followed by nothing
	while evaluating variable "word" with value "word"
make: varmod.mk:230: Invalid argument "fallback$" for modifier ":mtime"
	while evaluating variable "." with value "."
make: varmod.mk:244: Missing delimiter ":" after modifier "L"
	while evaluating variable "VAR" with value "VAR"
make: varmod.mk:256: Invalid time value " : } \ $ ) \) ( "
	while evaluating variable "%Y" with value "%Y"
make: varmod.mk:263: Invalid time value " : \) \ $ "
	while evaluating variable "%Y" with value "%Y"
make: varmod.mk:268: Invalid time value " : } \ $ ) \) ( "
	while evaluating variable "%Y" with value "%Y"
make: varmod.mk:273: Invalid time value " : \) \ $ "
	while evaluating variable "%Y" with value "%Y"
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
@


1.25
log
@make: fix parsing of modifier parts for :gmtime and :localtime

There's no practical use for escaping the ":" or "}" in these two
modifiers, but the same scheme may prove useful for the :M and :N
modifiers, which are currently parsed in a completely different manner,
thus adding needless complexity.

Parsing of the :M and :N modifiers is discussed in PR bin/46139.
@
text
@d5 1
a5 1
make: varmod.mk:127: Missing delimiter ":" after modifier "P"
d7 1
a7 2
make: varmod.mk:129: Missing argument for ".error"
make: varmod.mk:135: Invalid modifier ":[99333000222000111000]"
d9 1
a9 1
make: varmod.mk:138: Invalid modifier ":[2147483648]"
d11 1
a11 1
make: varmod.mk:144: Invalid number "99333000222000111000}" for modifier ":range"
d13 1
a13 1
make: varmod.mk:151: Invalid time value "\"
d16 1
a16 1
make: varmod.mk:166: Dollar followed by nothing
d18 1
a18 1
make: varmod.mk:172: Dollar followed by nothing
d20 1
a20 1
make: varmod.mk:172: Dollar followed by nothing
d22 1
a22 1
make: varmod.mk:182: Dollar followed by nothing
d24 1
a24 1
make: varmod.mk:186: Invalid modifier ":[$]"
d26 1
a26 1
make: varmod.mk:203: Dollar followed by nothing
d28 1
a28 1
make: varmod.mk:203: Invalid variable name "}", at "$} != "set""
d30 1
a30 1
make: varmod.mk:207: Invalid variable name "}", at "$} != "fallback""
d32 1
a32 1
make: varmod.mk:211: Invalid time value "1000$"
d34 1
a34 1
make: varmod.mk:217: Invalid time value "1000$"
d36 1
a36 1
make: varmod.mk:223: Dollar followed by nothing
d38 1
a38 1
make: varmod.mk:227: Dollar followed by nothing
d40 1
a40 1
make: varmod.mk:231: Invalid argument "fallback$" for modifier ":mtime"
d42 1
a42 1
make: varmod.mk:245: Missing delimiter ":" after modifier "L"
d44 1
a44 1
make: varmod.mk:257: Invalid time value " : } \ $ ) \) ( "
d46 1
a46 1
make: varmod.mk:264: Invalid time value " : \) \ $ "
d48 1
a48 1
make: varmod.mk:269: Invalid time value " : } \ $ ) \) ( "
d50 1
a50 1
make: varmod.mk:274: Invalid time value " : \) \ $ "
@


1.24
log
@tests/make: demonstrate bug in parsing :gmtime and :localtime

When the parsing of modifiers was unified a bit in May 2024, the :gmtime
and :localtime modifiers were the only ones that had two different
delimiters. Of these delimiters, only the second one can be escaped, but
the intention was that both of them can be escaped.

Since it doesn't make sense to have either ":" or "}" or ")" in a
second-based timestamp, this bug has survived more than a year.
@
text
@d45 7
a51 1
make: varmod.mk:255: Invalid time value "\"
@


1.23
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
@d45 2
@


1.22
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
@d2 1
a2 1
make: varmod.mk:111: Invalid variable name ':', at "$:L} != """
d5 1
a5 1
make: varmod.mk:127: Missing delimiter ':' after modifier "P"
d12 1
a12 1
make: varmod.mk:144: Invalid number "99333000222000111000}" for ':range' modifier
d29 1
a29 1
make: varmod.mk:203: Invalid variable name '}', at "$} != "set""
d31 1
a31 1
make: varmod.mk:207: Invalid variable name '}', at "$} != "fallback""
d41 1
a41 1
make: varmod.mk:231: Invalid argument 'fallback$' for modifier ':mtime'
d43 1
a43 1
make: varmod.mk:245: Missing delimiter ':' after modifier "L"
@


1.21
log
@make: fix error message for invalid ":[...]" modifier

The unparsed value of the modifier argument can already be seen in the
stack trace, but the modifier argument may contain expressions and the
expanded value of these expressions was hidden up to now. See the EMPTY
test at the bottom of varmod-select-words.mk for details.
@
text
@d1 3
a3 3
make: "varmod.mk" line 111: To escape a dollar, use \$, not $$, at "$$:L} != """
make: "varmod.mk" line 111: Invalid variable name ':', at "$:L} != """
make: "varmod.mk" line 117: Dollar followed by nothing
d5 1
a5 1
make: "varmod.mk" line 127: Missing delimiter ':' after modifier "P"
d7 2
a8 2
make: "varmod.mk" line 129: Missing argument for ".error"
make: "varmod.mk" line 135: Invalid modifier ":[99333000222000111000]"
d10 1
a10 1
make: "varmod.mk" line 138: Invalid modifier ":[2147483648]"
d12 1
a12 1
make: "varmod.mk" line 144: Invalid number "99333000222000111000}" for ':range' modifier
d14 1
a14 1
make: "varmod.mk" line 151: Invalid time value "\"
d17 1
a17 1
make: "varmod.mk" line 166: Dollar followed by nothing
d19 1
a19 1
make: "varmod.mk" line 172: Dollar followed by nothing
d21 1
a21 1
make: "varmod.mk" line 172: Dollar followed by nothing
d23 1
a23 1
make: "varmod.mk" line 182: Dollar followed by nothing
d25 1
a25 1
make: "varmod.mk" line 186: Invalid modifier ":[$]"
d27 1
a27 1
make: "varmod.mk" line 203: Dollar followed by nothing
d29 1
a29 1
make: "varmod.mk" line 203: Invalid variable name '}', at "$} != "set""
d31 1
a31 1
make: "varmod.mk" line 207: Invalid variable name '}', at "$} != "fallback""
d33 1
a33 1
make: "varmod.mk" line 211: Invalid time value "1000$"
d35 1
a35 1
make: "varmod.mk" line 217: Invalid time value "1000$"
d37 1
a37 1
make: "varmod.mk" line 223: Dollar followed by nothing
d39 1
a39 1
make: "varmod.mk" line 227: Dollar followed by nothing
d41 1
a41 1
make: "varmod.mk" line 231: Invalid argument 'fallback$' for modifier ':mtime'
d43 1
a43 1
make: "varmod.mk" line 245: Missing delimiter ':' after modifier "L"
@


1.20
log
@tests/make: fix the documented modifier table

The SysV column was largely incorrect or too unspecific, stating N/A
when "no" was actually correct.

The modifiers differ in whether they fall back to the ":from=to"
modifier. The suggestion in https://bugs.freebsd.org/285726 to make more
of the modifiers fall back to the ":from=to" modifier thus becomes
nonobvious to decide.
@
text
@d8 1
a8 1
make: "varmod.mk" line 135: Bad modifier ":[99333000222000111000]"
d10 1
a10 1
make: "varmod.mk" line 138: Bad modifier ":[2147483648]"
d25 1
a25 1
make: "varmod.mk" line 186: Bad modifier ":[$]"
@


1.19
log
@make: add details about indirect modifiers to the stack traces

Previously, the error message "Unfinished modifier (',' missing)" from
moderrs.mk didn't provide enough context to understand where and why the
comma was missing.
@
text
@d1 3
a3 3
make: "varmod.mk" line 101: To escape a dollar, use \$, not $$, at "$$:L} != """
make: "varmod.mk" line 101: Invalid variable name ':', at "$:L} != """
make: "varmod.mk" line 107: Dollar followed by nothing
d5 1
a5 1
make: "varmod.mk" line 117: Missing delimiter ':' after modifier "P"
d7 2
a8 2
make: "varmod.mk" line 119: Missing argument for ".error"
make: "varmod.mk" line 125: Bad modifier ":[99333000222000111000]"
d10 1
a10 1
make: "varmod.mk" line 128: Bad modifier ":[2147483648]"
d12 1
a12 1
make: "varmod.mk" line 134: Invalid number "99333000222000111000}" for ':range' modifier
d14 1
a14 1
make: "varmod.mk" line 141: Invalid time value "\"
d17 1
a17 1
make: "varmod.mk" line 156: Dollar followed by nothing
d19 1
a19 1
make: "varmod.mk" line 162: Dollar followed by nothing
d21 1
a21 1
make: "varmod.mk" line 162: Dollar followed by nothing
d23 1
a23 1
make: "varmod.mk" line 172: Dollar followed by nothing
d25 1
a25 1
make: "varmod.mk" line 176: Bad modifier ":[$]"
d27 1
a27 1
make: "varmod.mk" line 193: Dollar followed by nothing
d29 1
a29 1
make: "varmod.mk" line 193: Invalid variable name '}', at "$} != "set""
d31 1
a31 1
make: "varmod.mk" line 197: Invalid variable name '}', at "$} != "fallback""
d33 1
a33 1
make: "varmod.mk" line 201: Invalid time value "1000$"
d35 1
a35 1
make: "varmod.mk" line 207: Invalid time value "1000$"
d37 1
a37 1
make: "varmod.mk" line 213: Dollar followed by nothing
d39 1
a39 1
make: "varmod.mk" line 217: Dollar followed by nothing
d41 1
a41 1
make: "varmod.mk" line 221: Invalid argument 'fallback$' for modifier ':mtime'
d43 2
@


1.18
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
@d15 1
@


1.17
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
@d8 1
a8 1
make: "varmod.mk" line 126: Bad modifier ":[99333000222000111000]"
d10 1
a10 2
make: "varmod.mk" line 126: Malformed conditional '${word:L:[99333000222000111000]}'
make: "varmod.mk" line 130: Bad modifier ":[2147483648]"
d12 1
a12 2
make: "varmod.mk" line 130: Malformed conditional '${word:L:[2147483648]}'
make: "varmod.mk" line 137: Invalid number "99333000222000111000}" for ':range' modifier
d14 1
a14 2
make: "varmod.mk" line 137: Malformed conditional '${word:L:range=99333000222000111000}'
make: "varmod.mk" line 145: Invalid time value "\"
d16 1
a16 2
make: "varmod.mk" line 145: Malformed conditional '${:${:Ugmtime=\\}}'
make: "varmod.mk" line 160: Dollar followed by nothing
d18 1
a18 1
make: "varmod.mk" line 166: Dollar followed by nothing
d20 1
a20 1
make: "varmod.mk" line 166: Dollar followed by nothing
d22 1
a22 1
make: "varmod.mk" line 176: Dollar followed by nothing
d24 1
a24 1
make: "varmod.mk" line 181: Bad modifier ":[$]"
d26 1
a26 2
make: "varmod.mk" line 181: Malformed conditional '${word:[$]}'
make: "varmod.mk" line 198: Dollar followed by nothing
d28 1
a28 1
make: "varmod.mk" line 198: Invalid variable name '}', at "$} != "set""
d30 1
a30 1
make: "varmod.mk" line 202: Invalid variable name '}', at "$} != "fallback""
d32 2
d36 1
a36 5
make: "varmod.mk" line 207: Malformed conditional '${%y:L:gmtime=1000$}'
make: "varmod.mk" line 214: Invalid time value "1000$"
	while evaluating variable "%y" with value "%y"
make: "varmod.mk" line 214: Malformed conditional '${%y:L:localtime=1000$}'
make: "varmod.mk" line 220: Dollar followed by nothing
d38 1
a38 1
make: "varmod.mk" line 224: Dollar followed by nothing
d40 1
a40 1
make: "varmod.mk" line 229: Invalid argument 'fallback$' for modifier ':mtime'
a41 1
make: "varmod.mk" line 229: Malformed conditional '${.:L:mtime=fallback$}'
@


1.16
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
@d3 4
a6 2
make: "varmod.mk" line 107: while evaluating "${:Uword:@@word@@${word}$@@} != "word"" with value "word": Dollar followed by nothing
make: "varmod.mk" line 117: while evaluating variable "VAR" with value "VAR": Missing delimiter ':' after modifier "P"
d8 2
a9 1
make: "varmod.mk" line 126: while evaluating variable "word" with value "word": Bad modifier ":[99333000222000111000]"
d11 2
a12 1
make: "varmod.mk" line 130: while evaluating variable "word" with value "word": Bad modifier ":[2147483648]"
d14 2
a15 1
make: "varmod.mk" line 137: while evaluating variable "word" with value "word": Invalid number "99333000222000111000}" for ':range' modifier
d17 2
a18 1
make: "varmod.mk" line 145: while evaluating "${:${:Ugmtime=\\}}" with value "": Invalid time value "\"
d20 10
a29 5
make: "varmod.mk" line 160: while evaluating variable "VAR" with value "value$": Dollar followed by nothing
make: "varmod.mk" line 166: while evaluating variable "VAR" with value "value$": Dollar followed by nothing
make: "varmod.mk" line 166: while evaluating variable "VAR" with value "value$ appended$": Dollar followed by nothing
make: "varmod.mk" line 176: while evaluating variable "word" with value "word": Dollar followed by nothing
make: "varmod.mk" line 181: while evaluating variable "word" with value "": Bad modifier ":[$]"
d31 8
a38 4
make: "varmod.mk" line 198: while evaluating variable "VAR" with value "value$ appended$": Dollar followed by nothing
make: "varmod.mk" line 198: while evaluating variable "VAR" with value "value<space>appended": Invalid variable name '}', at "$} != "set""
make: "varmod.mk" line 202: while evaluating "${:Ufallback$} != "fallback"" with value "": Invalid variable name '}', at "$} != "fallback""
make: "varmod.mk" line 207: while evaluating variable "%y" with value "%y": Invalid time value "1000$"
d40 2
a41 1
make: "varmod.mk" line 214: while evaluating variable "%y" with value "%y": Invalid time value "1000$"
d43 6
a48 3
make: "varmod.mk" line 220: while evaluating variable "word" with value "word": Dollar followed by nothing
make: "varmod.mk" line 224: while evaluating variable "word" with value "word": Dollar followed by nothing
make: "varmod.mk" line 229: while evaluating variable "." with value ".": Invalid argument 'fallback$' for modifier ':mtime'
@


1.15
log
@make: in error messages for anonymous variables, log the value
@
text
@d7 1
a7 1
make: "varmod.mk" line 126: Malformed conditional (${word:L:[99333000222000111000]})
d9 1
a9 1
make: "varmod.mk" line 130: Malformed conditional (${word:L:[2147483648]})
d11 1
a11 1
make: "varmod.mk" line 137: Malformed conditional (${word:L:range=99333000222000111000})
d13 1
a13 1
make: "varmod.mk" line 145: Malformed conditional (${:${:Ugmtime=\\}})
d19 1
a19 1
make: "varmod.mk" line 181: Malformed conditional (${word:[$]})
d24 1
a24 1
make: "varmod.mk" line 207: Malformed conditional (${%y:L:gmtime=1000$})
d26 1
a26 1
make: "varmod.mk" line 214: Malformed conditional (${%y:L:localtime=1000$})
d30 1
a30 1
make: "varmod.mk" line 229: Malformed conditional (${.:L:mtime=fallback$})
@


1.14
log
@make: error out on the "Bad modifier" error message

Previously, the "Bad modifier" error message did not affect make's exit
status.  As a side effect, this kind of error now gets more context
information.
@
text
@d3 1
a3 1
make: "varmod.mk" line 107: while evaluating "${:Uword:@@word@@${word}$@@} != "word"": Dollar followed by nothing
d12 1
a12 1
make: "varmod.mk" line 145: while evaluating "${:${:Ugmtime=\\}}": Invalid time value "\"
d22 1
a22 1
make: "varmod.mk" line 202: while evaluating "${:Ufallback$} != "fallback"": Invalid variable name '}', at "$} != "fallback""
@


1.13
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 25
a30 25
make: Bad modifier ":[99333000222000111000]" for variable "word"
make: "varmod.mk" line 125: Malformed conditional (${word:L:[99333000222000111000]})
make: Bad modifier ":[2147483648]" for variable "word"
make: "varmod.mk" line 128: Malformed conditional (${word:L:[2147483648]})
make: "varmod.mk" line 135: while evaluating variable "word" with value "word": Invalid number "99333000222000111000}" for ':range' modifier
make: "varmod.mk" line 135: Malformed conditional (${word:L:range=99333000222000111000})
make: "varmod.mk" line 143: while evaluating "${:${:Ugmtime=\\}}": Invalid time value "\"
make: "varmod.mk" line 143: Malformed conditional (${:${:Ugmtime=\\}})
make: "varmod.mk" line 158: while evaluating variable "VAR" with value "value$": Dollar followed by nothing
make: "varmod.mk" line 164: while evaluating variable "VAR" with value "value$": Dollar followed by nothing
make: "varmod.mk" line 164: while evaluating variable "VAR" with value "value$ appended$": Dollar followed by nothing
make: "varmod.mk" line 174: while evaluating variable "word" with value "word": Dollar followed by nothing
make: Bad modifier ":[$]" for variable "word"
make: "varmod.mk" line 179: Malformed conditional (${word:[$]})
make: "varmod.mk" line 196: while evaluating variable "VAR" with value "value$ appended$": Dollar followed by nothing
make: "varmod.mk" line 196: while evaluating variable "VAR" with value "value<space>appended": Invalid variable name '}', at "$} != "set""
make: "varmod.mk" line 200: while evaluating "${:Ufallback$} != "fallback"": Invalid variable name '}', at "$} != "fallback""
make: "varmod.mk" line 205: while evaluating variable "%y" with value "%y": Invalid time value "1000$"
make: "varmod.mk" line 205: Malformed conditional (${%y:L:gmtime=1000$})
make: "varmod.mk" line 212: while evaluating variable "%y" with value "%y": Invalid time value "1000$"
make: "varmod.mk" line 212: Malformed conditional (${%y:L:localtime=1000$})
make: "varmod.mk" line 218: while evaluating variable "word" with value "word": Dollar followed by nothing
make: "varmod.mk" line 222: while evaluating variable "word" with value "word": Dollar followed by nothing
make: "varmod.mk" line 227: while evaluating variable "." with value ".": Invalid argument 'fallback$' for modifier ':mtime'
make: "varmod.mk" line 227: Malformed conditional (${.:L:mtime=fallback$})
@


1.12
log
@tests/make: test unescaped '$' at the end of a modifier part

In ParseModifierPart, an unescaped '$' that occurs right before a
delimiter is handled differently from a '$' that occurs in the middle of
the modifier part.

In practice, this edge case is only used by the first part of the
':C,from,to,' modifier.  Using it in most other modifier parts produces
an error message.
@
text
@d4 1
a4 1
make: "varmod.mk" line 117: while evaluating variable "VAR": Missing delimiter ':' after modifier "P"
d10 1
a10 1
make: "varmod.mk" line 135: while evaluating variable "word": Invalid number "99333000222000111000}" for ':range' modifier
d14 4
a17 4
make: "varmod.mk" line 158: while evaluating variable "VAR": Dollar followed by nothing
make: "varmod.mk" line 164: while evaluating variable "VAR": Dollar followed by nothing
make: "varmod.mk" line 164: while evaluating variable "VAR": Dollar followed by nothing
make: "varmod.mk" line 174: while evaluating variable "word": Dollar followed by nothing
d20 2
a21 2
make: "varmod.mk" line 196: while evaluating variable "VAR": Dollar followed by nothing
make: "varmod.mk" line 196: while evaluating variable "VAR": Invalid variable name '}', at "$} != "set""
d23 1
a23 1
make: "varmod.mk" line 205: while evaluating variable "%y": Invalid time value "1000$"
d25 1
a25 1
make: "varmod.mk" line 212: while evaluating variable "%y": Invalid time value "1000$"
d27 3
a29 3
make: "varmod.mk" line 218: while evaluating variable "word": Dollar followed by nothing
make: "varmod.mk" line 222: while evaluating variable "word": Dollar followed by nothing
make: "varmod.mk" line 227: while evaluating variable ".": Invalid argument 'fallback$' for modifier ':mtime'
@


1.12.2.1
log
@Sync with HEAD
@
text
@d1 30
a30 51
make: varmod.mk:111: To escape a dollar, use \$, not $$, at "$$:L} != """
make: varmod.mk:111: Invalid variable name ":", at "$:L} != """
make: varmod.mk:117: Dollar followed by nothing
	while evaluating "${:Uword:@@word@@${word}$@@} != "word"" with value "word"
make: varmod.mk:125: Missing delimiter ":" after modifier "P"
	while evaluating variable "VAR" with value "VAR"
make: varmod.mk:134: Invalid modifier ":[99333000222000111000]"
	while evaluating variable "word" with value "word"
make: varmod.mk:137: Invalid modifier ":[2147483648]"
	while evaluating variable "word" with value "word"
make: varmod.mk:143: Invalid number "99333000222000111000}" for modifier ":range"
	while evaluating variable "word" with value "word"
make: varmod.mk:150: Invalid time value "\"
	while evaluating indirect modifiers "gmtime=\"
	while evaluating "${:${:Ugmtime=\\}}" with value ""
make: varmod.mk:165: Dollar followed by nothing
	while evaluating variable "VAR" with value "value$"
make: varmod.mk:171: Dollar followed by nothing
	while evaluating variable "VAR" with value "value$"
make: varmod.mk:171: Dollar followed by nothing
	while evaluating variable "VAR" with value "value$ appended$"
make: varmod.mk:181: Dollar followed by nothing
	while evaluating variable "word" with value "word"
make: varmod.mk:185: Invalid modifier ":[$]"
	while evaluating variable "word" with value ""
make: varmod.mk:202: Dollar followed by nothing
	while evaluating variable "VAR" with value "value$ appended$"
make: varmod.mk:202: Invalid variable name "}", at "$} != "set""
	while evaluating variable "VAR" with value "value<space>appended"
make: varmod.mk:206: Invalid variable name "}", at "$} != "fallback""
	while evaluating "${:Ufallback$} != "fallback"" with value ""
make: varmod.mk:210: Invalid time value "1000$"
	while evaluating variable "%y" with value "%y"
make: varmod.mk:216: Invalid time value "1000$"
	while evaluating variable "%y" with value "%y"
make: varmod.mk:222: Dollar followed by nothing
	while evaluating variable "word" with value "word"
make: varmod.mk:226: Dollar followed by nothing
	while evaluating variable "word" with value "word"
make: varmod.mk:230: Invalid argument "fallback$" for modifier ":mtime"
	while evaluating variable "." with value "."
make: varmod.mk:244: Missing delimiter ":" after modifier "L"
	while evaluating variable "VAR" with value "VAR"
make: varmod.mk:256: Invalid time value " : } \ $ ) \) ( "
	while evaluating variable "%Y" with value "%Y"
make: varmod.mk:263: Invalid time value " : \) \ $ "
	while evaluating variable "%Y" with value "%Y"
make: varmod.mk:268: Invalid time value " : } \ $ ) \) ( "
	while evaluating variable "%Y" with value "%Y"
make: varmod.mk:273: Invalid time value " : \) \ $ "
	while evaluating variable "%Y" with value "%Y"
@


1.11
log
@make: fix out-of-bounds read when parsing indirect modifiers
@
text
@d14 17
@


1.10
log
@tests/make: test more modifiers and special variables
@
text
@d12 2
@


1.9
log
@make: provide more context information for parse/evaluate errors
@
text
@d6 6
@


1.8
log
@make: state of save_dollars affects what is a parse error

When save_dollars is false it is not a parse error to
encounter $$ rather than \$.
@
text
@d3 2
a4 2
make: "varmod.mk" line 107: Dollar followed by nothing
make: "varmod.mk" line 117: Missing delimiter ':' after modifier "P"
@


1.7
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 5
a5 5
make: "varmod.mk" line 98: To escape a dollar, use \$, not $$, at "$$:L} != """
make: "varmod.mk" line 98: Invalid variable name ':', at "$:L} != """
make: "varmod.mk" line 104: Dollar followed by nothing
make: "varmod.mk" line 114: Missing delimiter ':' after modifier "P"
make: "varmod.mk" line 116: Missing argument for ".error"
@


1.6
log
@tests/make: test misleading error messages on unclosed expressions

The error messages say 'Unknown modifier' or 'Bad modifier', which is
not entirely correct.  The modifier in itself is valid, it's just that
make doesn't expect the end of the string after the modifier.
@
text
@d1 5
a5 5
make: "varmod.mk" line 96: To escape a dollar, use \$, not $$, at "$$:L} != """
make: "varmod.mk" line 96: Invalid variable name ':', at "$:L} != """
make: "varmod.mk" line 101: Dollar followed by nothing
make: "varmod.mk" line 110: Missing delimiter ':' after modifier "P"
make: "varmod.mk" line 111: Missing argument for ".error"
@


1.5
log
@tests/make: document parsing behavior of modifiers

The table was created by manually inspecting the code of the various
ApplyModifier functions in var.c.

The modifiers are listed in alphabetical order, except for the SysV
modifier, which is listed at the end since it is used as a fallback
modifier for many other modifiers and because it does not have a fixed
prefix.
@
text
@d1 5
a5 5
make: "varmod.mk" line 93: To escape a dollar, use \$, not $$, at "$$:L} != """
make: "varmod.mk" line 93: Invalid variable name ':', at "$:L} != """
make: "varmod.mk" line 98: Dollar followed by nothing
make: "varmod.mk" line 107: Missing delimiter ':' after modifier "P"
make: "varmod.mk" line 108: Missing argument for ".error"
@


1.4
log
@make(1): fix error message for .info/.warning/.error without argument

Previously, the error message was "Unknown directive", which was
obviously wrong.  The new error message is "Missing argument".
@
text
@d1 5
a5 5
make: "varmod.mk" line 42: To escape a dollar, use \$, not $$, at "$$:L} != """
make: "varmod.mk" line 42: Invalid variable name ':', at "$:L} != """
make: "varmod.mk" line 47: Dollar followed by nothing
make: "varmod.mk" line 56: Missing delimiter ':' after modifier "P"
make: "varmod.mk" line 57: Missing argument for ".error"
@


1.3
log
@make(1): add test for the :P modifier, which does not fall back
@
text
@d5 1
a5 1
make: "varmod.mk" line 57: Unknown directive "error"
@


1.2
log
@make(1): in lint mode, complain about erroneous $$

Since 2008-12-21, make has silently ignored strange variable names in
constructs like '$$', '$}', '$' followed by nothing.  Ignoring these
bugs in makefiles instead of reporting them is not a good idea.

To improve the situation, make complains about these errors now, but
only in lint mode (-dL).  This preserves existing behavior while still
allowing to validate existing makefiles that they don't depend on this
bug.

If the test phase goes well, these error messages may be enabled
unconditionally.

https://mail-index.netbsd.org/pkgsrc-users/2020/09/12/msg032229.html
@
text
@d4 2
@


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 6
a6 1
exit status 0
@

