From patchwork Mon Oct 4 13:43:39 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 66654 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 EB62EB70CC for ; Tue, 5 Oct 2010 00:43:50 +1100 (EST) Received: (qmail 25409 invoked by alias); 4 Oct 2010 13:43:47 -0000 Received: (qmail 25399 invoked by uid 22791); 4 Oct 2010 13:43:46 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, TW_PR, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (212.99.106.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 04 Oct 2010 13:43:42 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 05462CB025E; Mon, 4 Oct 2010 15:43:40 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kvUck-La2yRQ; Mon, 4 Oct 2010 15:43:39 +0200 (CEST) Received: from saumur.act-europe.fr (saumur.act-europe.fr [10.10.0.183]) by mel.act-europe.fr (Postfix) with ESMTP id E67F0CB022B; Mon, 4 Oct 2010 15:43:39 +0200 (CEST) Received: by saumur.act-europe.fr (Postfix, from userid 525) id C8F5ED9BB4; Mon, 4 Oct 2010 15:43:39 +0200 (CEST) Date: Mon, 4 Oct 2010 15:43:39 +0200 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Vincent Celier Subject: [Ada] Do not create object/exec dir for projects with no sources Message-ID: <20101004134339.GA19684@adacore.com> Mime-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.9i X-IsSubscribed: yes 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 For a non extending project that declare no sources, non existent object or exec directories are not created if gnatmake switch -p or --create-missing-dirs is used. Tested on x86_64-pc-linux-gnu, committed on trunk 2010-10-04 Vincent Celier * prj-nmsc.adb (Get_Directories): For non extending projects that declare that they have no sources, do not create a non existing object or exec directory if builder switch -p is used. Index: prj-nmsc.adb =================================================================== --- prj-nmsc.adb (revision 164906) +++ prj-nmsc.adb (working copy) @@ -5280,10 +5280,18 @@ package body Prj.Nmsc is Recursive_Dirs.Reset (Visited); end Find_Source_Dirs; - -- Start of processing for Get_Directories - Dir_Exists : Boolean; + No_Sources : constant Boolean := + (((not Source_Files.Default) and then Source_Files.Values = Nil_String) + or else + ((not Source_Dirs.Default) and then Source_Dirs.Values = Nil_String) + or else + ((not Languages.Default) and then Languages.Values = Nil_String)) + and then Project.Extends = No_Project; + + -- Start of processing for Get_Directories + begin if Current_Verbosity = High then Write_Line ("Starting to look for directories"); @@ -5292,14 +5300,7 @@ package body Prj.Nmsc is -- Set the object directory to its default which may be nil, if there -- is no sources in the project. - if (((not Source_Files.Default) - and then Source_Files.Values = Nil_String) - or else - ((not Source_Dirs.Default) and then Source_Dirs.Values = Nil_String) - or else - ((not Languages.Default) and then Languages.Values = Nil_String)) - and then Project.Extends = No_Project - then + if No_Sources then Project.Object_Directory := No_Path_Information; else Project.Object_Directory := Project.Directory; @@ -5316,7 +5317,7 @@ package body Prj.Nmsc is "Object_Dir cannot be empty", Object_Dir.Location, Project); - else + elsif not No_Sources then -- We check that the specified object directory does exist. -- However, even when it doesn't exist, we set it to a default -- value. This is for the benefit of tools that recover from @@ -5348,9 +5349,7 @@ package body Prj.Nmsc is end if; end if; - elsif Project.Object_Directory /= No_Path_Information - and then Subdirs /= null - then + elsif not No_Sources and then Subdirs /= null then Name_Len := 1; Name_Buffer (1) := '.'; Locate_Directory @@ -5389,7 +5388,7 @@ package body Prj.Nmsc is "Exec_Dir cannot be empty", Exec_Dir.Location, Project); - else + elsif not No_Sources then -- We check that the specified exec directory does exist Locate_Directory