diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-05-21 17:35:51 +0100 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-09-19 09:48:35 +0100 |
commit | c8d5abea3d9ad20efb2198ec1b639b8e4dc4d8d3 (patch) | |
tree | 0cd187dc483e428bb5fdfc9d4f643433acdc2757 /gdb/f-valprint.c | |
parent | 6d81691950f8c4be4a49a85a672255c140e82468 (diff) | |
download | gdb-c8d5abea3d9ad20efb2198ec1b639b8e4dc4d8d3.zip gdb-c8d5abea3d9ad20efb2198ec1b639b8e4dc4d8d3.tar.gz gdb-c8d5abea3d9ad20efb2198ec1b639b8e4dc4d8d3.tar.bz2 |
gdb/fortran: Change whitespace when printing arrays
This commit makes the whitespace usage when printing Fortran arrays
more consistent, and more inline with how we print C arrays.
Currently a 2 dimensional Fotran array is printed like this, I find
the marked whitespace unpleasant:
(( 1, 2, 3) ( 4, 5, 6) )
^ ^ ^
After this commit the same array is printed like this:
((1, 2, 3) (4, 5, 6))
Which seems more inline with how we print C arrays, in the case of C
arrays we don't add extra whitespace before the first element.
gdb/ChangeLog:
* f-valprint.c (f77_print_array_1): Adjust printing of whitespace
for arrays.
gdb/testsuite/ChangeLog:
* gdb.fortran/array-slices.exp: Update expected results.
* gdb.fortran/class-allocatable-array.exp: Likewise.
* gdb.fortran/multi-dim.exp: Likewise.
* gdb.fortran/vla-type.exp: Likewise.
* gdb.mi/mi-vla-fortran.exp: Likewise.
Diffstat (limited to 'gdb/f-valprint.c')
-rw-r--r-- | gdb/f-valprint.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index b58e10b..e7dc20d 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -137,14 +137,17 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type, (TYPE_TARGET_TYPE (type), value_contents_for_printing_const (val) + offs, addr + offs); - fprintf_filtered (stream, "( "); + fprintf_filtered (stream, "("); f77_print_array_1 (nss + 1, ndimensions, value_type (subarray), value_contents_for_printing (subarray), value_embedded_offset (subarray), value_address (subarray), stream, recurse, subarray, options, elts); offs += byte_stride; - fprintf_filtered (stream, ") "); + fprintf_filtered (stream, ")"); + + if (i < upperbound) + fprintf_filtered (stream, " "); } if (*elts >= options->print_max && i < upperbound) fprintf_filtered (stream, "..."); |