]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/fortran: Print 'void' type in lower case
authorAndrew Burgess <andrew.burgess@embecosm.com>
Sat, 16 Feb 2019 16:39:29 +0000 (16:39 +0000)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Tue, 30 Apr 2019 09:17:01 +0000 (10:17 +0100)
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.

gdb/ChangeLog
gdb/f-lang.c
gdb/f-typeprint.c
gdb/f-valprint.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.fortran/exprs.exp

index 2ccda008f067a6e388239b6f0e3e07963544405f..f0e152006a5ed9936d82f6fa0a78253bd82715f2 100644 (file)
@@ -1,3 +1,11 @@
+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>
 
index cc4e154f47ab4450f4ddb75e2e7cf9848994688f..9da6fdb3e1c35744ac9dc6fc48f84b2ca769a1ad 100644 (file)
@@ -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");
index a0e34b3058ddcc6b67560999b19b19cfaf221f70..26ea90141358d8c107f8e92156a20f1ae10e4ae6 100644 (file)
@@ -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:
index 37b0ed5176de88f3d9817705d8051acc2795035b..264416ec5408e1c763ad40b21af7c8966d854a6d 100644 (file)
@@ -199,7 +199,7 @@ static const struct generic_val_print_decorations f_decorations =
   ")",
   ".TRUE.",
   ".FALSE.",
-  "VOID",
+  "void",
   "{",
   "}"
 };
index 5bbf15185e2f8a4a30da7cb6424ab1c8d088a37e..23047c155baa1ab40ad0afc1c6e381cb41162ff9 100644 (file)
@@ -1,3 +1,8 @@
+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.
index 3b24f7c135ff2aefeb56af3b0da2710f4aacbb91..8649d0b246dbfaa0544fd314130b99344e7b4201 100644 (file)
@@ -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"
 }