From owner-svn-src-all@FreeBSD.ORG Fri Dec 26 22:31:45 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59C49106564A; Fri, 26 Dec 2008 22:31:45 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 48A088FC08; Fri, 26 Dec 2008 22:31:45 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBQMVjki052151; Fri, 26 Dec 2008 22:31:45 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBQMVjHC052150; Fri, 26 Dec 2008 22:31:45 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200812262231.mBQMVjHC052150@svn.freebsd.org> From: Luigi Rizzo Date: Fri, 26 Dec 2008 22:31:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186502 - head/usr.bin/make X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Dec 2008 22:31:45 -0000 Author: luigi Date: Fri Dec 26 22:31:45 2008 New Revision: 186502 URL: http://svn.freebsd.org/changeset/base/186502 Log: Clarify the behaviour of conditionals when dealing with comparisons. In particular, point out that string comparison can only use != and == (how weird, given that the underlying call to strcmp returns more information), that floating point values are correctly interpreted as numbers, and that the left-hand side must be a variable expansion. MFC after: 3 weeks Modified: head/usr.bin/make/make.1 Modified: head/usr.bin/make/make.1 ============================================================================== --- head/usr.bin/make/make.1 Fri Dec 26 20:27:32 2008 (r186501) +++ head/usr.bin/make/make.1 Fri Dec 26 22:31:45 2008 (r186502) @@ -1130,24 +1130,35 @@ has been defined. .Pp An .Ar expression -may also be an arithmetic or string comparison, with the left-hand side -being a variable expansion. -Variable expansion is -performed on both sides of the comparison, after which the integral +may also be a numeric or string comparison: +in this case, the left-hand side +.Ar must be +a variable expansion, whereas the right-hand side can be a +constant or a variable expansion. +Variable expansion is performed on both sides, after which the resulting values are compared. A value is interpreted as hexadecimal if it is preceded by 0x, otherwise it is decimal; octal numbers are not supported. -The standard C relational operators are all supported. -If after -variable expansion, either the left or right hand side of a +.Pp +String comparison can only use the .Sq Ic == or .Sq Ic != -operator is not an integral value, then -string comparison is performed between the expanded -variables. -If no relational operator is given, it is assumed that the expanded -variable is being compared against 0. +operators, whereas numeric values (both integer and floating point) +can also be compared using the +.Sq Ic > +, +.Sq Ic >= +, +.Sq Ic < +and +.Sq Ic <= +operators. +.Pp +If no relational operator (and right-hand value) are given, an implicit +.Sq Ic != 0 +is used. However be very careful in using this feature especially +when the left-hand side variable expansion returns a string. .Pp When .Nm