From patchwork Tue Oct 5 09:16:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 66773 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 68E4CB6F0D for ; Tue, 5 Oct 2010 20:16:48 +1100 (EST) Received: (qmail 7266 invoked by alias); 5 Oct 2010 09:16:43 -0000 Received: (qmail 7251 invoked by uid 22791); 5 Oct 2010 09:16:42 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, 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:16:37 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id CD5C6CB0268; Tue, 5 Oct 2010 11:16:35 +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 j-egaMT-11ld; Tue, 5 Oct 2010 11:16:35 +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 B7C4BCB024C; Tue, 5 Oct 2010 11:16:35 +0200 (CEST) Received: by saumur.act-europe.fr (Postfix, from userid 525) id 8F520D9BB5; Tue, 5 Oct 2010 11:16:35 +0200 (CEST) Date: Tue, 5 Oct 2010 11:16:35 +0200 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Vincent Celier Subject: [Ada] gnatmake -gnatc does not always compile bodies Message-ID: <20101005091635.GA17162@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 gnatmake has been invoked with -gnatc for a spec, if invoked later also with -gnatct for the body, will not attempt compilation. This patch ensures that the body is compiled. The test for this is to invoke gnatmake -gnatc on a spec, then on the corresponding body. In both cases the compiler should be invoked. Tested on x86_64-pc-linux-gnu, committed on trunk 2010-10-05 Vincent Celier * make.adb (Check): When compiling with -gnatc, recompile if the ALI file has not been generated for the current source, for example if it has been generated for the spec, but we are compiling the body. Index: make.adb =================================================================== --- make.adb (revision 164942) +++ make.adb (working copy) @@ -1658,6 +1658,32 @@ package body Make is return; end if; + -- When compiling with -gnatc, don't take ALI file into account if + -- it has not been generated for the current source, for example if + -- it has been generated for the spec, but we are compiling the body. + + if Operating_Mode = Check_Semantics then + declare + File_Name : constant String := Get_Name_String (Source_File); + OK : Boolean := False; + + begin + for U in ALIs.Table (ALI).First_Unit .. + ALIs.Table (ALI).Last_Unit + loop + OK := Get_Name_String (Units.Table (U).Sfile) = File_Name; + exit when OK; + end loop; + + if not OK then + Verbose_Msg + (Full_Lib_File, "not generated for the same source"); + ALI := No_ALI_Id; + return; + end if; + end; + end if; + -- Check for matching compiler switches if needed if Check_Switches then