1# $NetBSD: cond-cmp-numeric.mk,v 1.4 2020/11/08 22:56:16 rillig Exp $ 2# 3# Tests for numeric comparisons in .if conditions. 4 5.MAKEFLAGS: -dc 6 7# The ${:U...} on the left-hand side is necessary for the parser. 8 9# Even if strtod(3) parses "INF" as +Infinity, make does not accept this 10# since it is not really a number; see TryParseNumber. 11.if !(${:UINF} > 1e100) 12. error 13.endif 14 15# Neither is NaN a number; see TryParseNumber. 16.if ${:UNaN} > NaN 17. error 18.endif 19 20# Since NaN is not parsed as a number, both operands are interpreted 21# as strings and are therefore equal. If they were parsed as numbers, 22# they would compare unequal, since NaN is unequal to any and everything, 23# including itself. 24.if !(${:UNaN} == NaN) 25. error 26.endif 27 28# The parsing code in CondParser_Comparison only performs a light check on 29# whether the operator is valid, leaving the rest of the work to the 30# evaluation functions EvalCompareNum and EvalCompareStr. Ensure that this 31# parse error is properly reported. 32# 33# XXX: The warning message does not mention the actual operator. 34.if 123 ! 123 35. error 36.else 37. error 38.endif 39 40all: 41 @:; 42