From e14816a8ba5ecf8d7c0125a08afe87fb7d1a6bba Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Thu, 25 Feb 2021 11:41:57 +0000 Subject: gdb/fortran: add support for RANK keyword gfortran supports the RANK keyword, see: https://gcc.gnu.org/onlinedocs/gfortran/RANK.html#RANK this commit adds support for this keyword to GDB's Fortran expression parser. gdb/ChangeLog: * f-exp.h (eval_op_f_rank): Declare. (expr::fortran_rank_operation): New typedef. * f-exp.y (exp): Handle UNOP_FORTRAN_RANK after parsing an UNOP_INTRINSIC. (f77_keywords): Add "rank" keyword. * f-lang.c (eval_op_f_rank): New function. * std-operator.def (UNOP_FORTRAN_RANK): New operator. gdb/testsuite/ChangeLog: * gdb.fortran/rank.exp: New file. * gdb.fortran/rank.f90: New file. --- gdb/f-exp.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'gdb/f-exp.h') diff --git a/gdb/f-exp.h b/gdb/f-exp.h index 81cf341..f23c426 100644 --- a/gdb/f-exp.h +++ b/gdb/f-exp.h @@ -74,6 +74,17 @@ extern struct value * eval_op_f_allocated (struct type *expect_type, enum exp_opcode op, struct value *arg1); +/* Implement the evaluation of UNOP_FORTRAN_RANK. EXPECTED_TYPE, EXP, and + NOSIDE are as for expression::evaluate (see expression.h). OP will + always be UNOP_FORTRAN_RANK, and ARG1 is the argument being passed to + the expression. */ + +extern struct value *eval_op_f_rank (struct type *expect_type, + struct expression *exp, + enum noside noside, + enum exp_opcode op, + struct value *arg1); + namespace expr { @@ -94,6 +105,8 @@ using fortran_associated_1arg = unop_operation; using fortran_associated_2arg = binop_operation; +using fortran_rank_operation = unop_operation; /* The Fortran "complex" operation. */ class fortran_cmplx_operation -- cgit v1.1