head	1.5;
access;
symbols
	netbsd-11-0-RC4:1.5
	netbsd-11-0-RC3:1.5
	netbsd-11-0-RC2:1.5
	netbsd-11-0-RC1:1.5
	perseant-exfatfs-base-20250801:1.5
	netbsd-11:1.5.0.2
	netbsd-11-base:1.5
	netbsd-10-1-RELEASE:1.1
	perseant-exfatfs-base-20240630:1.4
	perseant-exfatfs:1.4.0.2
	perseant-exfatfs-base:1.4
	netbsd-10-0-RELEASE:1.1
	netbsd-10-0-RC6:1.1
	netbsd-10-0-RC5:1.1
	netbsd-10-0-RC4:1.1
	netbsd-10-0-RC3:1.1
	netbsd-10-0-RC2:1.1
	netbsd-10-0-RC1:1.1
	netbsd-10:1.1.0.2
	netbsd-10-base:1.1;
locks; strict;
comment	@# @;


1.5
date	2025.03.30.09.51.50;	author rillig;	state Exp;
branches;
next	1.4;
commitid	veGmSzVhPiW2G4PF;

1.4
date	2024.05.31.07.13.12;	author rillig;	state Exp;
branches
	1.4.2.1;
next	1.3;
commitid	9LM9ymCx5IJbz7cF;

1.3
date	2023.06.01.20.56.35;	author rillig;	state Exp;
branches;
next	1.2;
commitid	j3tIvMRlxolKQhrE;

1.2
date	2023.06.01.09.02.14;	author rillig;	state Exp;
branches;
next	1.1;
commitid	uIhOoIyehBKiUdrE;

1.1
date	2022.05.23.22.33.56;	author rillig;	state Exp;
branches;
next	;
commitid	tfWSwqSGxIDroeFD;

1.4.2.1
date	2025.08.02.05.58.33;	author perseant;	state Exp;
branches;
next	;
commitid	23j6GFaDws3O875G;


desc
@@


1.5
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: directive-for-empty.mk:22: 2
For: end for 1
For: loop body with i = value:
# The identifier 'empty' can only be used in conditions such as .if, .ifdef or
# .elif.  In other lines the string 'empty(' must be preserved.
CPPFLAGS+=	-Dmessage="empty(i)"
# There may be whitespace between 'empty' and '('.
.if ! empty (i)
.  error
.endif
# Even in conditions, the string 'empty(' is not always a function call, it
# can occur in a string literal as well.
.if "empty\(i)" != "empty(i)"
.  error
.endif
# In comments like 'empty(i)', the text must be preserved as well.
#
# Conditions, including function calls to 'empty', can not only occur in
# condition directives, they can also occur in the modifier ':?', see
# varmod-ifelse.mk.
CPPFLAGS+=	-Dmacro="${empty(i):?empty:not-empty}"
exit status 0
@


1.4
log
@tests/make: replace or document .error in tests

The text 'Missing argument for ".error"' in an .exp file may be a hint
for an accidentally broken test, so eliminate them as far as possible.
@
text
@d1 1
a1 1
make: "directive-for-empty.mk" line 22: 2
@


1.4.2.1
log
@Sync with HEAD
@
text
@d1 1
a1 1
make: directive-for-empty.mk:22: 2
@


1.3
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
@a1 3
make: "directive-for-empty.mk" line 38: Missing argument for ".error"
make: "directive-for-empty.mk" line 38: Missing argument for ".error"
make: "directive-for-empty.mk" line 38: Missing argument for ".error"
d22 1
a22 3
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
@


1.2
log
@make: add more details to debug logging of .for loops
@
text
@d1 4
a4 4
make: "directive-for-empty.mk" line 21: 2
make: "directive-for-empty.mk" line 34: Missing argument for ".error"
make: "directive-for-empty.mk" line 34: Missing argument for ".error"
make: "directive-for-empty.mk" line 34: Missing argument for ".error"
@


1.1
log
@tests/make: document and demonstrate .for i containing .if empty(i)

PR bin/43821 describes the inconsistency that in a '.for i' loop, the
condition '.if ${i:M*.c}' works since 2009 while the seemingly
equivalent condition '.if !empty(i:M*.c)' does not access the variable
'i' from the .for loop but instead the global 'i'.

Resolving this situation in a backwards-compatible and non-surprising
way is hard, as make has grown several features during the last 20 years
that interact in various edge cases.  For now, document the most obvious
pitfalls.
@
text
@d6 1
a6 1
For: loop body:
@

