diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2019-01-16 16:42:10 +0000 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2019-03-06 18:11:31 +0000 |
commit | 4d00f5d8f6c4a1c9f334b1abb45b9ce05fb45b0a (patch) | |
tree | 24f8cddb29a1036f7f0f23d6a2178f593a2daeef /gdb/expprint.c | |
parent | e454224fa82aa52a1288a3d6a2e26e8d224d732a (diff) | |
download | binutils-gdb-4d00f5d8f6c4a1c9f334b1abb45b9ce05fb45b0a.tar.gz |
gdb/fortran: Add Fortran 'kind' intrinsic and keyword
The 'kind' keyword has two uses in Fortran, it is the name of a
builtin intrinsic function, and it is also a keyword used to create a
type of a specific kind.
This commit adds support for using kind as an intrinsic function, and
also adds some initial support for using kind to create types of a
specific kind.
This commit only allows the creation of the type 'character(kind=1)',
however, it will be easy enough to extend this in future to support
more type kinds.
The kind of any expression can be queried using the kind intrinsic
function. At the moment the kind returned corresponds to the size of
the type, this matches how gfortran handles kinds. However, the
correspondence between kind and type size depends on the compiler
and/or the specific target, so this might not be correct for
everyone. If we want to support different compilers/targets in future
the code to compute the kind from a type will need to be updated.
gdb/ChangeLog:
* expprint.c (dump_subexp_body_standard): Support UNOP_KIND.
* f-exp.y: Define 'KIND' token.
(exp): New pattern for KIND expressions.
(ptype): Handle types with a kind extension.
(direct_abs_decl): Extend to spot kind extensions.
(f77_keywords): Add 'kind' to the list.
(push_kind_type): New function.
(convert_to_kind_type): New function.
* f-lang.c (evaluate_subexp_f): Support UNOP_KIND.
* parse.c (operator_length_standard): Likewise.
* parser-defs.h (enum type_pieces): Add tp_kind.
* std-operator.def: Add UNOP_KIND.
gdb/testsuite/ChangeLog:
* gdb.fortran/intrinsics.exp: New file.
* gdb.fortran/intrinsics.f90: New file.
* gdb.fortran/type-kinds.exp: New file.
Diffstat (limited to 'gdb/expprint.c')
-rw-r--r-- | gdb/expprint.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gdb/expprint.c b/gdb/expprint.c index d7ad1a71878..a22499f4833 100644 --- a/gdb/expprint.c +++ b/gdb/expprint.c @@ -869,6 +869,7 @@ dump_subexp_body_standard (struct expression *exp, case UNOP_MIN: case UNOP_ODD: case UNOP_TRUNC: + case UNOP_KIND: elt = dump_subexp (exp, stream, elt); break; case OP_LONG: |