From patchwork Tue Oct 5 09:57:43 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 66783 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 C2FE6B70AF for ; Tue, 5 Oct 2010 20:57:58 +1100 (EST) Received: (qmail 16402 invoked by alias); 5 Oct 2010 09:57:52 -0000 Received: (qmail 16332 invoked by uid 22791); 5 Oct 2010 09:57:51 -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; Tue, 05 Oct 2010 09:57:46 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id DDAB4CB026D; Tue, 5 Oct 2010 11:57:43 +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 UQIbJ+pMtQ0q; Tue, 5 Oct 2010 11:57:43 +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 CAE75CB01DF; Tue, 5 Oct 2010 11:57:43 +0200 (CEST) Received: by saumur.act-europe.fr (Postfix, from userid 525) id A7B1DD9BB5; Tue, 5 Oct 2010 11:57:43 +0200 (CEST) Date: Tue, 5 Oct 2010 11:57:43 +0200 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Vincent Celier Subject: [Ada] Child project extending a child project Message-ID: <20101005095743.GA7811@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 Consider the following projects: project A project Ap extends project A project A.B imports project A project Ap.B imports project Ap and extends project A.B Invoking gnatmake on project Ap.B results in an error. This patch ensures that there is no error. The test is to invoke "gnatmake -P ap-b.gpr" Tested on x86_64-pc-linux-gnu, committed on trunk 2010-10-05 Vincent Celier * prj-part.adb (Parse_Simple_Project): When checking if a child project imports its parent project, also look in projects being extended by imported projects. Index: prj-part.adb =================================================================== --- prj-part.adb (revision 164969) +++ prj-part.adb (working copy) @@ -1653,6 +1653,7 @@ package body Prj.Part is Parent_Node : Project_Node_Id := Empty_Node; With_Clause : Project_Node_Id := First_With_Clause_Of (Project, In_Tree); + Imp_Proj_Name : Name_Id; begin -- If there is an extended project, check its name @@ -1666,11 +1667,23 @@ package body Prj.Part is -- If the parent project is not the extended project, -- check each imported project until we find the parent project. + Imported_Loop : while not Parent_Found and then Present (With_Clause) loop Parent_Node := Project_Node_Of (With_Clause, In_Tree); - Parent_Found := Name_Of (Parent_Node, In_Tree) = Parent_Name; + + Extension_Loop : + while Present (Parent_Node) loop + Imp_Proj_Name := Name_Of (Parent_Node, In_Tree); + Parent_Found := Imp_Proj_Name = Parent_Name; + exit Imported_Loop when Parent_Found; + Parent_Node := + Extended_Project_Of + (Project_Declaration_Of (Parent_Node, In_Tree), + In_Tree); + end loop Extension_Loop; + With_Clause := Next_With_Clause_Of (With_Clause, In_Tree); - end loop; + end loop Imported_Loop; if Parent_Found then Set_Parent_Project_Of (Project, In_Tree, To => Parent_Node);