Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Thiago Jung Bauermann <bauerman@br.ibm.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch 2/2] Wrap-up expression support for DFP.
Date: Mon, 07 Jan 2008 16:20:00 -0000	[thread overview]
Message-ID: <1199722798.5586.16.camel@localhost.localdomain> (raw)
In-Reply-To: <uzlvkv7b7.fsf@gnu.org>

On Sat, 2008-01-05 at 13:30 +0200, Eli Zaretskii wrote:
> > Is this version ok?
> 
> Yes, but.  I took a look on the error messages you added, and found a
> few that need some fixing:

Ok.

> > +  ret = asprintf (&buffer, "%.30Lg", value_as_double (from));
> > +  if (ret == -1)
> > +    error (_("Error in conversion to decimal float."));
> 
> The documentation of asprintf says that -1 is returned if it fails to
> allocate memory for the buffer.  So I think our error message should
> say the same.  In any case, "error in conversion" is too vague to be
> useful.

Yes, that's what the libiberty implementation says. The Linux manpage is
somewhat vague, though: "If memory allocation wasn’t possible, or some
other error occurs, these functions will return -1". The glibc
implementation returns -1 for memory errors, or the return value of
vfprintf, the manpage of which says that "If an output error is
encountered, a negative value is returned.". So it seems that these
functions don't let the caller know exactly what led them to failure.

But it seems unlikely that an output error would happen when writing to
a string, so I guess we could assume that negative return values are
memory allocation errors. Then the error message could be changed to:

error (_("Error in memory allocation for conversion to decimal
float."));

> 
> > +	error (_("Unknown decimal floating point operation."));
> 
> Shouldn't this be internal_error?  I mean, there couldn't be any valid
> op at this point, so this is a kind-of "can't happen" situation, isn't
> it?
> 
> > +    error (_("Don't know how to convert to decimal floating type."));
> 
> Wouldn't it be better to state the source type (from which we tried to
> convert) here as well?

Actually, it turns out this else block is unreachable in the current
code. All callers of value_args_as_decimal check if the types are either
decfloat or integral before calling it. I'm not sure if it's better to
leave the else part just in case the code changes, or remove it.

If the message is left there, it can be changed to:

error (_("Don't know how to convert from %s to %s."), TYPE_NAME (type1),
TYPE_NAME (type2));

> > +	  error (_("Integer-only operation on floating point number."));
> 
> Did you mean to say "Integer-only operation on floating point number
> is not allowed."?  Or something else?  As a GDB user, I'd be quite
> confused about the actual problem if I were to see this message.

I thought "Integer-only operation" already told the user that it's not
allowed on floating point number. But I changed it to:

error (_("Operation not valid for decimal floating point number."));

What do you think of the above?

> 
> > Index: src-git/gdb/doc/gdb.texinfo
> > ===================================================================
> > --- src-git.orig/gdb/doc/gdb.texinfo	2007-12-28 01:11:37.000000000 -0200
> > +++ src-git/gdb/doc/gdb.texinfo	2008-01-02 14:14:48.000000000 -0200
> 
> This part of your patch is approved.

Thanks.
-- 
[]'s
Thiago Jung Bauermann
Software Engineer
IBM Linux Technology Center


  reply	other threads:[~2008-01-07 16:20 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-20  5:55 [patch 0/2] Complete expression support for Decimal Floating Point Thiago Jung Bauermann
2007-12-20  5:55 ` [patch 1/2] Recognize DFP types in casts Thiago Jung Bauermann
2007-12-20 15:24   ` Daniel Jacobowitz
2007-12-20 16:48     ` Thiago Jung Bauermann
2007-12-20 16:54       ` Thiago Jung Bauermann
2007-12-20 16:57       ` Daniel Jacobowitz
2007-12-20 17:21         ` Thiago Jung Bauermann
2007-12-20  8:03 ` [patch 2/2] Wrap-up expression support for DFP Thiago Jung Bauermann
2007-12-21 16:12   ` Eli Zaretskii
2007-12-21 16:30     ` Andreas Schwab
2007-12-21 16:38       ` Eli Zaretskii
2007-12-27  7:40     ` Thiago Jung Bauermann
2007-12-29 11:21       ` Eli Zaretskii
2008-01-02 20:07         ` Thiago Jung Bauermann
2008-01-05 11:30           ` Eli Zaretskii
2008-01-07 16:20             ` Thiago Jung Bauermann [this message]
2008-01-07 17:09               ` Thiago Jung Bauermann
2008-01-07 21:09               ` Eli Zaretskii
2008-01-07 22:39                 ` Thiago Jung Bauermann
2007-12-28  6:16     ` Thiago Jung Bauermann
2007-12-29 12:53       ` Eli Zaretskii
2008-01-02 16:42         ` Thiago Jung Bauermann

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=1199722798.5586.16.camel@localhost.localdomain \
    --to=bauerman@br.ibm.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    /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