+2021-03-08 Tom Tromey <tom@tromey.com>
+
+ * ada-lang.c (ada_unop_neg): New function.
+ (ada_evaluate_subexp): Use it.
+
2021-03-08 Tom Tromey <tom@tromey.com>
* ada-lang.c (eval_ternop_in_range): New function.
|| value_equal (arg2, arg1)));
}
+/* A helper function for UNOP_NEG. */
+
+static value *
+ada_unop_neg (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside, enum exp_opcode op,
+ struct value *arg1)
+{
+ if (noside == EVAL_SKIP)
+ return eval_skip_value (exp);
+ unop_promote (exp->language_defn, exp->gdbarch, &arg1);
+ return value_neg (arg1);
+}
+
/* Implement the evaluate_exp routine in the exp_descriptor structure
for the Ada language. */
case UNOP_NEG:
arg1 = evaluate_subexp (nullptr, exp, pos, noside);
- if (noside == EVAL_SKIP)
- goto nosideret;
- else
- {
- unop_promote (exp->language_defn, exp->gdbarch, &arg1);
- return value_neg (arg1);
- }
+ return ada_unop_neg (expect_type, exp, noside, op, arg1);
case BINOP_LOGICAL_AND:
case BINOP_LOGICAL_OR: