This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RFA: handle references to typedefs in binop_user_defined_p
- From: Jim Blandy <jimb at red-bean dot com>
- To: GDB Patches <gdb-patches at sourceware dot org>
- Date: Mon, 23 Jan 2006 16:58:31 -0800
- Subject: RFA: handle references to typedefs in binop_user_defined_p
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;
}
! /* 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;
}
! /* 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