Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@red-bean.com>
To: GDB Patches <gdb-patches@sourceware.org>
Subject: RFA: handle references to typedefs in binop_user_defined_p
Date: Tue, 24 Jan 2006 00:58:00 -0000	[thread overview]
Message-ID: <8f2776cb0601231658k6cf2530di5d00b2f5e6bbdcf@mail.gmail.com> (raw)

No regressions on x86_64 native.

gdb/ChangeLog:
2006-01-23  Jim Blandy  <jimb@redhat.com>

	* valarith.c (binop_user_defined_p): Handle refs to typedefs.

Index: gdb/valarith.c
===================================================================
RCS file: /cvs/src/src/gdb/valarith.c,v
retrieving revision 1.44
diff -c -p -r1.44 valarith.c
*** gdb/valarith.c	17 Dec 2005 22:34:03 -0000	1.44
--- gdb/valarith.c	24 Jan 2006 00:42:36 -0000
*************** value_subscripted_rvalue (struct value *
*** 285,293 ****
    return v;
  }
  \f
! /* Check to see if either argument is a structure.  This is called so
!    we know whether to go ahead with the normal binop or look for a
!    user defined function instead.

     For now, we do not overload the `=' operator.  */

--- 285,293 ----
    return v;
  }
  \f
! /* Check to see if either argument is a structure, or a reference to
!    one.  This is called so we know whether to go ahead with the normal
!    binop or look for a user defined function instead.

     For now, we do not overload the `=' operator.  */

*************** binop_user_defined_p (enum exp_opcode op
*** 297,310 ****
    struct type *type1, *type2;
    if (op == BINOP_ASSIGN || op == BINOP_CONCAT)
      return 0;
    type1 = check_typedef (value_type (arg1));
    type2 = check_typedef (value_type (arg2));
    return (TYPE_CODE (type1) == TYPE_CODE_STRUCT
! 	  || TYPE_CODE (type2) == TYPE_CODE_STRUCT
! 	  || (TYPE_CODE (type1) == TYPE_CODE_REF
! 	      && TYPE_CODE (TYPE_TARGET_TYPE (type1)) == TYPE_CODE_STRUCT)
! 	  || (TYPE_CODE (type2) == TYPE_CODE_REF
! 	      && TYPE_CODE (TYPE_TARGET_TYPE (type2)) == TYPE_CODE_STRUCT));
  }

  /* Check to see if argument is a structure.  This is called so
--- 297,313 ----
    struct type *type1, *type2;
    if (op == BINOP_ASSIGN || op == BINOP_CONCAT)
      return 0;
+
    type1 = check_typedef (value_type (arg1));
+   if (TYPE_CODE (type1) == TYPE_CODE_REF)
+     type1 = check_typedef (TYPE_TARGET_TYPE (type1));
+
    type2 = check_typedef (value_type (arg2));
+   if (TYPE_CODE (type2) == TYPE_CODE_REF)
+     type2 = check_typedef (TYPE_TARGET_TYPE (type2));
+
    return (TYPE_CODE (type1) == TYPE_CODE_STRUCT
! 	  || TYPE_CODE (type2) == TYPE_CODE_STRUCT);
  }

  /* Check to see if argument is a structure.  This is called so


             reply	other threads:[~2006-01-24  0:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-24  0:58 Jim Blandy [this message]
2006-01-24 19:24 ` Mark Kettenis
2006-01-24 21:21   ` Jim Blandy

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=8f2776cb0601231658k6cf2530di5d00b2f5e6bbdcf@mail.gmail.com \
    --to=jimb@red-bean.com \
    --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