From patchwork Thu Jan 3 11:13:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 209220 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 D229C2C008F for ; Thu, 3 Jan 2013 22:13:19 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1357816400; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=Jr225JG9+PQ1IZ2zNIFc blLe7gc=; b=ElqKHpk+K3I045klJ+1E9HB9UQib9S/DNqV4i/qPajNJ9EqqhwsS VC39tPFyQtUWEgy0OsRxPWaOeSiVZWyE1Se11+XL01PHj+U7CdK3C2z6lZvsM2aF bDoOXAF4VTSFqdP8O6KIH7SDVFUsMES7azhDBeovnIqHiTYCr1Q1Gts= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=L8U0LBgbOF0RxRlPQA/9lG5MGG5G5feLOyFQJgLEmuLg1+YyVsWHapWuuRVi9u AivUHehRdlaeyrZtjXGTtFrA8+AyYmJnv9fr4c8vbqmss5W4dkagbxSpQt44E7UE bSRPudT/BZ9PupXSG01GRV6LFZLbsE9Bl+a2HhSDO4ZOk=; Received: (qmail 8613 invoked by alias); 3 Jan 2013 11:13:08 -0000 Received: (qmail 8601 invoked by uid 22791); 3 Jan 2013 11:13:07 -0000 X-SWARE-Spam-Status: No, hits=-0.4 required=5.0 tests=AWL, BAYES_50, RCVD_IN_HOSTKARMA_NO, TW_TP 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; Thu, 03 Jan 2013 11:13:01 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 8B7861C64E8; Thu, 3 Jan 2013 06:13:00 -0500 (EST) 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 VQ3RbXTvIDvZ; Thu, 3 Jan 2013 06:13:00 -0500 (EST) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 721591C64D4; Thu, 3 Jan 2013 06:13:00 -0500 (EST) Received: by kwai.gnat.com (Postfix, from userid 4192) id 70FED3FF09; Thu, 3 Jan 2013 06:13:00 -0500 (EST) Date: Thu, 3 Jan 2013 06:13:00 -0500 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Vincent Celier Subject: [Ada] GNAT driver with a project file and a single main - switches Message-ID: <20130103111300.GA27599@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 When the GNAT driver is called with a project file and a single main specified as an absolute path, the specific switches that are declared for the main source were not taken into account. This patch fixes this. The specific switches are now taken into account. Example: prj.gpr: project Prj is package Pretty_Printer is for Default_Switches ("Ada") use ("-nD"); for Switches ("pkg.ads") use ("-kU"); end Pretty_Printer; end Prj; Invoking "gnat pretty -P prj.gpr /path/to/pkg.ads" should result in gnatpp invoked with -aU, not -nD. Tested on x86_64-pc-linux-gnu, committed on trunk 2013-01-03 Vincent Celier * gnatcmd.adb (GNATCmd): If a single main has been specified as an absolute path, use its simple file name to find specific switches, instead of the absolute path. Index: gnatcmd.adb =================================================================== --- gnatcmd.adb (revision 194841) +++ gnatcmd.adb (working copy) @@ -1999,7 +1999,19 @@ In_Arrays => Element.Decl.Arrays, Shared => Project_Tree.Shared); Name_Len := 0; - Add_Str_To_Name_Buffer (Main.all); + + -- If the single main has been specified as an absolute + -- path, we use only the simple file name. If the + -- absolute path is incorrect, an error will be reported + -- by the underlying tool and it does not make a + -- difference what switches are used. + + if Is_Absolute_Path (Main.all) then + Add_Str_To_Name_Buffer (File_Name (Main.all)); + else + Add_Str_To_Name_Buffer (Main.all); + end if; + The_Switches := Prj.Util.Value_Of (Index => Name_Find, Src_Index => 0,