diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2019-01-18 14:44:48 +0000 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2019-03-06 18:11:31 +0000 |
commit | 0841c79a3dc1cfa382164a6bb2c1ee41af3ab0a9 (patch) | |
tree | 91f447c2bbfe0f87c46e7a42205ca8d63ca86ec8 /gdb/f-exp.y | |
parent | 4a270568d93263e4970099456b4efb58466134a6 (diff) | |
download | gdb-0841c79a3dc1cfa382164a6bb2c1ee41af3ab0a9.zip gdb-0841c79a3dc1cfa382164a6bb2c1ee41af3ab0a9.tar.gz gdb-0841c79a3dc1cfa382164a6bb2c1ee41af3ab0a9.tar.bz2 |
gdb/fortran: Add support for the ABS intrinsic function
Adds support for the abs intrinsic function, this requires adding a
new pattern to the Fortran parser. Currently only float and integer
argument types are supported to ABS, complex is still not supported,
this can be added later if needed.
gdb/ChangeLog:
* f-exp.y: New token, UNOP_INTRINSIC.
(exp): New pattern using UNOP_INTRINSIC token.
(f77_keywords): Add 'abs' keyword.
* f-lang.c: Add 'target-float.h' and 'math.h' includes.
(value_from_host_double): New function.
(evaluate_subexp_f): Support UNOP_ABS.
gdb/testsuite/ChangeLog:
* gdb.fortran/intrinsics.exp: Extend to cover ABS.
Diffstat (limited to 'gdb/f-exp.y')
-rw-r--r-- | gdb/f-exp.y | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gdb/f-exp.y b/gdb/f-exp.y index d256ff1..88c685a 100644 --- a/gdb/f-exp.y +++ b/gdb/f-exp.y @@ -168,6 +168,7 @@ static int parse_number (struct parser_state *, const char *, int, %token <voidval> DOLLAR_VARIABLE %token <opcode> ASSIGN_MODIFY +%token <opcode> UNOP_INTRINSIC %left ',' %left ABOVE_COMMA @@ -252,6 +253,10 @@ exp : exp '(' OP_F77_UNDETERMINED_ARGLIST); } ; +exp : UNOP_INTRINSIC '(' exp ')' + { write_exp_elt_opcode (pstate, $1); } + ; + arglist : ; @@ -945,7 +950,8 @@ static const struct token f77_keywords[] = { "real", REAL_KEYWORD, BINOP_END, true }, /* The following correspond to actual functions in Fortran and are case insensitive. */ - { "kind", KIND, BINOP_END, false } + { "kind", KIND, BINOP_END, false }, + { "abs", UNOP_INTRINSIC, UNOP_ABS, false } }; /* Implementation of a dynamically expandable buffer for processing input |