This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gcjx] FYI: Prevent unnecessary recursion in pretty-printer


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

  I have checked the attached patch to the gcjx branch
to prevent unnecessary, and sometimes infinite, recursion
while printing a tree. I discovered this while actually
trying to use dump_tree() to debug a problem.

Thanks,
Ranjit.

- --
Ranjit Mathew       Email: rmathew AT gmail DOT com

Bangalore, INDIA.     Web: http://ranjitmathew.hostingzero.com/




-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDVm6EYb1hx2wRS48RAkfgAJ9+IjrHT1KRkBHPKNN75pCbgZRdEACgp9/x
3TH8yWbYKimbF6K3dqD5S0M=
=v7SQ
-----END PGP SIGNATURE-----
Index: ChangeLog
from  Ranjit Mathew  <rmathew@gcc.gnu.org>

	* dump.cc (pretty_printer::print_method): Do not descend into
	the return type of the method, just print the pretty name.
	(pretty_printer::visit_forwarding_type): Do not descend into
	RES_TYPE, just print the pretty name.
	(pretty_printer::visit_forwarding_resolved): Likewise.

Index: dump.cc
===================================================================
--- dump.cc	2005-10-19 21:23:56.000000000 +0530
+++ dump.cc	2005-10-19 21:24:53.000000000 +0530
@@ -1511,7 +1511,9 @@ protected:
     out << " " << meth->get_name ();
     modifier_t mods = meth->get_modifiers ();
     print_modifiers (mods);
-    descend (meth->get_return_type ());
+    model_type *ret_type = meth->get_return_type ();
+    if (ret_type != NULL)
+      out << " " << ret_type->get_pretty_name ();
     descend (args);
     if (body)
       descend (body.get ());
@@ -2562,7 +2564,8 @@ public:
                               model_type *res_type)
   {
     begin_element (fwd_type, "fwd_type");
-    descend (res_type);
+    if (res_type != NULL)
+      out << " " << res_type->get_pretty_name ();
     end_element ();
   }
 
@@ -2570,7 +2573,8 @@ public:
                                   model_type *res_type)
   {
     begin_element (fwd_resolved, "fwd_type_resolved");
-    descend (res_type);
+    if (res_type != NULL)
+      out << " " << res_type->get_pretty_name ();
     end_element ();
   }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]