2021-01-14 01:24:34 +00:00
|
|
|
# $NetBSD: directive-else.mk,v 1.7 2020/12/14 22:17:11 rillig Exp $
|
2020-09-05 16:11:04 +00:00
|
|
|
#
|
|
|
|
# Tests for the .else directive.
|
2021-01-14 01:24:34 +00:00
|
|
|
#
|
|
|
|
# Since 2020-11-13, an '.else' followed by extraneous text generates a parse
|
|
|
|
# error in -dL (lint) mode.
|
|
|
|
#
|
|
|
|
# Since 2020-12-15, an '.else' followed by extraneous text always generates
|
|
|
|
# a parse error.
|
2020-09-05 16:11:04 +00:00
|
|
|
|
|
|
|
.if 0
|
2020-11-07 19:39:21 +00:00
|
|
|
. warning must not be reached
|
2021-01-14 01:24:34 +00:00
|
|
|
# The .else directive does not take any arguments.
|
2020-09-05 16:11:04 +00:00
|
|
|
.else 123
|
2020-11-07 19:39:21 +00:00
|
|
|
. info ok
|
2020-09-05 16:11:04 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.if 1
|
2020-11-07 19:39:21 +00:00
|
|
|
. info ok
|
2021-01-14 01:24:34 +00:00
|
|
|
# The .else directive does not take any arguments.
|
2020-09-05 16:11:04 +00:00
|
|
|
.else 123
|
2020-11-07 19:39:21 +00:00
|
|
|
. warning must not be reached
|
2020-09-05 16:11:04 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
# An .else without a corresponding .if is an error.
|
|
|
|
.else
|
|
|
|
|
|
|
|
# Accidental extra .else directives are detected too.
|
|
|
|
.if 0
|
2020-11-07 19:39:21 +00:00
|
|
|
. warning must not be reached
|
2020-09-05 16:11:04 +00:00
|
|
|
.else
|
2020-11-07 19:39:21 +00:00
|
|
|
. info ok
|
2020-09-05 16:11:04 +00:00
|
|
|
.else
|
2020-11-07 19:39:21 +00:00
|
|
|
. info After an extra .else, everything is skipped.
|
2020-09-05 16:11:04 +00:00
|
|
|
.endif
|
|
|
|
|
2020-11-20 03:54:37 +00:00
|
|
|
# An .else may have a comment. This comment does not count as an argument,
|
|
|
|
# therefore no parse error.
|
|
|
|
.if 0
|
|
|
|
.else # comment
|
|
|
|
.endif
|
|
|
|
|
|
|
|
# A variable expression does count as an argument, even if it is empty.
|
|
|
|
.if 0
|
|
|
|
.else ${:U}
|
|
|
|
.endif
|
|
|
|
|
2020-09-05 16:11:04 +00:00
|
|
|
all:
|
|
|
|
@:;
|