aboutsummaryrefslogtreecommitdiff
path: root/gdb/eval.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-03-08 07:27:57 -0700
committerTom Tromey <tom@tromey.com>2021-03-08 07:28:19 -0700
commit5133d78b7bf19f350865c9515839865503cacfa9 (patch)
tree4cf6cef44fb5d2c575f3862e1852bd438f18104d /gdb/eval.c
parenta94323b60793e11ca1fc449e44b57dcff76affd8 (diff)
downloadgdb-5133d78b7bf19f350865c9515839865503cacfa9.zip
gdb-5133d78b7bf19f350865c9515839865503cacfa9.tar.gz
gdb-5133d78b7bf19f350865c9515839865503cacfa9.tar.bz2
Introduce sub_operation
This adds class sub_operation, which implements BINOP_SUB. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class sub_operation): New. * eval.c (eval_op_sub): No longer static. Remove "op" parameter. (evaluate_subexp_standard): Update.
Diffstat (limited to 'gdb/eval.c')
-rw-r--r--gdb/eval.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/gdb/eval.c b/gdb/eval.c
index cba5bcc..87c8b0d 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -1483,15 +1483,15 @@ eval_op_add (struct type *expect_type, struct expression *exp,
/* A helper function for BINOP_SUB. */
-static struct value *
+struct value *
eval_op_sub (struct type *expect_type, struct expression *exp,
- enum noside noside, enum exp_opcode op,
+ enum noside noside,
struct value *arg1, struct value *arg2)
{
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
- if (binop_user_defined_p (op, arg1, arg2))
- return value_x_binop (arg1, arg2, op, OP_NULL, noside);
+ if (binop_user_defined_p (BINOP_SUB, arg1, arg2))
+ return value_x_binop (arg1, arg2, BINOP_SUB, OP_NULL, noside);
else if (ptrmath_type_p (exp->language_defn, value_type (arg1))
&& ptrmath_type_p (exp->language_defn, value_type (arg2)))
{
@@ -2827,7 +2827,7 @@ evaluate_subexp_standard (struct type *expect_type,
case BINOP_SUB:
arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
- return eval_op_sub (expect_type, exp, noside, op, arg1, arg2);
+ return eval_op_sub (expect_type, exp, noside, arg1, arg2);
case BINOP_EXP:
case BINOP_MUL: