diff options
author | Pedro Alves <palves@redhat.com> | 2010-02-11 21:45:25 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2010-02-11 21:45:25 +0000 |
commit | be636754b785aa5b042991267c851af18ed5b6a9 (patch) | |
tree | 47af6d7426102b5b75f722530ba4b0d5deb96839 /gdb/valarith.c | |
parent | 10ef8d6a8dfca5731b2f4eb4dec945a299050e3c (diff) | |
download | gdb-be636754b785aa5b042991267c851af18ed5b6a9.zip gdb-be636754b785aa5b042991267c851af18ed5b6a9.tar.gz gdb-be636754b785aa5b042991267c851af18ed5b6a9.tar.bz2 |
* ax-gdb.c (gen_exp_binop_rest) [BINOP_SUBSCRIPT]: Error out on
non-subscriptable types.
* valarith.c (binop_types_user_defined_p): New, abstracted out
from ...
(binop_user_defined_p): ... this.
* value.h (binop_types_user_defined_p): Declare.
Diffstat (limited to 'gdb/valarith.c')
-rw-r--r-- | gdb/valarith.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/gdb/valarith.c b/gdb/valarith.c index c87bc6f..9f91f4e 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -263,17 +263,17 @@ value_bitstring_subscript (struct type *type, For now, we do not overload the `=' operator. */ int -binop_user_defined_p (enum exp_opcode op, struct value *arg1, struct value *arg2) +binop_types_user_defined_p (enum exp_opcode op, + struct type *type1, struct type *type2) { - struct type *type1, *type2; if (op == BINOP_ASSIGN || op == BINOP_CONCAT) return 0; - type1 = check_typedef (value_type (arg1)); + type1 = check_typedef (type1); if (TYPE_CODE (type1) == TYPE_CODE_REF) type1 = check_typedef (TYPE_TARGET_TYPE (type1)); - type2 = check_typedef (value_type (arg2)); + type2 = check_typedef (type1); if (TYPE_CODE (type2) == TYPE_CODE_REF) type2 = check_typedef (TYPE_TARGET_TYPE (type2)); @@ -281,6 +281,19 @@ binop_user_defined_p (enum exp_opcode op, struct value *arg1, struct value *arg2 || TYPE_CODE (type2) == TYPE_CODE_STRUCT); } +/* 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. */ + +int +binop_user_defined_p (enum exp_opcode op, + struct value *arg1, struct value *arg2) +{ + return binop_types_user_defined_p (op, value_type (arg1), value_type (arg2)); +} + /* Check to see if argument is a structure. This is called so we know whether to go ahead with the normal unop or look for a user defined function instead. |