1# $NetBSD: cond-token-number.mk,v 1.5 2020/11/15 14:58:14 rillig Exp $ 2# 3# Tests for number tokens in .if conditions. 4# 5# TODO: Add introduction. 6 7.if 0 8. error 9.endif 10 11# Even though -0 is a number and would be accepted by strtod, it is not 12# accepted by the condition parser. 13# 14# See the ch_isdigit call in CondParser_String. 15.if -0 16. error 17.else 18. error 19.endif 20 21# Even though +0 is a number and would be accepted by strtod, it is not 22# accepted by the condition parser. 23# 24# See the ch_isdigit call in CondParser_String. 25.if +0 26. error 27.else 28. error 29.endif 30 31# Even though -1 is a number and would be accepted by strtod, it is not 32# accepted by the condition parser. 33# 34# See the ch_isdigit call in CondParser_String. 35.if !-1 36. error 37.else 38. error 39.endif 40 41# Even though +1 is a number and would be accepted by strtod, it is not 42# accepted by the condition parser. 43# 44# See the ch_isdigit call in CondParser_String. 45.if !+1 46. error 47.else 48. error 49.endif 50 51# When the number comes from a variable expression though, it may be signed. 52# XXX: This is inconsistent. 53.if ${:U+0} 54. error 55.endif 56 57# When the number comes from a variable expression though, it may be signed. 58# XXX: This is inconsistent. 59.if !${:U+1} 60. error 61.endif 62 63# Hexadecimal numbers are accepted. 64.if 0x0 65. error 66.endif 67.if 0x1 68.else 69. error 70.endif 71 72# This is not a hexadecimal number, even though it has an x. 73# It is interpreted as a string instead, effectively meaning defined(3x4). 74.if 3x4 75.else 76. error 77.endif 78 79# Ensure that parsing continues until here. 80.info End of the tests. 81 82all: # nothing 83