summaryrefslogtreecommitdiff
path: root/gdb/f-exp.y
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2019-02-13 17:10:18 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2019-04-30 10:10:24 +0100
commitb6d03bb2b65ac5c919f1d08674bbaa2a9bfb2d0c (patch)
treeba4019eaf0e387569cb2f165b226b45140fff8c3 /gdb/f-exp.y
parent83228e93efa82f84a132f7cec44d0e760d4ad22b (diff)
downloadbinutils-gdb-b6d03bb2b65ac5c919f1d08674bbaa2a9bfb2d0c.tar.gz
gdb/fortran: Additional builtin procedures
Add some additional builtin procedures for Fortran, these are MOD, CEILING, FLOOR, MODULO, and CMPLX. gdb/ChangeLog: * f-exp.y (BINOP_INTRINSIC): New token. (exp): New parser rule handling BINOP_INTRINSIC. (f77_keywords): Add new builtin procedures. * f-lang.c (evaluate_subexp_f): Handle BINOP_MOD, UNOP_FORTRAN_CEILING, UNOP_FORTRAN_FLOOR, BINOP_FORTRAN_MODULO, BINOP_FORTRAN_CMPLX. (operator_length_f): Handle UNOP_FORTRAN_CEILING, UNOP_FORTRAN_FLOOR, BINOP_FORTRAN_MODULO, BINOP_FORTRAN_CMPLX. (print_unop_subexp_f): New function. (print_binop_subexp_f): New function. (print_subexp_f): Handle UNOP_FORTRAN_CEILING, UNOP_FORTRAN_FLOOR, BINOP_FORTRAN_MODULO, BINOP_FORTRAN_CMPLX. (dump_subexp_body_f): Likewise. (operator_check_f): Likewise. * fortran-operator.def: Add UNOP_FORTRAN_CEILING, UNOP_FORTRAN_FLOOR, BINOP_FORTRAN_MODULO, BINOP_FORTRAN_CMPLX gdb/testsuite/ChangeLog: * gdb.fortran/intrinsics.exp: Extend to cover MOD, CEILING, FLOOR, MODULO, CMPLX.
Diffstat (limited to 'gdb/f-exp.y')
-rw-r--r--gdb/f-exp.y13
1 files changed, 11 insertions, 2 deletions
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index dec8848bc00..14ea3869bb2 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -174,7 +174,7 @@ static int parse_number (struct parser_state *, const char *, int,
%token <voidval> DOLLAR_VARIABLE
%token <opcode> ASSIGN_MODIFY
-%token <opcode> UNOP_INTRINSIC
+%token <opcode> UNOP_INTRINSIC BINOP_INTRINSIC
%left ','
%left ABOVE_COMMA
@@ -263,6 +263,10 @@ exp : UNOP_INTRINSIC '(' exp ')'
{ write_exp_elt_opcode (pstate, $1); }
;
+exp : BINOP_INTRINSIC '(' exp ',' exp ')'
+ { write_exp_elt_opcode (pstate, $1); }
+ ;
+
arglist :
;
@@ -959,7 +963,12 @@ static const struct token f77_keywords[] =
/* The following correspond to actual functions in Fortran and are case
insensitive. */
{ "kind", KIND, BINOP_END, false },
- { "abs", UNOP_INTRINSIC, UNOP_ABS, false }
+ { "abs", UNOP_INTRINSIC, UNOP_ABS, false },
+ { "mod", BINOP_INTRINSIC, BINOP_MOD, false },
+ { "floor", UNOP_INTRINSIC, UNOP_FORTRAN_FLOOR, false },
+ { "ceiling", UNOP_INTRINSIC, UNOP_FORTRAN_CEILING, false },
+ { "modulo", BINOP_INTRINSIC, BINOP_FORTRAN_MODULO, false },
+ { "cmplx", BINOP_INTRINSIC, BINOP_FORTRAN_CMPLX, false },
};
/* Implementation of a dynamically expandable buffer for processing input