public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb/fortran: Print 'void' type in lower case
@ 2019-04-30 12:08 Andrew Burgess
  0 siblings, 0 replies; only message in thread
From: Andrew Burgess @ 2019-04-30 12:08 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bbe75b9d00cc6f0694ff26569505c349d55e35f1

commit bbe75b9d00cc6f0694ff26569505c349d55e35f1
Author: Andrew Burgess <andrew.burgess@embecosm.com>
Date:   Sat Feb 16 16:39:29 2019 +0000

    gdb/fortran: Print 'void' type in lower case
    
    For a program compiled with gfortran the base type names are written
    as lower cases in the DWARF, and so GDB will display them as lower
    case.  Additionally, in most places where GDB supplies its own type
    names (for example all of the types defined in f-lang.c in
    `build_fortran_types`), the type names are all lower case.
    
    An exception to this is where GDB prints the void type for Fortran.
    In this case GDB uses upper case.
    
    I'm not aware of any reason why this type should merit special
    attention, and it looks our of place when printing types, so this
    commit changes from 'VOID' to 'void' to match all the other types.
    
    gdb/ChangeLog:
    
    	* f-lang.c (build_fortran_types): Change name of void type to
    	lower case.
    	* f-typeprint.c (f_type_print_base): Print the name of the void
    	type, rather than a fixed string.
    	* f-valprint.c (f_decorations): Use lower case void string.
    
    gdb/testsuite/ChangeLog:
    
    	* gdb.fortran/exprs.exp (test_convenience_variables): Expect lower
    	case void string.

Diff:
---
 gdb/ChangeLog                       | 8 ++++++++
 gdb/f-lang.c                        | 2 +-
 gdb/f-typeprint.c                   | 6 +++++-
 gdb/f-valprint.c                    | 2 +-
 gdb/testsuite/ChangeLog             | 5 +++++
 gdb/testsuite/gdb.fortran/exprs.exp | 2 +-
 6 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2ccda00..f0e1520 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,4 +1,12 @@
 2019-04-30  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+	* f-lang.c (build_fortran_types): Change name of void type to
+	lower case.
+	* f-typeprint.c (f_type_print_base): Print the name of the void
+	type, rather than a fixed string.
+	* f-valprint.c (f_decorations): Use lower case void string.
+
+2019-04-30  Andrew Burgess  <andrew.burgess@embecosm.com>
 	    Chris January  <chris.january@arm.com>
 
 	* dwarf2read.c (dwarf2_init_complex_target_type): Use different
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index cc4e154..9da6fdb 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -689,7 +689,7 @@ build_fortran_types (struct gdbarch *gdbarch)
     = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct builtin_f_type);
 
   builtin_f_type->builtin_void
-    = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "VOID");
+    = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void");
 
   builtin_f_type->builtin_character
     = arch_type (gdbarch, TYPE_CODE_CHAR, TARGET_CHAR_BIT, "character");
diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
index a0e34b3..26ea901 100644
--- a/gdb/f-typeprint.c
+++ b/gdb/f-typeprint.c
@@ -328,7 +328,11 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
       break;
 
     case TYPE_CODE_VOID:
-      fprintfi_filtered (level, stream, "VOID");
+      {
+	gdbarch *gdbarch = get_type_arch (type);
+	struct type *void_type = builtin_f_type (gdbarch)->builtin_void;
+	fprintfi_filtered (level, stream, "%s", TYPE_NAME (void_type));
+      }
       break;
 
     case TYPE_CODE_UNDEF:
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index 37b0ed5..264416e 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -199,7 +199,7 @@ static const struct generic_val_print_decorations f_decorations =
   ")",
   ".TRUE.",
   ".FALSE.",
-  "VOID",
+  "void",
   "{",
   "}"
 };
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 5bbf151..23047c1 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,10 @@
 2019-04-30  Andrew Burgess  <andrew.burgess@embecosm.com>
 
+	* gdb.fortran/exprs.exp (test_convenience_variables): Expect lower
+	case void string.
+
+2019-04-30  Andrew Burgess  <andrew.burgess@embecosm.com>
+
 	* gdb.fortran/complex.exp: Expand.
 	* gdb.fortran/complex.f: Renamed to...
 	* gdb.fortran/complex.f90: ...this, and extended to add more
diff --git a/gdb/testsuite/gdb.fortran/exprs.exp b/gdb/testsuite/gdb.fortran/exprs.exp
index 3b24f7c..8649d0b 100644
--- a/gdb/testsuite/gdb.fortran/exprs.exp
+++ b/gdb/testsuite/gdb.fortran/exprs.exp
@@ -141,7 +141,7 @@ proc test_convenience_variables {} {
     gdb_test "print (\$foo = 32) + 4"	" = 36" \
 	"Use convenience variable assignment in arithmetic expression"
 
-    gdb_test "print \$bar"		" = VOID" \
+    gdb_test "print \$bar"		" = void" \
 	"Print contents of uninitialized convenience variable"
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-04-30 12:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-30 12:08 [binutils-gdb] gdb/fortran: Print 'void' type in lower case Andrew Burgess

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).