summaryrefslogtreecommitdiff
path: root/gdb/f-typeprint.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2019-02-17 00:37:20 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2019-04-30 10:36:56 +0100
commitf1fdc960664c24d911d6189b94e5c054b4bb9053 (patch)
treed561d6e01f2adc4d032f35157eca9831f11c4357 /gdb/f-typeprint.c
parentbf7a4de1722a63c8b017d010e75d5e9e5e622f36 (diff)
downloadbinutils-gdb-f1fdc960664c24d911d6189b94e5c054b4bb9053.tar.gz
gdb/fortran: Update rules for printing whitespace in types
The whitespace produced as types are printed seems inconsistent. This commit updates the rules in an attempt to make whitespace more balanced and consistent. Expected results are updated. gdb/ChangeLog: * f-typeprint.c (f_print_type): Update rules for printing whitespace. (f_type_print_varspec_suffix): Likewise. gdb/testsuite/ChangeLog: * gdb.fortran/ptr-indentation.exp: Update expected results. * gdb.fortran/ptype-on-functions.exp: Likewise. * gdb.fortran/vla-ptr-info.exp: Likewise. * gdb.fortran/vla-value.exp: Likewise.
Diffstat (limited to 'gdb/f-typeprint.c')
-rw-r--r--gdb/f-typeprint.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
index 0329e50fd0b..66a450a65c7 100644
--- a/gdb/f-typeprint.c
+++ b/gdb/f-typeprint.c
@@ -68,13 +68,20 @@ f_print_type (struct type *type, const char *varstring, struct ui_file *stream,
f_type_print_base (type, stream, show, level);
code = TYPE_CODE (type);
if ((varstring != NULL && *varstring != '\0')
- /* Need a space if going to print stars or brackets;
- but not if we will print just a type name. */
- || ((show > 0 || TYPE_NAME (type) == 0)
- && (code == TYPE_CODE_PTR || code == TYPE_CODE_FUNC
+ /* Need a space if going to print stars or brackets; but not if we
+ will print just a type name. */
+ || ((show > 0
+ || TYPE_NAME (type) == 0)
+ && (code == TYPE_CODE_FUNC
|| code == TYPE_CODE_METHOD
|| code == TYPE_CODE_ARRAY
- || code == TYPE_CODE_REF)))
+ || ((code == TYPE_CODE_PTR
+ || code == TYPE_CODE_REF)
+ && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC
+ || (TYPE_CODE (TYPE_TARGET_TYPE (type))
+ == TYPE_CODE_METHOD)
+ || (TYPE_CODE (TYPE_TARGET_TYPE (type))
+ == TYPE_CODE_ARRAY))))))
fputs_filtered (" ", stream);
f_type_print_varspec_prefix (type, stream, show, 0);
@@ -222,7 +229,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
case TYPE_CODE_REF:
f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 1, 0,
arrayprint_recurse_level);
- fprintf_filtered (stream, ")");
+ fprintf_filtered (stream, " )");
break;
case TYPE_CODE_FUNC:
@@ -232,7 +239,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
passed_a_ptr, 0, arrayprint_recurse_level);
if (passed_a_ptr)
- fprintf_filtered (stream, ")");
+ fprintf_filtered (stream, ") ");
fprintf_filtered (stream, "(");
if (nfields == 0 && TYPE_PROTOTYPED (type))
f_print_type (builtin_f_type (get_type_arch (type))->builtin_void,