From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6024 invoked by alias); 19 Dec 2005 22:18:37 -0000 Received: (qmail 6016 invoked by uid 22791); 19 Dec 2005 22:18:36 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Mon, 19 Dec 2005 22:18:35 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1EoTKw-0008Tk-Pf; Mon, 19 Dec 2005 17:18:30 -0500 Date: Tue, 20 Dec 2005 21:05:00 -0000 From: Daniel Jacobowitz To: Eli Zaretskii Cc: Alexandre Oliva , gdb-patches@sources.redhat.com Subject: Re: fixes for type-punning warnings in GCC 4.1 Message-ID: <20051219221830.GA32448@nevyn.them.org> Mail-Followup-To: Eli Zaretskii , Alexandre Oliva , gdb-patches@sources.redhat.com References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.8i X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2005-12/txt/msg00244.txt.bz2 On Tue, Dec 20, 2005 at 12:10:00AM +0200, Eli Zaretskii wrote: > > From: Alexandre Oliva > > Date: Mon, 19 Dec 2005 17:20:48 -0200 > > > > This patch fixes the type-punning warnings that the GCC 4.1 branch > > issues when compiling the GDB code base. > > [...] > > - num = sscanf (p, "%g%s", (float *) &putithere->typed_val_float.dval,s); > > + num = sscanf (p, "%g%s", (float *) (void *) &putithere->typed_val_float.dval,s); > > If this is the fix, then forgive me, but I'd prefer not to fix it at > all, 'cause it's so UUUGLYYYY! If we can use some command-line switch > to GCC to shut it up, let's do that instead. Failing that, let's just > leave the code alone, so that GCC's continued whining stands as a token > of our unappreciation to compilers that should have known better! I really can't agree; the code GCC's warning about here is pretty disgusting to start with, and this warning is a very valuable service of GCC for C conformance. We should fix it properly, in any case. The right solution here is pretty apparent: delete the "float" case, and #define appropriate format characters for DOUBLEST in doublest.h, in the same place we typedef DOUBLEST. Just like GCC's HOST_WIDE_INT_PRINT. -- Daniel Jacobowitz CodeSourcery, LLC