Received: from [140.186.70.92] (port=33299 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P1kmH-0002tA-S1 for qemu-devel@nongnu.org; Fri, 01 Oct 2010 14:56:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P1kFU-0003r3-Uh for qemu-devel@nongnu.org; Fri, 01 Oct 2010 14:23:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:63067) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P1kFU-0003qz-NF for qemu-devel@nongnu.org; Fri, 01 Oct 2010 14:22:24 -0400 From: Markus Armbruster Subject: Re: [Qemu-devel] [PATCH v2] es1370: Fix compiler warnings for debug code References: <1285956354-5071-1-git-send-email-weil@mail.berlios.de> Date: Fri, 01 Oct 2010 20:22:18 +0200 In-Reply-To: <1285956354-5071-1-git-send-email-weil@mail.berlios.de> (Stefan Weil's message of "Fri, 1 Oct 2010 20:05:54 +0200") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil Cc: Blue Swirl , QEMU Developers Stefan Weil writes: > The patch fixes these gcc warnings: > > ./hw/es1370.c: In function =E2=80=98es1370_update_voices=E2=80=99: > ./hw/es1370.c:411: error: format =E2=80=98%d=E2=80=99 expects type =E2=80= =98int=E2=80=99, but argument 3 has type =E2=80=98size_t=E2=80=99 > ./hw/es1370.c: In function =E2=80=98es1370_writel=E2=80=99: > ./hw/es1370.c:579: error: format =E2=80=98%d=E2=80=99 expects type =E2=80= =98int=E2=80=99, but argument 3 has type =E2=80=98long int=E2=80=99 > ./hw/es1370.c:589: error: format =E2=80=98%d=E2=80=99 expects type =E2=80= =98int=E2=80=99, but argument 3 has type =E2=80=98long int=E2=80=99 > ./hw/es1370.c:606: error: format =E2=80=98%d=E2=80=99 expects type =E2=80= =98int=E2=80=99, but argument 3 has type =E2=80=98long int=E2=80=99 > ./hw/es1370.c: In function =E2=80=98es1370_readl=E2=80=99: > ./hw/es1370.c:748: error: suggest braces around empty body in an =E2=80= =98if=E2=80=99 statement > > v2 > > * Use %zd for pointer differences (ptrdiff_t or ssize_t). > The gcc error message ("long int") was misleading. > Malc, thank you for this hint. The correct length modifier for ptrdiff_t is 't', not 'z'. ISO/IEC 9899:1999 7.19.6.1: z Specifies that a following d, i, o, u, x, or X conversion specifier applies to a size_t or the corresponding signed integer type argument; or that a following n conversion specifier applies to a pointer to a signed integer type corresponding to size_t argument. t Specifies that a following d, i, o, u, x, or X conversion specifier applies to a ptrdiff_t or the corresponding unsigned integer type argument; or that a following n conversion specifier applies to a pointer to a ptrdiff_t argument. Not that it makes a difference in practice.