diff mbox

[Fortran] Extend BLOCK dump-parse-tree support and handle ASSOCIATE

Message ID 4C2704F0.8080205@domob.eu
State New
Headers show

Commit Message

Daniel Kraft June 27, 2010, 7:59 a.m. UTC
Hi all,

Thomas' patch about dump-parse-tree support for BLOCK got me started on 
dump-parse-tree for ASSOCIATE; so here it is.  I also made 
show_namespace honour the value of show_level which has the effect that 
the code of inner namespaces (like BLOCK but also contained procedures) 
is now correctly intended and looks better (in my opinion at least).

Regression-testing on GNU/Linux-x86-32 at the moment.  Ok for trunk if 
no failures?

Yours,
Daniel

PS: Next step will be gfc-internals for BLOCK and ASSOCIATE, and with 
next Saturday my holidays finally start so I can really devote my time 
to gfortran :)

Comments

Tobias Burnus June 27, 2010, 8 a.m. UTC | #1
Daniel Kraft wrote:
> Regression-testing on GNU/Linux-x86-32 at the moment.  Ok for trunk if
> no failures?
OK. Thanks for the patch!

Tobias
Daniel Kraft June 27, 2010, 8:45 a.m. UTC | #2
Tobias Burnus wrote:
> Daniel Kraft wrote:
>> Regression-testing on GNU/Linux-x86-32 at the moment.  Ok for trunk if
>> no failures?
> OK. Thanks for the patch!

Committed revision 161460.

Thanks for the review!

Daniel
diff mbox

Patch

Index: gcc/fortran/dump-parse-tree.c
===================================================================
--- gcc/fortran/dump-parse-tree.c	(revision 161453)
+++ gcc/fortran/dump-parse-tree.c	(working copy)
@@ -796,6 +796,15 @@  show_symbol (gfc_symbol *sym)
 
   fprintf (dumpfile, "symbol %s ", sym->name);
   show_typespec (&sym->ts);
+
+  /* If this symbol is an associate-name, show its target expression.  */
+  if (sym->assoc)
+    {
+      fputs (" => ", dumpfile);
+      show_expr (sym->assoc->target);
+      fputs (" ", dumpfile);
+    }
+
   show_attr (&sym->attr);
 
   if (sym->value)
@@ -1378,13 +1387,20 @@  show_code_node (int level, gfc_code *c)
       break;
 
     case EXEC_BLOCK:
-      show_indent ();
-      fputs ("BLOCK ", dumpfile);
-      ns = c->ext.block.ns;
-      show_namespace (ns);
-      show_indent ();
-      fputs ("END BLOCK ", dumpfile);
-      break;
+      {
+	const char* blocktype;
+	if (c->ext.block.assoc)
+	  blocktype = "ASSOCIATE";
+	else
+	  blocktype = "BLOCK";
+	show_indent ();
+	fprintf (dumpfile, "%s ", blocktype);
+	ns = c->ext.block.ns;
+	show_namespace (ns);
+	show_indent ();
+	fprintf (dumpfile, "END %s ", blocktype);
+	break;
+      }
 
     case EXEC_SELECT:
       d = c->block;
@@ -2156,7 +2172,7 @@  show_namespace (gfc_namespace *ns)
   fputc ('\n', dumpfile);
   fputc ('\n', dumpfile);
 
-  show_code (0, ns->code);
+  show_code (show_level, ns->code);
 
   for (ns = ns->contained; ns; ns = ns->sibling)
     {