Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Pierre Muller" <muller@ics.u-strasbg.fr>
To: "'Joel Brobecker'" <brobecker@adacore.com>
Cc: "'Eli Zaretskii'" <eliz@gnu.org>, 	<gdb-patches@sourceware.org>
Subject: RE: [RFA] Handle BINOP_INTDIV in valarith.c
Date: Wed, 23 Jan 2008 22:36:00 -0000	[thread overview]
Message-ID: <001b01c85e10$48a8aa40$d9f9fec0$@u-strasbg.fr> (raw)
In-Reply-To: <20080123182514.GB3979@adacore.com>



> -----Original Message-----
> From: Joel Brobecker [mailto:brobecker@adacore.com]
> Sent: Wednesday, January 23, 2008 7:25 PM
> To: Pierre Muller
> Cc: 'Eli Zaretskii'; gdb-patches@sourceware.org
> Subject: Re: [RFA] Handle BINOP_INTDIV in valarith.c
> 
> >   I will send a separate patch for
> > a new binop called BINOP_FLOATDIV
> > that will force the result of 'a / b' to be a
> > float in all cases.
> 
> That seems unnecessary to me unless BINOP_DIV and your BINOP_FLOATDIV
> have different meanings in Pascal? Otherwise, I think the problem is
> that the pascal language needs its own expression evaluator so that
> it can handle the '/' operator specifically. The rest can be delegated
> to the standard expression evaluator.

  I wrote the floatdiv version,
which allows me to easily force the conversion to double
formats for left and right operand:
  This simple patch portion from gdb/valarith.c does the main trick:
@@ -865,7 +868,8 @@ value_binop (struct value *arg1, struct 
     }
   else if (TYPE_CODE (type1) == TYPE_CODE_FLT
 	   ||
-	   TYPE_CODE (type2) == TYPE_CODE_FLT)
+	   TYPE_CODE (type2) == TYPE_CODE_FLT
+	   || op == BINOP_FLOATDIV)
     {
       /* FIXME-if-picky-about-floating-accuracy: Should be doing this
          in target format.  real.c in GCC probably has the necessary

Adding BINOP_FLOATDIV is indeed unnecessary if
you can tell me how to check for the correct
languages here.

   maybe 
   || (op == BINOP_DIV && current_language = language_pascal))
would work, but I don't know if current_language is the right variable to
test and it would make the use of this feature by other languages
more complicated than just switching from
BINOP_DIV vto BINOP_FLOATDIV in their respective expression parser?


Pierre Muller
GDB pascal language support maintainer



  reply	other threads:[~2008-01-23 22:36 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-16 14:14 Pierre Muller
2008-01-16 19:11 ` Eli Zaretskii
2008-01-21 10:45   ` Pierre Muller
2008-01-23 18:25     ` Joel Brobecker
2008-01-23 22:36       ` Pierre Muller [this message]
2008-01-23 23:09         ` Joel Brobecker
2008-01-23 23:55           ` Pierre Muller
2008-01-24  1:30             ` Joel Brobecker
2008-01-23 19:07     ` Tom Tromey
2008-01-23 23:00       ` Pierre Muller
2008-01-24  0:27         ` Tom Tromey
2008-01-17 11:58 ` Joel Brobecker
2008-01-17 12:04   ` Joel Brobecker
2008-01-18 16:27     ` Eli Zaretskii
2008-01-21 15:04       ` Pierre Muller
2008-01-25 13:07       ` [RFA] Handle BINOP_INTDIV in eval.c Pierre Muller
2008-01-30  1:01         ` Daniel Jacobowitz
2008-01-30  7:35           ` Pierre Muller

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='001b01c85e10$48a8aa40$d9f9fec0$@u-strasbg.fr' \
    --to=muller@ics.u-strasbg.fr \
    --cc=brobecker@adacore.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