Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Alexandre Oliva <aoliva@redhat.com>
Cc: Eli Zaretskii <eliz@gnu.org>, gdb-patches@sources.redhat.com
Subject: Re: fixes for type-punning warnings in GCC 4.1
Date: Sun, 22 Jan 2006 20:33:00 -0000	[thread overview]
Message-ID: <20060122203323.GC27224@nevyn.them.org> (raw)
In-Reply-To: <or1wz8gham.fsf@livre.oliva.athome.lsd.ic.unicamp.br>

On Mon, Jan 16, 2006 at 04:26:57PM -0200, Alexandre Oliva wrote:
> On Dec 19, 2005, Daniel Jacobowitz <drow@false.org> wrote:
> 
> >> > From: Alexandre Oliva <aoliva@redhat.com>
> >> > Date: Mon, 19 Dec 2005 17:20:48 -0200
> 
> >> > -	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);
> 
> > 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.
> 
> We can't quite do that because we may have to issue more complex
> command patterns than simply a plain sscanf into the output location.
> I've come up with this macro that defers to a static inline function
> in the complex case.  Is this change acceptable?  Tested on
> amd64-linux-gnu.
> 
> Another alternative that I found uglier would be to define a
> DOUBLEST_SCAN macro and a DOUBLEST_SCAN_TYPE typedef, and always
> declare a variable of DOUBLEST_SCAN_TYPE, scan into it, and then copy
> the scanned value to the given output variable.  This enables people
> to construct more complex scan patterns, but is it worth the ugliness
> and extra copying for the sake of the uncommon `has long double but
> can't scanf it' case?

The output is always a DOUBLEST.  I don't know of any reason why we
should enable HAVE_LONG_DOUBLE if we can't printf and scanf them; would
this be simpler in that case?  Don't make DOUBLEST something we can't
scan or print.

-- 
Daniel Jacobowitz
CodeSourcery


  reply	other threads:[~2006-01-22 20:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-20 19:35 Alexandre Oliva
2005-12-20 20:50 ` Eli Zaretskii
2005-12-20 21:05   ` Daniel Jacobowitz
2005-12-21 11:25     ` Eli Zaretskii
2005-12-22  3:48       ` Alexandre Oliva
2006-01-16 18:27     ` Alexandre Oliva
2006-01-22 20:33       ` Daniel Jacobowitz [this message]
2006-02-08  3:35         ` Alexandre Oliva
2006-02-08  4:59           ` Daniel Jacobowitz
2006-02-10  0:33             ` Alexandre Oliva
2006-02-10  1:39               ` Daniel Jacobowitz
2006-02-13 18:58                 ` Alexandre Oliva
2006-02-13 20:13                   ` Mark Kettenis
2006-02-13 20:19                     ` Daniel Jacobowitz
2006-02-08  5:58           ` Alexandre Oliva

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060122203323.GC27224@nevyn.them.org \
    --to=drow@false.org \
    --cc=aoliva@redhat.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox