Lines Matching +full:line +full:- +full:name

1 # $NetBSD: directive-include-guard.mk,v 1.16 2023/12/17 14:07:22 rillig Exp $
3 # Tests for multiple-inclusion guards in makefiles.
5 # A file that is guarded by a multiple-inclusion guard has one of the
14 # .if !target(guard-target)
23 # https://gcc.gnu.org/onlinedocs/cppinternals/Guard-Macros.html
30 # This is the canonical form of a variable-based multiple-inclusion guard.
31 CASES+= variable-ifndef
32 LINES.variable-ifndef= \
36 # expect: Parse_PushInput: file variable-ifndef.tmp, line 1
37 # expect: Skipping 'variable-ifndef.tmp' because 'VARIABLE_IFNDEF' is defined
42 CASES+= variable-ifndef-reuse
43 LINES.variable-ifndef-reuse= \
47 # expect: Parse_PushInput: file variable-ifndef-reuse.tmp, line 1
48 # expect: Skipping 'variable-ifndef-reuse.tmp' because 'VARIABLE_IFNDEF' is defined
52 CASES+= variable-ifndef-zero
53 LINES.variable-ifndef-zero= \
57 # expect: Parse_PushInput: file variable-ifndef-zero.tmp, line 1
58 # expect: Parse_PushInput: file variable-ifndef-zero.tmp, line 1
62 CASES+= variable-ifndef-one
63 LINES.variable-ifndef-one= \
66 # expect: Parse_PushInput: file variable-ifndef-one.tmp, line 1
67 # expect: Parse_PushInput: file variable-ifndef-one.tmp, line 1
69 # Comments and empty lines do not affect the multiple-inclusion guard.
79 # expect: Parse_PushInput: file comments.tmp, line 1
85 CASES+= variable-if
86 LINES.variable-if= \
90 # expect: Parse_PushInput: file variable-if.tmp, line 1
91 # expect: Skipping 'variable-if.tmp' because 'VARIABLE_IF' is defined
96 CASES+= variable-if-reuse
97 LINES.variable-if-reuse= \
101 # expect: Parse_PushInput: file variable-if-reuse.tmp, line 1
102 # expect: Skipping 'variable-if-reuse.tmp' because 'VARIABLE_IF' is defined
106 CASES+= variable-if-triple-negation
107 LINES.variable-if-triple-negation= \
111 # expect: Parse_PushInput: file variable-if-triple-negation.tmp, line 1
112 # expect: Parse_PushInput: file variable-if-triple-negation.tmp, line 1
116 CASES+= variable-if-spaced
117 LINES.variable-if-spaced= \
121 # expect: Parse_PushInput: file variable-if-spaced.tmp, line 1
122 # expect: Parse_PushInput: file variable-if-spaced.tmp, line 1
126 CASES+= variable-if-parenthesized
127 LINES.variable-if-parenthesized= \
131 # expect: Parse_PushInput: file variable-if-parenthesized.tmp, line 1
132 # expect: Parse_PushInput: file variable-if-parenthesized.tmp, line 1
136 CASES+= variable-ifdef-negated
137 LINES.variable-ifdef-negated= \
141 # expect: Parse_PushInput: file variable-ifdef-negated.tmp, line 1
142 # expect: Parse_PushInput: file variable-ifdef-negated.tmp, line 1
145 CASES+= variable-name-mismatch
146 LINES.variable-name-mismatch= \
150 # expect: Parse_PushInput: file variable-name-mismatch.tmp, line 1
151 # expect: Parse_PushInput: file variable-name-mismatch.tmp, line 1
155 CASES+= variable-ifndef-parenthesized
156 LINES.variable-ifndef-parenthesized= \
160 # expect: Parse_PushInput: file variable-ifndef-parenthesized.tmp, line 1
161 # expect: Parse_PushInput: file variable-ifndef-parenthesized.tmp, line 1
163 # The variable name '!VARNAME' cannot be used in an '.ifndef' directive, as
166 # accept '!' in the guard variable name. Furthermore, when defining the
169 CASES+= variable-name-exclamation
170 LINES.variable-name-exclamation= \
174 # expect: Parse_PushInput: file variable-name-exclamation.tmp, line 1
175 # expect: Parse_PushInput: file variable-name-exclamation.tmp, line 1
177 # In general, a variable name can contain a '!' in the middle, as that
181 CASES+= variable-name-exclamation-middle
182 LINES.variable-name-exclamation-middle= \
186 # expect: Parse_PushInput: file variable-name-exclamation-middle.tmp, line 1
187 # expect: Parse_PushInput: file variable-name-exclamation-middle.tmp, line 1
189 # A variable name can contain balanced parentheses, at least in conditions and
194 CASES+= variable-name-parentheses
195 LINES.variable-name-parentheses= \
199 # expect: Parse_PushInput: file variable-name-parentheses.tmp, line 1
200 # expect: Parse_PushInput: file variable-name-parentheses.tmp, line 1
203 CASES+= variable-ifndef-plus
204 LINES.variable-ifndef-plus= \
209 # expect: Parse_PushInput: file variable-ifndef-plus.tmp, line 1
210 # expect: Parse_PushInput: file variable-ifndef-plus.tmp, line 1
213 CASES+= variable-if-plus
214 LINES.variable-if-plus= \
219 # expect: Parse_PushInput: file variable-if-plus.tmp, line 1
220 # expect: Parse_PushInput: file variable-if-plus.tmp, line 1
222 # The variable name in an '.ifndef' guard must be given directly, it must not
224 CASES+= variable-ifndef-indirect
225 LINES.variable-ifndef-indirect= \
229 # expect: Parse_PushInput: file variable-ifndef-indirect.tmp, line 1
230 # expect: Parse_PushInput: file variable-ifndef-indirect.tmp, line 1
232 # The variable name in an '.if' guard must be given directly, it must not
234 CASES+= variable-if-indirect
235 LINES.variable-if-indirect= \
239 # expect: Parse_PushInput: file variable-if-indirect.tmp, line 1
240 # expect: Parse_PushInput: file variable-if-indirect.tmp, line 1
242 # The variable name in the guard condition must only contain alphanumeric
246 CASES+= variable-assign-indirect
247 LINES.variable-assign-indirect= \
251 # expect: Parse_PushInput: file variable-assign-indirect.tmp, line 1
252 # expect: Skipping 'variable-assign-indirect.tmp' because 'VARIABLE_ASSIGN_INDIRECT' is defined
256 CASES+= variable-assign-late
257 LINES.variable-assign-late= \
262 # expect: Parse_PushInput: file variable-assign-late.tmp, line 1
263 # expect: Skipping 'variable-assign-late.tmp' because 'VARIABLE_ASSIGN_LATE' is defined
267 CASES+= variable-assign-nested
268 LINES.variable-assign-nested= \
276 # expect: Parse_PushInput: file variable-assign-nested.tmp, line 1
277 # expect: Skipping 'variable-assign-nested.tmp' because 'VARIABLE_ASSIGN_NESTED' is defined
282 # top-level '.if/.endif' conditional can be determined reliably enough to
284 CASES+= variable-already-defined
285 LINES.variable-already-defined= \
290 # expect: Parse_PushInput: file variable-already-defined.tmp, line 1
291 # expect: Skipping 'variable-already-defined.tmp' because 'VARIABLE_ALREADY_DEFINED' is defined
297 CASES+= variable-defined-then-undefined
298 LINES.variable-defined-then-undefined= \
302 UNDEF_BETWEEN.variable-defined-then-undefined= \
304 # expect: Parse_PushInput: file variable-defined-then-undefined.tmp, line 1
305 # expect: Parse_PushInput: file variable-defined-then-undefined.tmp, line 1
311 CASES+= variable-two-times
312 LINES.variable-two-times= \
319 # expect: Parse_PushInput: file variable-two-times.tmp, line 1
320 # expect: Parse_PushInput: file variable-two-times.tmp, line 1
322 # When multiple files use the same guard variable name, the optimization of
327 # System-provided files typically start the guard names with '_'.
328 CASES+= variable-clash
329 LINES.variable-clash= \
330 ${LINES.variable-if}
331 # expect: Parse_PushInput: file variable-clash.tmp, line 1
332 # expect: Skipping 'variable-clash.tmp' because 'VARIABLE_IF' is defined
336 CASES+= variable-swapped
337 LINES.variable-swapped= \
342 # expect: Parse_PushInput: file variable-swapped.tmp, line 1
343 # expect: Parse_PushInput: file variable-swapped.tmp, line 1
347 CASES+= variable-undef-between
348 LINES.variable-undef-between= \
352 UNDEF_BETWEEN.variable-undef-between= \
354 # expect: Parse_PushInput: file variable-undef-between.tmp, line 1
355 # expect: Parse_PushInput: file variable-undef-between.tmp, line 1
359 CASES+= variable-undef-inside
360 LINES.variable-undef-inside= \
365 # expect: Parse_PushInput: file variable-undef-inside.tmp, line 1
366 # expect: Parse_PushInput: file variable-undef-inside.tmp, line 1
370 CASES+= variable-not-defined
371 LINES.variable-not-defined= \
374 # expect: Parse_PushInput: file variable-not-defined.tmp, line 1
375 # expect: Parse_PushInput: file variable-not-defined.tmp, line 1
384 # expect: Parse_PushInput: file elif.tmp, line 1
385 # expect: Parse_PushInput: file elif.tmp, line 1
389 CASES+= elif-reuse
390 LINES.elif-reuse= \
395 # expect: Parse_PushInput: file elif-reuse.tmp, line 1
396 # expect: Parse_PushInput: file elif-reuse.tmp, line 1
405 # expect: Parse_PushInput: file else.tmp, line 1
406 # expect: Parse_PushInput: file else.tmp, line 1
410 CASES+= else-reuse
411 LINES.else-reuse= \
416 # expect: Parse_PushInput: file else-reuse.tmp, line 1
417 # expect: Parse_PushInput: file else-reuse.tmp, line 1
421 CASES+= inner-if-elif-else
422 LINES.inner-if-elif-else= \
438 # expect: Parse_PushInput: file inner-if-elif-else.tmp, line 1
439 # expect: Skipping 'inner-if-elif-else.tmp' because 'INNER_IF_ELIF_ELSE' is defined
452 # expect: Parse_PushInput: file target.tmp, line 1
455 # When used for system files, the target name may include '<' and '>', for
458 CASES+= target-sys
459 LINES.target-sys= \
460 '.if !target(__<target-sys.tmp>__)' \
461 '__<target-sys.tmp>__: .NOTMAIN' \
463 # expect: Parse_PushInput: file target-sys.tmp, line 1
464 # expect: Skipping 'target-sys.tmp' because '__<target-sys.tmp>__' is defined
466 # The target name may include variable references. These references are
469 # and once for determining the guard name. This double evaluation should not
472 CASES+= target-indirect
473 LINES.target-indirect= \
474 '.if !target($${target-indirect.tmp:L})' \
475 'target-indirect.tmp: .NOTMAIN' \
477 # expect: Parse_PushInput: file target-indirect.tmp, line 1
478 # expect: Skipping 'target-indirect.tmp' because 'target-indirect.tmp' is defined
485 CASES+= target-indirect-PARSEFILE
486 LINES.target-indirect-PARSEFILE= \
490 # expect: Parse_PushInput: file target-indirect-PARSEFILE.tmp, line 1
491 # expect: Skipping 'target-indirect-PARSEFILE.tmp' because '__target-indirect-PARSEFILE.tmp__' is d…
494 # for the target guard name, as the expressions expand to different strings.
495 CASES+= target-indirect-PARSEFILE2
496 LINES.target-indirect-PARSEFILE2= \
500 # expect: Parse_PushInput: file target-indirect-PARSEFILE2.tmp, line 1
501 # expect: Skipping 'target-indirect-PARSEFILE2.tmp' because '__target-indirect-PARSEFILE2.tmp__' is…
503 # Using plain .PARSEFILE without .PARSEDIR leads to name clashes. The include
504 # guard is the same as in the test case 'target-indirect-PARSEFILE', as the
505 # guard name only contains the basename but not the directory name. So even
507 CASES+= subdir/target-indirect-PARSEFILE
508 LINES.subdir/target-indirect-PARSEFILE= \
511 # expect: Parse_PushInput: file subdir/target-indirect-PARSEFILE.tmp, line 1
512 # expect: Skipping 'subdir/target-indirect-PARSEFILE.tmp' because '__target-indirect-PARSEFILE.tmp_…
516 CASES+= target-indirect-PARSEDIR-PARSEFILE
517 LINES.target-indirect-PARSEDIR-PARSEFILE= \
521 # expect: Parse_PushInput: file target-indirect-PARSEDIR-PARSEFILE.tmp, line 1
522 # expect: Skipping 'target-indirect-PARSEDIR-PARSEFILE.tmp' because '__target-indirect-PARSEDIR-PAR…
527 # subdirectory gets a different guard target name than the previous one.
528 CASES+= subdir/target-indirect-PARSEDIR-PARSEFILE
529 LINES.subdir/target-indirect-PARSEDIR-PARSEFILE= \
533 # expect: Parse_PushInput: file subdir/target-indirect-PARSEDIR-PARSEFILE.tmp, line 1
534 # expect: Skipping 'subdir/target-indirect-PARSEDIR-PARSEFILE.tmp' because '__subdir/target-indirec…
540 CASES+= target-unguarded
541 LINES.target-unguarded= \
542 '.if !target(target-unguarded)' \
544 # expect: Parse_PushInput: file target-unguarded.tmp, line 1
545 # expect: Parse_PushInput: file target-unguarded.tmp, line 1
548 CASES+= target-plus
549 LINES.target-plus= \
550 '.if !target(target-plus) && 1' \
551 'target-plus: .NOTMAIN' \
553 # expect: Parse_PushInput: file target-plus.tmp, line 1
554 # expect: Parse_PushInput: file target-plus.tmp, line 1
558 CASES+= target-already-defined
559 LINES.target-already-defined= \
560 '.if !target(target-already-defined)' \
561 'target-already-defined: .NOTMAIN' \
563 target-already-defined: .NOTMAIN
564 # expect: Parse_PushInput: file target-already-defined.tmp, line 1
565 # expect: Skipping 'target-already-defined.tmp' because 'target-already-defined' is defined
567 # A target name cannot contain the character '!'. In the condition, the '!'
568 # is syntactically valid, but in the dependency declaration line, the '!' is
570 # the beginning or in the middle of a target name. Escaping it as '${:U!}'
571 # doesn't work, as the whole line is first expanded and then scanned for the
574 # the target name, the '\' is kept, resulting in the target name
575 # '\!target-name-exclamation' instead of '!target-name-exclamation'.
576 CASES+= target-name-exclamation
577 LINES.target-name-exclamation= \
578 '.if !target(!target-name-exclamation)' \
579 '\!target-name-exclamation: .NOTMAIN' \
581 # expect: Parse_PushInput: file target-name-exclamation.tmp, line 1
582 # expect: Parse_PushInput: file target-name-exclamation.tmp, line 1
584 # If the guard target name is enclosed in spaces, it does not have an effect,
586 CASES+= target-name-parenthesized
587 LINES.target-name-parenthesized= \
588 '.if !target( target-name-parenthesized )' \
589 'target-name-parenthesized: .NOTMAIN' \
591 # expect: Parse_PushInput: file target-name-parenthesized.tmp, line 1
592 # expect: Parse_PushInput: file target-name-parenthesized.tmp, line 1
596 CASES+= target-call-parenthesized
597 LINES.target-call-parenthesized= \
598 '.if (!target(target-call-parenthesized))' \
599 'target-call-parenthesized: .NOTMAIN' \
601 # expect: Parse_PushInput: file target-call-parenthesized.tmp, line 1
602 # expect: Parse_PushInput: file target-call-parenthesized.tmp, line 1
604 # If the '.if' or '.ifndef' directive spans more than a single line, it is
606 # at the point where the guard condition is checked, line continuations have
615 # expect: Parse_PushInput: file multiline.tmp, line 1
621 # generate a 'Skipping' line, the others repeat the 'Parse_PushInput' line.
626 _:= ${fname:H:N.:@dir@${:!mkdir -p ${dir}!}@}
628 .MAKEFLAGS: -dp
632 .MAKEFLAGS: -d0