public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [tuples][patch] fix the pretty-print for try .. (except|finally)
@ 2008-05-01 16:01 Rafael Espindola
  2008-05-01 16:03 ` Diego Novillo
  0 siblings, 1 reply; 2+ messages in thread
From: Rafael Espindola @ 2008-05-01 16:01 UTC (permalink / raw)
  To: gcc-patches; +Cc: Diego Novillo

[-- Attachment #1: Type: text/plain, Size: 268 bytes --]

With the attached patch, try .. except and try .. finally are now
printed like in trunk.

OK for tuples?

Cheers,
-- 
Rafael Avila de Espindola

Google Ireland Ltd.
Gordon House
Barrow Street
Dublin 4
Ireland

Registered in Dublin, Ireland
Registration Number: 368047

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: print-try.patch --]
[-- Type: text/x-patch; name=print-try.patch, Size: 2235 bytes --]

Index: gcc/gimple-pretty-print.c
===================================================================
--- gcc/gimple-pretty-print.c	(revision 134856)
+++ gcc/gimple-pretty-print.c	(working copy)
@@ -577,6 +577,7 @@
 	}
     }
   pp_newline (buffer);
+  pp_newline (buffer);
   dump_gimple_seq (buffer, gimple_bind_body (gs), spc + 2, flags);
   INDENT (spc);
   if (flags & TDF_RAW)
@@ -608,21 +609,37 @@
     }
   else
     {
-      pp_string (buffer, "try {");
-
+      pp_string (buffer, "try");
       newline_and_indent (buffer, spc + 2);
-      dump_gimple_seq (buffer, gimple_try_eval (gs), spc + 2, flags);
-      newline_and_indent (buffer, spc);
+      pp_string (buffer, "{");
+      pp_newline (buffer);
 
+      dump_gimple_seq (buffer, gimple_try_eval (gs), spc + 4, flags);
+
       if (gimple_try_kind (gs) == GIMPLE_TRY_CATCH)
-        pp_string (buffer, "} catch {");
+	{
+	  INDENT (spc + 2);
+	  pp_string (buffer, "}");
+	  newline_and_indent (buffer, spc);
+	  pp_string (buffer, "catch");
+	  newline_and_indent (buffer, spc + 2);
+	  pp_string (buffer, "{");
+	}
       else if (gimple_try_kind (gs) == GIMPLE_TRY_FINALLY)
-        pp_string (buffer, "} finally {");
+	{
+	  INDENT (spc + 2);
+	  pp_string (buffer, "}");
+	  newline_and_indent (buffer, spc);
+	  pp_string (buffer, "finally");
+	  newline_and_indent (buffer, spc + 2);
+	  pp_string (buffer, "{");
+	}
       else
-        pp_string (buffer, "} <UNKNOWN GIMPLE_TRY> {");
-      newline_and_indent (buffer, spc + 2);
-      dump_gimple_seq (buffer, gimple_try_cleanup (gs), spc + 2, flags);
-      newline_and_indent (buffer, spc);
+	pp_string (buffer, "} <UNKNOWN GIMPLE_TRY> {");
+
+      pp_newline (buffer);
+      dump_gimple_seq (buffer, gimple_try_cleanup (gs), spc + 4, flags);
+      INDENT (spc + 2);
       pp_character (buffer, '}');
     }
 }
@@ -639,7 +656,7 @@
       dump_gimple_fmt (buffer, spc, flags, "%G <%T, %+CATCH <%S>%->", gs,
                        gimple_catch_types (gs), gimple_catch_handler (gs));
   else
-      dump_gimple_fmt (buffer, spc, flags, "catch (%T) {%S}",
+      dump_gimple_fmt (buffer, spc, flags, "catch (%T)%+{%S}",
                        gimple_catch_types (gs), gimple_catch_handler (gs));
 }
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [tuples][patch] fix the pretty-print for try .. (except|finally)
  2008-05-01 16:01 [tuples][patch] fix the pretty-print for try .. (except|finally) Rafael Espindola
@ 2008-05-01 16:03 ` Diego Novillo
  0 siblings, 0 replies; 2+ messages in thread
From: Diego Novillo @ 2008-05-01 16:03 UTC (permalink / raw)
  To: Rafael Espindola; +Cc: gcc-patches

On Thu, May 1, 2008 at 12:01, Rafael Espindola <espindola@google.com> wrote:

> OK for tuples?

OK, but it needs a ChangeLog (better to include the CL entries in the
patches you send for review).


Diego.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-05-01 16:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-01 16:01 [tuples][patch] fix the pretty-print for try .. (except|finally) Rafael Espindola
2008-05-01 16:03 ` Diego Novillo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).