This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: fixes for type-punning warnings in GCC 4.1
> Date: Mon, 19 Dec 2005 17:18:30 -0500
> From: Daniel Jacobowitz <drow@false.org>
> Cc: Alexandre Oliva <aoliva@redhat.com>, gdb-patches@sources.redhat.com
>
> On Tue, Dec 20, 2005 at 12:10:00AM +0200, Eli Zaretskii wrote:
> > > From: Alexandre Oliva <aoliva@redhat.com>
> > > 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.
Obviously, Alexandre didn't think it was a valuable service, since he
tried to dupe GCC into not providing it ;-)
> We should fix it properly, in any case.
If we can, let's do it.
> 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.
That would be good, yes.