aboutsummaryrefslogtreecommitdiff
path: root/gdb/f-exp.y
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2019-12-03 10:52:05 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2019-12-04 20:29:53 +0000
commit36c8fb93c9d4135ce3c1561f5f3886b1b0bf31f6 (patch)
treecc79ca29a04f21c9712ba4b9121170ddfdb84aab /gdb/f-exp.y
parentc6170c2c141866bc3fd158db17a1e0b87b43ef07 (diff)
downloadgdb-36c8fb93c9d4135ce3c1561f5f3886b1b0bf31f6.zip
gdb-36c8fb93c9d4135ce3c1561f5f3886b1b0bf31f6.tar.gz
gdb-36c8fb93c9d4135ce3c1561f5f3886b1b0bf31f6.tar.bz2
gdb/fortran: Support for single/double type modifiers
Extend the Fortran parser to support 'single precision' and 'double precision' types as well 'single complex' and 'double complex' types. gdb/ChangeLog: * f-exp.y (COMPLEX_KEYWORD, SINGLE, DOUBLE, PRECISION): New tokens. (typebase): New patterns for complex, single/double precision, and single/double complex. (f77_keywords): Change token for complex keyword, and add single, double, and precision keywords. gdb/testsuite/ChangeLog: * gdb.fortran/type-kinds.exp (test_cast_1_to_type_kind): Handle casting to type with no kind specified. (test_basic_parsing_of_type_kinds): Additional tests for types with no kind specified, and add tests for single/double precision/complex types. Change-Id: I9c82f4d392c58607747bd08862c1ee330723a1ba
Diffstat (limited to 'gdb/f-exp.y')
-rw-r--r--gdb/f-exp.y17
1 files changed, 16 insertions, 1 deletions
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index 9784ad5..a9c9583 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -167,8 +167,10 @@ static int parse_number (struct parser_state *, const char *, int,
%token INT_KEYWORD INT_S2_KEYWORD LOGICAL_S1_KEYWORD LOGICAL_S2_KEYWORD
%token LOGICAL_S8_KEYWORD
%token LOGICAL_KEYWORD REAL_KEYWORD REAL_S8_KEYWORD REAL_S16_KEYWORD
+%token COMPLEX_KEYWORD
%token COMPLEX_S8_KEYWORD COMPLEX_S16_KEYWORD COMPLEX_S32_KEYWORD
%token BOOL_AND BOOL_OR BOOL_NOT
+%token SINGLE DOUBLE PRECISION
%token <lval> CHARACTER
%token <voidval> DOLLAR_VARIABLE
@@ -617,12 +619,22 @@ typebase /* Implements (approximately): (type-qualifier)* type-specifier */
{ $$ = parse_f_type (pstate)->builtin_real_s8; }
| REAL_S16_KEYWORD
{ $$ = parse_f_type (pstate)->builtin_real_s16; }
+ | COMPLEX_KEYWORD
+ { $$ = parse_f_type (pstate)->builtin_complex_s8; }
| COMPLEX_S8_KEYWORD
{ $$ = parse_f_type (pstate)->builtin_complex_s8; }
| COMPLEX_S16_KEYWORD
{ $$ = parse_f_type (pstate)->builtin_complex_s16; }
| COMPLEX_S32_KEYWORD
{ $$ = parse_f_type (pstate)->builtin_complex_s32; }
+ | SINGLE PRECISION
+ { $$ = parse_f_type (pstate)->builtin_real;}
+ | DOUBLE PRECISION
+ { $$ = parse_f_type (pstate)->builtin_real_s8;}
+ | SINGLE COMPLEX_KEYWORD
+ { $$ = parse_f_type (pstate)->builtin_complex_s8;}
+ | DOUBLE COMPLEX_KEYWORD
+ { $$ = parse_f_type (pstate)->builtin_complex_s16;}
;
nonempty_typelist
@@ -956,10 +968,13 @@ static const struct token f77_keywords[] =
{ "integer", INT_KEYWORD, BINOP_END, true },
{ "logical", LOGICAL_KEYWORD, BINOP_END, true },
{ "real_16", REAL_S16_KEYWORD, BINOP_END, true },
- { "complex", COMPLEX_S8_KEYWORD, BINOP_END, true },
+ { "complex", COMPLEX_KEYWORD, BINOP_END, true },
{ "sizeof", SIZEOF, BINOP_END, true },
{ "real_8", REAL_S8_KEYWORD, BINOP_END, true },
{ "real", REAL_KEYWORD, BINOP_END, true },
+ { "single", SINGLE, BINOP_END, true },
+ { "double", DOUBLE, BINOP_END, true },
+ { "precision", PRECISION, BINOP_END, true },
/* The following correspond to actual functions in Fortran and are case
insensitive. */
{ "kind", KIND, BINOP_END, false },