aboutsummaryrefslogtreecommitdiff
path: root/gdb/valarith.c
diff options
context:
space:
mode:
authorJim Blandy <jimb@codesourcery.com>2006-01-24 21:21:12 +0000
committerJim Blandy <jimb@codesourcery.com>2006-01-24 21:21:12 +0000
commit13d6656b12097181737610bfb405a3276555c51c (patch)
tree66140200f4b0c30d79c864db5e23c70833fe5856 /gdb/valarith.c
parent59f92a09f11acb0641ef889f6b32f73a27bd432f (diff)
downloadfsf-binutils-gdb-13d6656b12097181737610bfb405a3276555c51c.zip
fsf-binutils-gdb-13d6656b12097181737610bfb405a3276555c51c.tar.gz
fsf-binutils-gdb-13d6656b12097181737610bfb405a3276555c51c.tar.bz2
2006-01-24 Jim Blandy <jimb@redhat.com>
* valarith.c (binop_user_defined_p): Handle refs to typedefs.
Diffstat (limited to 'gdb/valarith.c')
-rw-r--r--gdb/valarith.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/gdb/valarith.c b/gdb/valarith.c
index b3f360d..2e5e97a 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -285,9 +285,9 @@ value_subscripted_rvalue (struct value *array, struct value *idx, int lowerbound
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.
+/* 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. */
@@ -297,14 +297,17 @@ binop_user_defined_p (enum exp_opcode op, struct value *arg1, struct value *arg2
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
- || (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));
+ || TYPE_CODE (type2) == TYPE_CODE_STRUCT);
}
/* Check to see if argument is a structure. This is called so