gdb/fortran: Update rules for printing whitespace in types
[deliverable/binutils-gdb.git] / gdb / f-typeprint.c
index 0329e50fd0b60675f3e90eee263b66878d4a1639..66a450a65c7f3dfa4c7629539319a848fb841181 100644 (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);
 
@@ -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,
This page took 0.028666 seconds and 4 git commands to generate.