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.
This commit is contained in:
Andrew Burgess 2019-02-17 00:37:20 +00:00
parent bf7a4de172
commit f1fdc96066
7 changed files with 34 additions and 14 deletions

View File

@ -1,3 +1,9 @@
2019-04-30 Andrew Burgess <andrew.burgess@embecosm.com>
* f-typeprint.c (f_print_type): Update rules for printing
whitespace.
(f_type_print_varspec_suffix): Likewise.
2019-04-30 Andrew Burgess <andrew.burgess@embecosm.com>
Chris January <chris.january@arm.com>

View File

@ -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);

View File

@ -1,3 +1,10 @@
2019-04-30 Andrew Burgess <andrew.burgess@embecosm.com>
* 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.
2019-04-30 Andrew Burgess <andrew.burgess@embecosm.com>
* gdb.fortran/ptype-on-functions.exp: New file.