cond-token-number.mk (bmake-20201101) | : | cond-token-number.mk (bmake-20201117) | ||
---|---|---|---|---|
# $NetBSD: cond-token-number.mk,v 1.3 2020/09/14 06:22:59 rillig Exp $ | # $NetBSD: cond-token-number.mk,v 1.5 2020/11/15 14:58:14 rillig Exp $ | |||
# | # | |||
# Tests for number tokens in .if conditions. | # Tests for number tokens in .if conditions. | |||
# | ||||
# TODO: Add introduction. | ||||
.if 0 | .if 0 | |||
. error | . error | |||
.endif | .endif | |||
# Even though -0 is a number and would be accepted by strtod, it is not | # Even though -0 is a number and would be accepted by strtod, it is not | |||
# accepted by the condition parser. | # accepted by the condition parser. | |||
# | # | |||
# See the ch_isdigit call in CondParser_String. | # See the ch_isdigit call in CondParser_String. | |||
.if -0 | .if -0 | |||
. error | . error | |||
.else | ||||
. error | ||||
.endif | .endif | |||
# Even though +0 is a number and would be accepted by strtod, it is not | # Even though +0 is a number and would be accepted by strtod, it is not | |||
# accepted by the condition parser. | # accepted by the condition parser. | |||
# | # | |||
# See the ch_isdigit call in CondParser_String. | # See the ch_isdigit call in CondParser_String. | |||
.if +0 | .if +0 | |||
. error | . error | |||
.else | ||||
. error | ||||
.endif | .endif | |||
# Even though -1 is a number and would be accepted by strtod, it is not | # Even though -1 is a number and would be accepted by strtod, it is not | |||
# accepted by the condition parser. | # accepted by the condition parser. | |||
# | # | |||
# See the ch_isdigit call in CondParser_String. | # See the ch_isdigit call in CondParser_String. | |||
.if !-1 | .if !-1 | |||
. error | . error | |||
.else | ||||
. error | ||||
.endif | .endif | |||
# Even though +1 is a number and would be accepted by strtod, it is not | # Even though +1 is a number and would be accepted by strtod, it is not | |||
# accepted by the condition parser. | # accepted by the condition parser. | |||
# | # | |||
# See the ch_isdigit call in CondParser_String. | # See the ch_isdigit call in CondParser_String. | |||
.if !+1 | .if !+1 | |||
. error | . error | |||
.else | ||||
. error | ||||
.endif | .endif | |||
# When the number comes from a variable expression though, it may be signed. | # When the number comes from a variable expression though, it may be signed. | |||
# XXX: This is inconsistent. | # XXX: This is inconsistent. | |||
.if ${:U+0} | .if ${:U+0} | |||
. error | . error | |||
.endif | .endif | |||
# When the number comes from a variable expression though, it may be signed. | # When the number comes from a variable expression though, it may be signed. | |||
# XXX: This is inconsistent. | # XXX: This is inconsistent. | |||
.if !${:U+1} | .if !${:U+1} | |||
. error | . error | |||
.endif | .endif | |||
# Hexadecimal numbers are accepted. | ||||
.if 0x0 | ||||
. error | ||||
.endif | ||||
.if 0x1 | ||||
.else | ||||
. error | ||||
.endif | ||||
# This is not a hexadecimal number, even though it has an x. | ||||
# It is interpreted as a string instead, effectively meaning defined(3x4). | ||||
.if 3x4 | ||||
.else | ||||
. error | ||||
.endif | ||||
# Ensure that parsing continues until here. | # Ensure that parsing continues until here. | |||
.info End of the tests. | .info End of the tests. | |||
all: # nothing | all: # nothing | |||
End of changes. 7 change blocks. | ||||
1 lines changed or deleted | 27 lines changed or added |