1 # $NetBSD: cond-cmp-unary.mk,v 1.2 2020/11/11 07:30:11 rillig Exp $
3 # Tests for unary comparisons in .if conditions, that is, comparisons with
4 # a single operand. If the operand is a number, it is compared to zero,
5 # if it is a string, it is tested for emptiness.
7 # The number 0 evaluates to false.
12 # Any other number evaluates to true.
17 # The empty string evaluates to false.
22 # Any other string evaluates to true.
27 # The empty string may come from a variable expression.
29 # XXX: As of 2020-11-11, this empty string is interpreted "as a number" in
30 # EvalNotEmpty, which is plain wrong. The bug is in TryParseNumber.
35 # A variable expression that is not surrounded by quotes is interpreted
36 # as a number if possible, otherwise as a string.
41 # A non-zero number from a variable expression evaluates to true.
46 # A string of whitespace should evaluate to false.
48 # XXX: As of 2020-11-11, the implementation in EvalNotEmpty does not skip
49 # whitespace before testing for the end. This was probably an oversight in
50 # a commit from 1992-04-15 saying "A variable is empty when it just contains
53 . info This is only reached because of a bug in EvalNotEmpty.