xref: /freebsd/contrib/bmake/unit-tests/directive-for-empty.exp (revision 357378bbdedf24ce2b90e9bd831af4a9db3ec70a)
1make: "directive-for-empty.mk" line 22: 2
2For: end for 1
3For: loop body with i = value:
4# The identifier 'empty' can only be used in conditions such as .if, .ifdef or
5# .elif.  In other lines the string 'empty(' must be preserved.
6CPPFLAGS+=	-Dmessage="empty(i)"
7# There may be whitespace between 'empty' and '('.
8.if ! empty (i)
9.  error
10.endif
11# Even in conditions, the string 'empty(' is not always a function call, it
12# can occur in a string literal as well.
13.if "empty\(i)" != "empty(i)"
14.  error
15.endif
16# In comments like 'empty(i)', the text must be preserved as well.
17#
18# Conditions, including function calls to 'empty', can not only occur in
19# condition directives, they can also occur in the modifier ':?', see
20# varmod-ifelse.mk.
21CPPFLAGS+=	-Dmacro="${empty(i):?empty:not-empty}"
22exit status 0
23