From owner-svn-src-head@FreeBSD.ORG Wed May 18 21:31:36 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFD311065670; Wed, 18 May 2011 21:31:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id A28548FC0C; Wed, 18 May 2011 21:31:36 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:7528:4084:758a:e8ff] (unknown [IPv6:2001:7b8:3a7:0:7528:4084:758a:e8ff]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id EF7CE5C37; Wed, 18 May 2011 23:31:35 +0200 (CEST) Message-ID: <4DD43AB7.7060705@FreeBSD.org> Date: Wed, 18 May 2011 23:31:35 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.18pre) Gecko/20110506 Lanikai/3.1.11pre MIME-Version: 1.0 To: Pawel Jakub Dawidek References: <201105182106.p4IL6KkE008657@svn.freebsd.org> <20110518211651.GE2273@garage.freebsd.pl> In-Reply-To: <20110518211651.GE2273@garage.freebsd.pl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Ben Laurie , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222084 - head/contrib/gperf/src X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 May 2011 21:31:37 -0000 On 2011-05-18 23:16, Pawel Jakub Dawidek wrote: > On Wed, May 18, 2011 at 09:06:20PM +0000, Ben Laurie wrote: >> Author: benl >> Date: Wed May 18 21:06:20 2011 >> New Revision: 222084 >> URL: http://svn.freebsd.org/changeset/base/222084 >> >> Log: >> Fix clang warnings. >> >> Approved by: philip (mentor) > [...] >> - fprintf (stderr, " by changing asso_value['%c'] (char #%d) to %d\n", >> + fprintf (stderr, " by changing asso_value['%c'] (char #%zd) to %d\n", >> *p, p - union_set + 1, asso_values[(unsigned char)(*p)]); > > Hmm, both 'p' and 'union_set' are 'char *' and %zd is for ssize_t. It is > a bit strange that it fixes the warning. If you subtract two pointers, such as in this case, you get a ptrdiff_t. Strictly, this doesn't have to be exactly the same type as ssize_t, but in practice it will almost always be. You can also cast the result to intmax_t, and use %jd, then it will always be correct, but possibly have some small overhead.