From patchwork Sun Jun 27 07:59:44 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Kraft X-Patchwork-Id: 57083 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id CA2C6B6EF7 for ; Sun, 27 Jun 2010 17:55:10 +1000 (EST) Received: (qmail 31278 invoked by alias); 27 Jun 2010 07:55:07 -0000 Received: (qmail 31259 invoked by uid 22791); 27 Jun 2010 07:55:06 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from tatiana.utanet.at (HELO tatiana.utanet.at) (213.90.36.46) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 27 Jun 2010 07:55:01 +0000 Received: from patricia.xoc.tele2net.at ([213.90.36.9]) by tatiana.utanet.at with esmtp (Exim 4.71) (envelope-from ) id 1OSmhf-0003Jg-1X; Sun, 27 Jun 2010 09:54:59 +0200 Received: from d86-32-12-114.cust.tele2.at ([86.32.12.114] helo=[10.0.0.18]) by patricia.xoc.tele2net.at with esmtpa (Exim 4.71) (envelope-from ) id 1OSmhe-0007ZM-Td; Sun, 27 Jun 2010 09:54:58 +0200 Message-ID: <4C2704F0.8080205@domob.eu> Date: Sun, 27 Jun 2010 09:59:44 +0200 From: Daniel Kraft User-Agent: Thunderbird 2.0.0.0 (X11/20070425) MIME-Version: 1.0 To: Fortran List CC: gcc-patches Subject: [Fortran, Patch] Extend BLOCK dump-parse-tree support and handle ASSOCIATE Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 :) 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) {