From patchwork Thu Jun 17 13:01:01 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 56040 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 3E700B7D61 for ; Thu, 17 Jun 2010 23:01:04 +1000 (EST) Received: (qmail 19901 invoked by alias); 17 Jun 2010 13:00:58 -0000 Received: (qmail 19872 invoked by uid 22791); 17 Jun 2010 13:00:53 -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; Thu, 17 Jun 2010 13:00:46 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id AE5CCCB0287; Thu, 17 Jun 2010 15:00:51 +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 t5-BTF5e7Dho; Thu, 17 Jun 2010 15:00:51 +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 9AA41CB020E; Thu, 17 Jun 2010 15:00:51 +0200 (CEST) Received: by saumur.act-europe.fr (Postfix, from userid 525) id 863DCD9AB0; Thu, 17 Jun 2010 15:01:01 +0200 (CEST) Date: Thu, 17 Jun 2010 15:01:01 +0200 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Vincent Celier Subject: [Ada] Relax library dir checks for externally built library projects Message-ID: <20100617130101.GA29729@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 When a library project is externally built, the different directories (library directory, library ALI directory, library copy source directory) may be any directory. The test for this is to have an externally built directory with the library directory and the library copy source directory set to ".". There should be no error from the Project Manager. project Prj is for Library_Name use "prj"; for Library_Dir use "."; for Library_Src_Dir use "."; for Externally_Built use "True"; end Prj; Tested on x86_64-pc-linux-gnu, committed on trunk 2010-06-17 Vincent Celier * prj-nmsc.adb (Check_Library_Attributes): Allow the different directories associated with a library to be any directory when the library project is externally built. Index: prj-nmsc.adb =================================================================== --- prj-nmsc.adb (revision 160834) +++ prj-nmsc.adb (working copy) @@ -3631,99 +3631,103 @@ package body Prj.Nmsc is "library directory { does not exist", Lib_Dir.Location, Project); + elsif not Project.Externally_Built then + -- The library directory cannot be the same as the Object -- directory. - elsif Project.Library_Dir.Name = Project.Object_Directory.Name then - Error_Msg - (Data.Flags, - "library directory cannot be the same " & - "as object directory", - Lib_Dir.Location, Project); - Project.Library_Dir := No_Path_Information; + if Project.Library_Dir.Name = Project.Object_Directory.Name then + Error_Msg + (Data.Flags, + "library directory cannot be the same " & + "as object directory", + Lib_Dir.Location, Project); + Project.Library_Dir := No_Path_Information; - else - declare - OK : Boolean := True; - Dirs_Id : String_List_Id; - Dir_Elem : String_Element; - Pid : Project_List; + else + declare + OK : Boolean := True; + Dirs_Id : String_List_Id; + Dir_Elem : String_Element; + Pid : Project_List; - begin - -- The library directory cannot be the same as a source - -- directory of the current project. + begin + -- The library directory cannot be the same as a source + -- directory of the current project. - Dirs_Id := Project.Source_Dirs; - while Dirs_Id /= Nil_String loop - Dir_Elem := Data.Tree.String_Elements.Table (Dirs_Id); - Dirs_Id := Dir_Elem.Next; + Dirs_Id := Project.Source_Dirs; + while Dirs_Id /= Nil_String loop + Dir_Elem := Data.Tree.String_Elements.Table (Dirs_Id); + Dirs_Id := Dir_Elem.Next; - if Project.Library_Dir.Name = - Path_Name_Type (Dir_Elem.Value) - then - Err_Vars.Error_Msg_File_1 := - File_Name_Type (Dir_Elem.Value); - Error_Msg - (Data.Flags, - "library directory cannot be the same " & - "as source directory {", - Lib_Dir.Location, Project); - OK := False; - exit; - end if; - end loop; + if Project.Library_Dir.Name = + Path_Name_Type (Dir_Elem.Value) + then + Err_Vars.Error_Msg_File_1 := + File_Name_Type (Dir_Elem.Value); + Error_Msg + (Data.Flags, + "library directory cannot be the same " & + "as source directory {", + Lib_Dir.Location, Project); + OK := False; + exit; + end if; + end loop; - if OK then + if OK then - -- The library directory cannot be the same as a source - -- directory of another project either. + -- The library directory cannot be the same as a + -- source directory of another project either. - Pid := Data.Tree.Projects; - Project_Loop : loop - exit Project_Loop when Pid = null; - - if Pid.Project /= Project then - Dirs_Id := Pid.Project.Source_Dirs; - - Dir_Loop : while Dirs_Id /= Nil_String loop - Dir_Elem := - Data.Tree.String_Elements.Table (Dirs_Id); - Dirs_Id := Dir_Elem.Next; + Pid := Data.Tree.Projects; + Project_Loop : loop + exit Project_Loop when Pid = null; - if Project.Library_Dir.Name = - Path_Name_Type (Dir_Elem.Value) - then - Err_Vars.Error_Msg_File_1 := - File_Name_Type (Dir_Elem.Value); - Err_Vars.Error_Msg_Name_1 := Pid.Project.Name; + if Pid.Project /= Project then + Dirs_Id := Pid.Project.Source_Dirs; - Error_Msg - (Data.Flags, - "library directory cannot be the same " & - "as source directory { of project %%", - Lib_Dir.Location, Project); - OK := False; - exit Project_Loop; - end if; - end loop Dir_Loop; - end if; + Dir_Loop : while Dirs_Id /= Nil_String loop + Dir_Elem := + Data.Tree.String_Elements.Table (Dirs_Id); + Dirs_Id := Dir_Elem.Next; + + if Project.Library_Dir.Name = + Path_Name_Type (Dir_Elem.Value) + then + Err_Vars.Error_Msg_File_1 := + File_Name_Type (Dir_Elem.Value); + Err_Vars.Error_Msg_Name_1 := + Pid.Project.Name; + + Error_Msg + (Data.Flags, + "library directory cannot be the same" & + " as source directory { of project %%", + Lib_Dir.Location, Project); + OK := False; + exit Project_Loop; + end if; + end loop Dir_Loop; + end if; - Pid := Pid.Next; - end loop Project_Loop; - end if; + Pid := Pid.Next; + end loop Project_Loop; + end if; - if not OK then - Project.Library_Dir := No_Path_Information; + if not OK then + Project.Library_Dir := No_Path_Information; - elsif Current_Verbosity = High then + elsif Current_Verbosity = High then - -- Display the Library directory in high verbosity + -- Display the Library directory in high verbosity - Write_Attr - ("Library directory", - Get_Name_String (Project.Library_Dir.Display_Name)); - end if; - end; + Write_Attr + ("Library directory", + Get_Name_String (Project.Library_Dir.Display_Name)); + end if; + end; + end if; end if; end if; @@ -3811,8 +3815,9 @@ package body Prj.Nmsc is Lib_ALI_Dir.Location, Project); end if; - if Project.Library_ALI_Dir /= Project.Library_Dir then - + if (not Project.Externally_Built) and then + Project.Library_ALI_Dir /= Project.Library_Dir + then -- The library ALI directory cannot be the same as the -- Object directory.