[RFC] Fortran-intern "tree browser"

Tobias Schlüter Tobias.Schlueter@physik.uni-muenchen.de
Wed Sep 3 16:03:00 GMT 2008


Steve Kargl wrote:
> On Wed, Sep 03, 2008 at 05:16:00PM +0200, Tobias Schl?ter wrote:
>> Daniel Kraft wrote:
>>> I'm just in the middle of a debugging-session for PR 37099, and find it 
>>> somewhat tedious to analyse the gfortran-internal trees (mostly 
>>> gfc_expr) via gdb's print dump.  Especially wide-character strings and 
>>> things like gmp-constants are quite hard to figure out by hand...
>> It should be possible to call gfc_show_expr() and the like from the 
>> debugger.  At least I put a patch into the tree for exactly this 
>> purpose.  This should address most of your ideas.
>>
> 
> It appears someone (un)fixed your changed.
> 
> mobile:kargl[214] grep gfc_show_expr *c
> mobile:kargl[215] grep -2 -E ^show_expr *c
> dump-parse-tree.c-
> dump-parse-tree.c-static void
> dump-parse-tree.c:show_expr (gfc_expr *p)
> dump-parse-tree.c-{
> 
> Checking ChangeLog, no one appears to own up to this change.

This is the change:

Tobias.Schlueter@zuppc13 fortran$ hg diff -r 86622 -r 86623 ChangeLog
diff -r f2b208733b7c -r 1418ab3a8e22 gcc/fortran/ChangeLog
--- a/gcc/fortran/ChangeLog     Sun Apr 06 10:22:23 2008 +0000
+++ b/gcc/fortran/ChangeLog     Sun Apr 06 12:17:33 2008 +0000
@@ -1,3 +1,18 @@ 2008-04-05  Jerry DeLisle  <jvdelisle@gc
+2008-04-06  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+
+       * dump-parse-tree.c: Use fprintf, fputs and fputc instead of
+       gfc_status and gfc_status_char. Remove gfc_ prefix of the gfc_show_*
+       functions and make them static. Add new gfc_dump_parse_tree
+       function.
+       * gfortran.h (gfc_option_t): Rename verbose into dump_parse_tree.
+       (gfc_status, gfc_status_char): Delete prototypes.
+       * error.c (gfc_status, gfc_status_char): Remove functions.
+       * scanner.c (gfc_new_file): Use printf instead of gfc_status.
+       * options.c (gfc_init_options): Rename verbose into dump_parse_tree.
+       (gfc_handle_module_path_options): Use gfc_fatal_error instead of
+       gfc_status and exit.
+       (gfc_handle_option): Rename verbose into dump_parse_tree.
+

A cursory search didn't review where those function were made 
non-static.  (For the historically interested: originally these 
functions were spread out over the various source files as a sort of 
documentation, during the move into gcc's tree Steven collected them 
into dump-parse-tree.c and made them static, I made them non-static 
again, FX reverted this change, probably there are a few more iterations 
to come unless we add a comment why they're static or not.)

Cheers,
- Tobi



More information about the Fortran mailing list