Print C++ constructor methods without bogus "return type."
authorPer Bothner <per@bothner.com>
Mon, 27 Jan 1992 03:08:01 +0000 (03:08 +0000)
committerPer Bothner <per@bothner.com>
Mon, 27 Jan 1992 03:08:01 +0000 (03:08 +0000)
gdb/ChangeLog
gdb/valprint.c

index 7b1ace7f26fe5aab39513b6496aa5f9cd85f42a5..4280b8611a3356a0246eba2625b2300f94137e51 100644 (file)
@@ -1,3 +1,8 @@
+Sun Jan 26 19:05:40 1992  Per Bothner  (bothner at cygnus.com)
+
+       * valprint.c (type_print_base, type_print_method_args):
+       Print C++ constructor methods without bogus "return type."
+
 Sat Jan 25 15:57:59 1992  Fred Fish  (fnf at cygnus.com)
 
        * infptrace.c (child_xfer_memory):  Parameter "target" should
index 139679ac4186cc0d7a4575a6a6c6b9dafe9db7a6..b031e16e9ca293d06c79f660639ff5ebf6ecf269 100644 (file)
@@ -1319,7 +1319,6 @@ type_print_method_args (args, prefix, varstring, staticp, stream)
 {
   int i;
 
-  fputs_filtered (" ", stream);
   fputs_demangled (prefix, stream, 1);
   fputs_demangled (varstring, stream, 1);
   fputs_filtered (" (", stream);
@@ -1698,7 +1697,8 @@ type_print_base (type, stream, show, level)
            {
              struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i);
              int j, len2 = TYPE_FN_FIELDLIST_LENGTH (type, i);
-
+             char *method_name = TYPE_FN_FIELDLIST_NAME (type, i);
+             int is_constructor = strcmp(method_name, TYPE_NAME (type)) == 0;
              for (j = 0; j < len2; j++)
                {
                  QUIT;
@@ -1714,20 +1714,24 @@ type_print_base (type, stream, show, level)
                               TYPE_FN_FIELD_PHYSNAME (f, j));
                      break;
                    }
-                 else
-                   type_print (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)), "", stream, 0);
-                 if (TYPE_FLAGS (TYPE_FN_FIELD_TYPE (f, j)) & TYPE_FLAG_STUB)
+                 else if (!is_constructor)
+                   {
+                     type_print (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)),
+                                 "", stream, 0);
+                     fputs_filtered (" ", stream);
+                   }
+                 if (TYPE_FN_FIELD_STUB (f, j))
                    {
                      /* Build something we can demangle.  */
                      char *strchr (), *gdb_mangle_name (), *cplus_demangle ();
                      char *mangled_name = gdb_mangle_name (type, i, j);
                      char *demangled_name = cplus_demangle (mangled_name, 1);
                      if (demangled_name == 0)
-                       fprintf_filtered (stream, " <badly mangled name %s>",
+                       fprintf_filtered (stream, "<badly mangled name %s>",
                            mangled_name);
                      else 
                        {
-                         fprintf_filtered (stream, " %s",
+                         fprintf_filtered (stream, "%s",
                              strchr (demangled_name, ':') + 2);
                          free (demangled_name);
                        }
@@ -1737,11 +1741,11 @@ type_print_base (type, stream, show, level)
                        && TYPE_FN_FIELD_PHYSNAME (f, j)[1] == CPLUS_MARKER)
                    type_print_method_args
                      (TYPE_FN_FIELD_ARGS (f, j) + 1, "~",
-                      TYPE_FN_FIELDLIST_NAME (type, i), 0, stream);
+                      method_name, 0, stream);
                  else
                    type_print_method_args
                      (TYPE_FN_FIELD_ARGS (f, j), "",
-                      TYPE_FN_FIELDLIST_NAME (type, i),
+                      method_name,
                       TYPE_FN_FIELD_STATIC_P (f, j), stream);
 
                  fprintf_filtered (stream, ";\n");