aboutsummaryrefslogtreecommitdiff
path: root/gdb/f-lang.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:06 -0700
commit00f2db6f7d52b718d5436e76184c92006713f531 (patch)
tree543efdd1d2c7df269b5a8b4fddb17e6a0b9633a6 /gdb/f-lang.c
parent93b2b5fae269c9a8e249e81d3549392c8ff70f38 (diff)
downloadgdb-00f2db6f7d52b718d5436e76184c92006713f531.zip
gdb-00f2db6f7d52b718d5436e76184c92006713f531.tar.gz
gdb-00f2db6f7d52b718d5436e76184c92006713f531.tar.bz2
Split out eval_op_f_cmplx
This splits BINOP_FORTRAN_CMPLX into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * f-lang.c (eval_op_f_cmplx): New function. (evaluate_subexp_f): Use it.
Diffstat (limited to 'gdb/f-lang.c')
-rw-r--r--gdb/f-lang.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index 5239f7a..554626e 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -1120,6 +1120,19 @@ eval_op_f_modulo (struct type *expect_type, struct expression *exp,
error (_("MODULO of type %s not supported"), TYPE_SAFE_NAME (type));
}
+/* A helper function for BINOP_FORTRAN_CMPLX. */
+
+static struct value *
+eval_op_f_cmplx (struct type *expect_type, struct expression *exp,
+ enum noside noside,
+ struct value *arg1, struct value *arg2)
+{
+ if (noside == EVAL_SKIP)
+ return eval_skip_value (exp);
+ struct type *type = builtin_f_type(exp->gdbarch)->builtin_complex_s16;
+ return value_literal_complex (arg1, arg2, type);
+}
+
/* Special expression evaluation cases for Fortran. */
static struct value *
@@ -1247,10 +1260,7 @@ evaluate_subexp_f (struct type *expect_type, struct expression *exp,
case BINOP_FORTRAN_CMPLX:
arg1 = evaluate_subexp (nullptr, exp, pos, noside);
arg2 = evaluate_subexp (value_type (arg1), exp, pos, noside);
- if (noside == EVAL_SKIP)
- return eval_skip_value (exp);
- type = builtin_f_type(exp->gdbarch)->builtin_complex_s16;
- return value_literal_complex (arg1, arg2, type);
+ return eval_op_f_cmplx (expect_type, exp, noside, arg1, arg2);
case UNOP_FORTRAN_KIND:
arg1 = evaluate_subexp (NULL, exp, pos, EVAL_AVOID_SIDE_EFFECTS);