This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tuples][patch] fix the pretty-print for try .. (except|finally)
- From: "Rafael Espindola" <espindola at google dot com>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Cc: "Diego Novillo" <dnovillo at google dot com>
- Date: Thu, 1 May 2008 17:01:01 +0100
- Subject: [tuples][patch] fix the pretty-print for try .. (except|finally)
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
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));
}