public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch, fortran, committed] Allow dumping of code in Fortran syntax tree
@ 2016-11-14 18:18 Thomas Koenig
  0 siblings, 0 replies; only message in thread
From: Thomas Koenig @ 2016-11-14 18:18 UTC (permalink / raw)
  To: fortran, gcc-patches

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

Hello world,

I have just committed the attached patch as obvious.  No test case,
the function is only supposed to be called when debugging the
compiler itself.

Regards

	Thomas

2016-11-14  Thomas Koenig  <tkoenig@gcc.gnu.org>

	* dump-parse-tree.c (show_code):  Add prototype.
	(gfc_debug_code):  New function.
	(show_code_node):  Add space after SELECT TYPE.


[-- Attachment #2: p1.diff --]
[-- Type: text/x-patch, Size: 1141 bytes --]

Index: dump-parse-tree.c
===================================================================
--- dump-parse-tree.c	(Revision 242335)
+++ dump-parse-tree.c	(Arbeitskopie)
@@ -47,6 +47,7 @@ static FILE *dumpfile;
 static void show_expr (gfc_expr *p);
 static void show_code_node (int, gfc_code *);
 static void show_namespace (gfc_namespace *ns);
+static void show_code (int, gfc_code *);
 
 
 /* Allow dumping of an expression in the debugger.  */
@@ -62,7 +63,19 @@ gfc_debug_expr (gfc_expr *e)
   dumpfile = tmp;
 }
 
+/* Allow for dumping of a piece of code in the debugger.  */
+void gfc_debug_code (gfc_code *c);
 
+void
+gfc_debug_code (gfc_code *c)
+{
+  FILE *tmp = dumpfile;
+  dumpfile = stderr;
+  show_code (1, c);
+  fputc ('\n', dumpfile);
+  dumpfile = tmp;
+}
+
 /* Do indentation for a specific level.  */
 
 static inline void
@@ -1987,7 +2000,7 @@ show_code_node (int level, gfc_code *c)
     case EXEC_SELECT_TYPE:
       d = c->block;
       if (c->op == EXEC_SELECT_TYPE)
-	fputs ("SELECT TYPE", dumpfile);
+	fputs ("SELECT TYPE ", dumpfile);
       else
 	fputs ("SELECT CASE ", dumpfile);
       show_expr (c->expr1);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-11-14 18:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-14 18:18 [patch, fortran, committed] Allow dumping of code in Fortran syntax tree Thomas Koenig

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).