* c-typeprint.c (c_type_print_args): Don't print "void"
authorKeith Seitz <keiths@redhat.com>
Wed, 31 Mar 2010 00:48:29 +0000 (00:48 +0000)
committerKeith Seitz <keiths@redhat.com>
Wed, 31 Mar 2010 00:48:29 +0000 (00:48 +0000)
  for java, regardless of whether it is TYPE_PROTOTYPED.
  Use the passed-in language instead of current_language.
  (c_type_print_varspec_suffix): Use current_language instead
  of assuming language_c.
  * jv-typeprint.c (java_type_print_base): (bz 9320) Strip off
  any return type specifier from the physname.

gdb/ChangeLog
gdb/c-typeprint.c
gdb/jv-typeprint.c

index 8dc87d0432477d4bac822120389083e0062be992..491326cdb28fe52f0a19b386e04dcfc644b4aaa7 100644 (file)
@@ -1,3 +1,13 @@
+2010-03-30  Keith Seitz  <keiths@redhat.com>
+
+       * c-typeprint.c (c_type_print_args): Don't print "void"
+       for java, regardless of whether it is TYPE_PROTOTYPED.
+       Use the passed-in language instead of current_language.
+       (c_type_print_varspec_suffix): Use current_language instead
+       of assuming language_c.
+       * jv-typeprint.c (java_type_print_base): (bz 9320) Strip off
+       any return type specifier from the physname.
+
 2010-03-30  Pedro Alves  <pedro@codesourcery.com>
 
        * tui/tui-interp.c (tui_is_toplevel): New.
index 5cc5f6b6eaaf5cd93a8f76425a9dad30451491c6..68bcbd7fa89868ce312e7703f49128760f58c6a8 100644 (file)
@@ -416,8 +416,8 @@ c_type_print_args (struct type *type, struct ui_file *stream,
        }
     }
   else if (!printed_any
-      && (TYPE_PROTOTYPED (type)
-         || current_language->la_language == language_cplus))
+          && ((TYPE_PROTOTYPED (type) && language != language_java)
+              || language == language_cplus))
     fprintf_filtered (stream, "void");
 
   fprintf_filtered (stream, ")");
@@ -616,7 +616,7 @@ c_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
       if (passed_a_ptr)
        fprintf_filtered (stream, ")");
       if (!demangled_args)
-       c_type_print_args (type, stream, 1, language_c);
+       c_type_print_args (type, stream, 1, current_language->la_language);
       c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, show,
                                   passed_a_ptr, 0);
       break;
index 03b6036f1a0cb0033d816616827d5e555b34f57c..6132576a4fb8c7ecfdd32e3d254b341f9c68cfb4 100644 (file)
@@ -28,6 +28,7 @@
 #include "typeprint.h"
 #include "c-lang.h"
 #include "cp-abi.h"
+#include "gdb_assert.h"
 
 /* Local functions */
 
@@ -219,10 +220,19 @@ java_type_print_base (struct type *type, struct ui_file *stream, int show,
 
              for (j = 0; j < n_overloads; j++)
                {
-                 char *physname;
+                 char *real_physname, *physname, *p;
                  int is_full_physname_constructor;
 
-                 physname = TYPE_FN_FIELD_PHYSNAME (f, j);
+                 real_physname = TYPE_FN_FIELD_PHYSNAME (f, j);
+
+                 /* The physname will contain the return type
+                    after the final closing parenthesis.  Strip it off.  */
+                 p = strrchr (real_physname, ')');
+                 gdb_assert (p != NULL);
+                 ++p;   /* Keep the trailing ')'.  */
+                 physname = alloca (p - real_physname + 1);
+                 memcpy (physname, real_physname, p - real_physname);
+                 physname[p - real_physname] = '\0';
 
                  is_full_physname_constructor
                     = (is_constructor_name (physname)
@@ -268,7 +278,7 @@ java_type_print_base (struct type *type, struct ui_file *stream, int show,
                    /* Build something we can demangle.  */
                    mangled_name = gdb_mangle_name (type, i, j);
                  else
-                   mangled_name = TYPE_FN_FIELD_PHYSNAME (f, j);
+                   mangled_name = physname;
 
                  demangled_name =
                    cplus_demangle (mangled_name,