+2009-03-12 Joel Brobecker <brobecker@adacore.com>
+
+ * ada-lang.c (ada_evaluate_subexp): Merge case BINOP_REM and
+ BINOP_MOD cases with the handling of case BINOP_DIV and BINOP_MUL.
+ Remove useless op value checks when EVAL_AVOID_SIDE_EFFECTS.
+
2009-03-12 Joel Brobecker <brobecker@adacore.com>
* ada-lang.c (ada_evaluate_subexp) <BINOP_DIV>: make sure to
case BINOP_MUL:
case BINOP_DIV:
+ case BINOP_REM:
+ case BINOP_MOD:
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
- else if (noside == EVAL_AVOID_SIDE_EFFECTS
- && (op == BINOP_DIV || op == BINOP_REM || op == BINOP_MOD))
+ else if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
return value_zero (value_type (arg1), not_lval);
return ada_value_binop (arg1, arg2, op);
}
- case BINOP_REM:
- case BINOP_MOD:
- arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
- arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
- if (noside == EVAL_SKIP)
- goto nosideret;
- else if (noside == EVAL_AVOID_SIDE_EFFECTS
- && (op == BINOP_DIV || op == BINOP_REM || op == BINOP_MOD))
- return value_zero (value_type (arg1), not_lval);
- else
- {
- binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
- return ada_value_binop (arg1, arg2, op);
- }
-
case BINOP_EQUAL:
case BINOP_NOTEQUAL:
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);