From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KuwXj-0008FK-1S for qemu-devel@nongnu.org; Tue, 28 Oct 2008 17:56:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KuwXg-0008Ef-KJ for qemu-devel@nongnu.org; Tue, 28 Oct 2008 17:56:01 -0400 Received: from [199.232.76.173] (port=37080 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KuwXg-0008Ec-Dd for qemu-devel@nongnu.org; Tue, 28 Oct 2008 17:56:00 -0400 Received: from mx2.redhat.com ([66.187.237.31]:53839) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KuwXg-0008Fb-Cq for qemu-devel@nongnu.org; Tue, 28 Oct 2008 17:56:00 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id m9SLtwMq011745 for ; Tue, 28 Oct 2008 17:55:58 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m9SLtwf0030456 for ; Tue, 28 Oct 2008 17:55:58 -0400 Received: from zweiblum.travel.kraxel.org (vpn-4-102.str.redhat.com [10.32.4.102]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id m9SLtuoC008729 for ; Tue, 28 Oct 2008 17:55:57 -0400 Message-ID: <49078A6C.90907@redhat.com> Date: Tue, 28 Oct 2008 22:55:56 +0100 From: Gerd Hoffmann MIME-Version: 1.0 Subject: Re: [Qemu-devel] [5275] Suppress gcc 4.x -Wpointer-sign (included in -Wall) warnings References: <18695.17376.329419.634634@mariner.uk.xensource.com> <02F3A882-5122-4DA1-BEEC-37E92FA34ADE@web.de> In-Reply-To: <02F3A882-5122-4DA1-BEEC-37E92FA34ADE@web.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Andreas F=E4rber wrote: >=20 > Am 28.10.2008 um 17:54 schrieb Ian Jackson: >=20 >> Blue Swirl writes ("[Qemu-devel] [5275] Suppress gcc 4.x >> -Wpointer-sign (included in -Wall) warnings"): >>> - ret =3D sprintf(phys_ram_base + (16 << 20) - 256, >>> + ret =3D sprintf((char *)(phys_ram_base + (16 << 20) - 256), >> >> I realise I'm a bit late with this comment (my apologies), but: >> >> I think this shows that it would be better to suppress the warning >> with the appropriate compiler option, than to try to update the code. /me agrees. >> And these kind of casts are dangerous because they can suppress >> serious warnings about pointer/integer mismatch. Exactly that's why. > Not sure what type phys_ram_base had here, but char can be signed or > unsigned depending on platform and this often leads to warnings on, > e.g., OSX. Pointer sign-ess for char is a PITA *because* just "char" can be signed or unsigned depending on the platform. IIRC that is the reason the linux kernel has the warning turned off. > Suppressing all signedness warnings could hide real mistakes, > too... That is true too. Unfortunaly gcc has no -Wno-pointer-sign-char cheers, Gerd