aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2019-01-16 16:42:10 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2019-03-06 18:11:31 +0000
commit4d00f5d8f6c4a1c9f334b1abb45b9ce05fb45b0a (patch)
tree24f8cddb29a1036f7f0f23d6a2178f593a2daeef /gdb/parse.c
parentgdb/fortran: Enable debugging of the Fortran parser (diff)
downloadbinutils-gdb-4d00f5d8f6c4a1c9f334b1abb45b9ce05fb45b0a.tar.gz
binutils-gdb-4d00f5d8f6c4a1c9f334b1abb45b9ce05fb45b0a.tar.bz2
binutils-gdb-4d00f5d8f6c4a1c9f334b1abb45b9ce05fb45b0a.zip
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/parse.c')
-rw-r--r--gdb/parse.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gdb/parse.c b/gdb/parse.c
index e7168acf7ab..661574e544e 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -927,6 +927,7 @@ operator_length_standard (const struct expression *expr, int endpos,
case UNOP_CHR:
case UNOP_FLOAT:
case UNOP_HIGH:
+ case UNOP_KIND:
case UNOP_ODD:
case UNOP_ORD:
case UNOP_TRUNC: