mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-25 21:41:47 +08:00
Split out eval_op_f_kind
This splits UNOP_FORTRAN_KIND into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * f-lang.c (eval_op_f_kind): New function. (evaluate_subexp_f): Use it.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
* f-lang.c (eval_op_f_kind): New function.
|
||||||
|
(evaluate_subexp_f): Use it.
|
||||||
|
|
||||||
2021-03-08 Tom Tromey <tom@tromey.com>
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* f-lang.c (eval_op_f_cmplx): New function.
|
* f-lang.c (eval_op_f_cmplx): New function.
|
||||||
|
43
gdb/f-lang.c
43
gdb/f-lang.c
@ -1133,6 +1133,31 @@ eval_op_f_cmplx (struct type *expect_type, struct expression *exp,
|
|||||||
return value_literal_complex (arg1, arg2, type);
|
return value_literal_complex (arg1, arg2, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* A helper function for UNOP_FORTRAN_KIND. */
|
||||||
|
|
||||||
|
static struct value *
|
||||||
|
eval_op_f_kind (struct type *expect_type, struct expression *exp,
|
||||||
|
enum noside noside,
|
||||||
|
struct value *arg1)
|
||||||
|
{
|
||||||
|
struct type *type = value_type (arg1);
|
||||||
|
|
||||||
|
switch (type->code ())
|
||||||
|
{
|
||||||
|
case TYPE_CODE_STRUCT:
|
||||||
|
case TYPE_CODE_UNION:
|
||||||
|
case TYPE_CODE_MODULE:
|
||||||
|
case TYPE_CODE_FUNC:
|
||||||
|
error (_("argument to kind must be an intrinsic type"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!TYPE_TARGET_TYPE (type))
|
||||||
|
return value_from_longest (builtin_type (exp->gdbarch)->builtin_int,
|
||||||
|
TYPE_LENGTH (type));
|
||||||
|
return value_from_longest (builtin_type (exp->gdbarch)->builtin_int,
|
||||||
|
TYPE_LENGTH (TYPE_TARGET_TYPE (type)));
|
||||||
|
}
|
||||||
|
|
||||||
/* Special expression evaluation cases for Fortran. */
|
/* Special expression evaluation cases for Fortran. */
|
||||||
|
|
||||||
static struct value *
|
static struct value *
|
||||||
@ -1264,23 +1289,7 @@ evaluate_subexp_f (struct type *expect_type, struct expression *exp,
|
|||||||
|
|
||||||
case UNOP_FORTRAN_KIND:
|
case UNOP_FORTRAN_KIND:
|
||||||
arg1 = evaluate_subexp (NULL, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
|
arg1 = evaluate_subexp (NULL, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
|
||||||
type = value_type (arg1);
|
return eval_op_f_kind (expect_type, exp, noside, arg1);
|
||||||
|
|
||||||
switch (type->code ())
|
|
||||||
{
|
|
||||||
case TYPE_CODE_STRUCT:
|
|
||||||
case TYPE_CODE_UNION:
|
|
||||||
case TYPE_CODE_MODULE:
|
|
||||||
case TYPE_CODE_FUNC:
|
|
||||||
error (_("argument to kind must be an intrinsic type"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!TYPE_TARGET_TYPE (type))
|
|
||||||
return value_from_longest (builtin_type (exp->gdbarch)->builtin_int,
|
|
||||||
TYPE_LENGTH (type));
|
|
||||||
return value_from_longest (builtin_type (exp->gdbarch)->builtin_int,
|
|
||||||
TYPE_LENGTH (TYPE_TARGET_TYPE (type)));
|
|
||||||
|
|
||||||
|
|
||||||
case OP_F77_UNDETERMINED_ARGLIST:
|
case OP_F77_UNDETERMINED_ARGLIST:
|
||||||
/* Remember that in F77, functions, substring ops and array subscript
|
/* Remember that in F77, functions, substring ops and array subscript
|
||||||
|
Reference in New Issue
Block a user