Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Siva Chandra <sivachandra@google.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC] Extend existing support for evaluating expressions using overloaded operators
Date: Mon, 04 Jun 2012 20:53:00 -0000	[thread overview]
Message-ID: <87aa0in6ii.fsf@fleche.redhat.com> (raw)
In-Reply-To: <CAGyQ6gz2SxhgW7WE7dLAwsdoRzV7DrU3M=KSsATSE7-5SRhQWA@mail.gmail.com>	(Siva Chandra's message of "Sat, 2 Jun 2012 01:22:11 +0530")

>>>>> "Siva" == Siva Chandra <sivachandra@google.com> writes:

Siva>         * valarith.c (value_binop): Extend to handle overloaded
Siva>         binary operations on compound types.

I don't understand why value_binop must be modified.
I think in the current design it is up to the caller to check this.
(I don't necessarily think this is a good design -- but changing it
would require more changes elsewhere.)

Siva> +int
Siva> +is_compound_type (struct type *type)
Siva> +{
Siva> +  enum type_code type_code;
Siva> +
Siva> +  CHECK_TYPEDEF (type);
Siva> +
Siva> +  type_code = TYPE_CODE (type);
Siva> +  if (type_code == TYPE_CODE_STRUCT || type_code == TYPE_CODE_UNION)

It seems to me that there is other code which assumes that only
TYPE_CODE_STRUCT can be overloaded.  At least binop_types_user_defined_p,
but maybe others.  Those spots should be updated.

It would be nice if the test suite tested this case as well.

Siva> +      TRY_CATCH (except, RETURN_MASK_ERROR)
Siva> +        {
Siva> +          /* Retrieve the list of methods with the name NAME.  */
Siva> +          fns_ptr = value_find_oload_method_list (&temp, name, 
Siva> +	                                          0, &num_fns, 
Siva> +                                                  &basetype, &boffset);
Siva> +        }
Siva> +      if (except.reason < 0)
Siva> +        fns_ptr = NULL;

I'll have to go read this in more depth; but I wonder why it is ok to
ignore exceptions here.

Tom


  reply	other threads:[~2012-06-04 20:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-01 19:52 Siva Chandra
2012-06-04 20:53 ` Tom Tromey [this message]
2012-06-05 18:34   ` Siva Chandra
2012-06-08 17:41     ` Tom Tromey
2012-06-08 19:18       ` Siva Chandra
2012-06-18  7:30         ` Siva Chandra

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=87aa0in6ii.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sivachandra@google.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