From patchwork Mon Aug 29 09:37:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 112000 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 A01C0B6F8F for ; Mon, 29 Aug 2011 19:37:27 +1000 (EST) Received: (qmail 27649 invoked by alias); 29 Aug 2011 09:37:25 -0000 Received: (qmail 27622 invoked by uid 22791); 29 Aug 2011 09:37:23 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 29 Aug 2011 09:37:08 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 63AF72BB10B; Mon, 29 Aug 2011 05:37:07 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id PvDRtcqjJSh1; Mon, 29 Aug 2011 05:37:07 -0400 (EDT) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 483D32BB109; Mon, 29 Aug 2011 05:37:07 -0400 (EDT) Received: by kwai.gnat.com (Postfix, from userid 4192) id 382B53FEE8; Mon, 29 Aug 2011 05:37:07 -0400 (EDT) Date: Mon, 29 Aug 2011 05:37:07 -0400 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Johannes Kanig Subject: [Ada] Skip frontend when option -gnatd.H is present Message-ID: <20110829093707.GA25559@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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 If the option -gnatd.H is present (Standard Package mode for gnat2why), skip the frontend, except the call to Create_Standard, and call the backend directly. Tested on x86_64-pc-linux-gnu, committed on trunk 2011-08-29 Johannes Kanig * frontend.adb (Frontend): Exit after creating Standard package when -gnatd.H is present. * gnat1drv.adb (Gnat1drv): Call Backend right away when -gnatd.H is present. Index: frontend.adb =================================================================== --- frontend.adb (revision 178155) +++ frontend.adb (working copy) @@ -98,6 +98,12 @@ CStand.Create_Standard; + -- If the -gnatd.H flag is present, we are only interested in the Standard + -- package, so the frontend has done its job here. + if Debug_Flag_Dot_HH then + return; + end if; + -- Check possible symbol definitions specified by -gnateD switches Prepcomp.Process_Command_Line_Symbol_Definitions; Index: gnat1drv.adb =================================================================== --- gnat1drv.adb (revision 178163) +++ gnat1drv.adb (working copy) @@ -771,8 +771,23 @@ Frontend; -- Exit with errors if the main source could not be parsed - + -- Also, when -gnatd.H is present, the source file is not set. if Sinput.Main_Source_File = No_Source_File then + if Debug_Flag_Dot_HH then + -- We lock all the tables to keep the convention that the backend + -- needs to unlock the tables it wants to touch. + Atree.Lock; + Elists.Lock; + Fname.UF.Lock; + Inline.Lock; + Lib.Lock; + Nlists.Lock; + Sem.Lock; + Sinput.Lock; + Namet.Lock; + Stringt.Lock; + Back_End.Call_Back_End (Back_End.Generate_Object); + end if; Errout.Finalize (Last_Call => True); Errout.Output_Messages; Exit_Program (E_Errors);