diff options
author | Daniel Jacobowitz <drow@false.org> | 2002-02-16 22:25:50 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2002-02-16 22:25:50 +0000 |
commit | 491b894671c11468bf3d6d3cdd1f8471767d1ea1 (patch) | |
tree | 67a292cbd22cf0a6ca3b1972b49b968af83245e3 /gdb | |
parent | 8bf549a8c4cf576db65789048d14f6d803f59855 (diff) | |
download | gdb-491b894671c11468bf3d6d3cdd1f8471767d1ea1.zip gdb-491b894671c11468bf3d6d3cdd1f8471767d1ea1.tar.gz gdb-491b894671c11468bf3d6d3cdd1f8471767d1ea1.tar.bz2 |
2002-02-16 Daniel Jacobowitz <drow@mvista.com>
* valarith.c (value_x_unop): Fix decrement; support post-decrement.
2002-02-16 Daniel Jacobowitz <drow@mvista.com>
From Peter Schauer <Peter.Schauer@Regent.E-Technik.TU-Muenchen.DE>:
* valops.c (value_arg_coerce): Don't take the address of a reference
to convert an argument to a reference.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 10 | ||||
-rw-r--r-- | gdb/valarith.c | 19 | ||||
-rw-r--r-- | gdb/valops.c | 3 |
3 files changed, 26 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index fa91d0b..f5dd4fd 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2002-02-16 Daniel Jacobowitz <drow@mvista.com> + + * valarith.c (value_x_unop): Fix decrement; support post-decrement. + +2002-02-16 Daniel Jacobowitz <drow@mvista.com> + + From Peter Schauer <Peter.Schauer@Regent.E-Technik.TU-Muenchen.DE>: + * valops.c (value_arg_coerce): Don't take the address of a reference + to convert an argument to a reference. + 2002-02-15 Christopher Faylor <cgf@redhat.com> * win32-nat.c (get_image_name): New function. diff --git a/gdb/valarith.c b/gdb/valarith.c index d91f326..5852ac6 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -464,7 +464,7 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside) struct value **argvec; char *ptr, *mangle_ptr; char tstr[13], mangle_tstr[13]; - int static_memfuncp; + int static_memfuncp, nargs; COERCE_REF (arg1); COERCE_ENUM (arg1); @@ -475,10 +475,12 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside) if (TYPE_CODE (check_typedef (VALUE_TYPE (arg1))) != TYPE_CODE_STRUCT) error ("Can't do that unary op on that type"); /* FIXME be explicit */ - argvec = (struct value **) alloca (sizeof (struct value *) * 3); + argvec = (struct value **) alloca (sizeof (struct value *) * 4); argvec[1] = value_addr (arg1); argvec[2] = 0; + nargs = 1; + /* make the right function name up */ strcpy (tstr, "operator__"); ptr = tstr + 8; @@ -490,13 +492,19 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside) strcpy (ptr, "++"); break; case UNOP_PREDECREMENT: - strcpy (ptr, "++"); + strcpy (ptr, "--"); break; case UNOP_POSTINCREMENT: strcpy (ptr, "++"); + argvec[2] = value_from_longest (builtin_type_int, 0); + argvec[3] = 0; + nargs ++; break; case UNOP_POSTDECREMENT: - strcpy (ptr, "++"); + strcpy (ptr, "--"); + argvec[2] = value_from_longest (builtin_type_int, 0); + argvec[3] = 0; + nargs ++; break; case UNOP_LOGICAL_NOT: strcpy (ptr, "!"); @@ -521,6 +529,7 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside) if (static_memfuncp) { argvec[1] = argvec[0]; + nargs --; argvec++; } if (noside == EVAL_AVOID_SIDE_EFFECTS) @@ -530,7 +539,7 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside) = TYPE_TARGET_TYPE (check_typedef (VALUE_TYPE (argvec[0]))); return value_zero (return_type, VALUE_LVAL (arg1)); } - return call_function_by_hand (argvec[0], 1 - static_memfuncp, argvec + 1); + return call_function_by_hand (argvec[0], nargs, argvec + 1); } error ("member function %s not found", tstr); return 0; /* For lint -- never reached */ diff --git a/gdb/valops.c b/gdb/valops.c index 748ba8f..4532da7 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -1149,7 +1149,8 @@ value_arg_coerce (struct value *arg, struct type *param_type, switch (TYPE_CODE (type)) { case TYPE_CODE_REF: - if (TYPE_CODE (arg_type) != TYPE_CODE_REF) + if (TYPE_CODE (arg_type) != TYPE_CODE_REF + && TYPE_CODE (arg_type) != TYPE_CODE_PTR) { arg = value_addr (arg); VALUE_TYPE (arg) = param_type; |