* ax-gdb.c (gen_expr): Add UNOP_PLUS case.

* c-exp.y (exp): Add unary plus.
	* eval.c (evaluate_subexp_standard): Add UNOP_PLUS case.
	* valarith.c (value_x_unop): Add UNOP_PLUS case.
	(value_pos): New.
	* value.h (value_pos): Declare.

	* gdb.cp/userdef.cc (A1::operator+): New unary plus.
	(A2): New class.
	(main): Test operator+.
	* gdb.cp/userdef.exp: Test unary plus.  Use A2::operator+ for
	breakpoint test.
This commit is contained in:
Nathan Sidwell 2005-03-08 14:35:20 +00:00
parent 3de11b2ef2
commit 36e9969cac
9 changed files with 93 additions and 3 deletions

View file

@ -1642,6 +1642,13 @@ gen_expr (union exp_element **pc, struct agent_expr *ax,
}
break;
case UNOP_PLUS:
(*pc)++;
/* + FOO is equivalent to 0 + FOO, which can be optimized. */
gen_expr (pc, ax, value);
gen_usual_unary (ax, value);
break;
case UNOP_NEG:
(*pc)++;
/* -FOO is equivalent to 0 - FOO. */