From patchwork Wed Jun 23 06:36:14 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 56594 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 8EDCFB6F11 for ; Wed, 23 Jun 2010 16:36:31 +1000 (EST) Received: (qmail 32394 invoked by alias); 23 Jun 2010 06:36:29 -0000 Received: (qmail 32377 invoked by uid 22791); 23 Jun 2010 06:36:26 -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; Wed, 23 Jun 2010 06:36:12 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 50426CB0249; Wed, 23 Jun 2010 08:36:15 +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 ZLAvpQDbr5Kq; Wed, 23 Jun 2010 08:36:15 +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 36383CB01D4; Wed, 23 Jun 2010 08:36:15 +0200 (CEST) Received: by saumur.act-europe.fr (Postfix, from userid 525) id 2A573D9AB0; Wed, 23 Jun 2010 08:36:14 +0200 (CEST) Date: Wed, 23 Jun 2010 08:36:14 +0200 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Emmanuel Briot Subject: [Ada] new flag to disable some errors when loading projects Message-ID: <20100623063614.GA22344@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 This flag can be used to disable errors when a source file is referenced in the Source_Files attribute, but does not actually exists in the source directories. In particular, this is useful when the project is used in an IDE, where we do not want to force the user to have a fully valid project. Tested on x86_64-pc-linux-gnu, committed on trunk 2010-06-23 Emmanuel Briot * prj.adb, prj.ads, prj-nmsc.adb (Processing_Flags): New flag Missing_Source_Files. Index: prj.adb =================================================================== --- prj.adb (revision 161179) +++ prj.adb (working copy) @@ -1230,7 +1230,8 @@ package body Prj is Compiler_Driver_Mandatory : Boolean := False; Error_On_Unknown_Language : Boolean := True; Require_Obj_Dirs : Error_Warning := Error; - Allow_Invalid_External : Error_Warning := Error) + Allow_Invalid_External : Error_Warning := Error; + Missing_Source_Files : Error_Warning := Error) return Processing_Flags is begin @@ -1242,7 +1243,8 @@ package body Prj is Error_On_Unknown_Language => Error_On_Unknown_Language, Compiler_Driver_Mandatory => Compiler_Driver_Mandatory, Require_Obj_Dirs => Require_Obj_Dirs, - Allow_Invalid_External => Allow_Invalid_External); + Allow_Invalid_External => Allow_Invalid_External, + Missing_Source_Files => Missing_Source_Files); end Create_Flags; ------------ Index: prj.ads =================================================================== --- prj.ads (revision 161088) +++ prj.ads (working copy) @@ -1459,7 +1459,8 @@ package Prj is Compiler_Driver_Mandatory : Boolean := False; Error_On_Unknown_Language : Boolean := True; Require_Obj_Dirs : Error_Warning := Error; - Allow_Invalid_External : Error_Warning := Error) + Allow_Invalid_External : Error_Warning := Error; + Missing_Source_Files : Error_Warning := Error) return Processing_Flags; -- Function used to create Processing_Flags structure -- @@ -1492,6 +1493,10 @@ package Prj is -- If Allow_Invalid_External is Silent, then no error is reported when an -- invalid value is used for an external variable (and it doesn't match its -- type). Instead, the first possible value is used. + -- + -- Missing_Source_Files indicates whether it is an error or a warning that + -- a source file mentioned in the Source_Files attributes is not actually + -- found in the source directories Gprbuild_Flags : constant Processing_Flags; Gprclean_Flags : constant Processing_Flags; @@ -1521,6 +1526,10 @@ package Prj is -- another program running on the same machine has recreated it. -- Does nothing if Debug.Debug_Flag_N is set + Virtual_Prefix : constant String := "v$"; + -- The prefix for virtual extending projects. Because of the '$', which is + -- normally forbidden for project names, there cannot be any name clash. + private All_Packages : constant String_List_Access := null; @@ -1535,10 +1544,6 @@ private Location => No_Location, Default => False); - Virtual_Prefix : constant String := "v$"; - -- The prefix for virtual extending projects. Because of the '$', which is - -- normally forbidden for project names, there cannot be any name clash. - type Source_Iterator is record In_Tree : Project_Tree_Ref; @@ -1601,6 +1606,7 @@ private Error_On_Unknown_Language : Boolean; Require_Obj_Dirs : Error_Warning; Allow_Invalid_External : Error_Warning; + Missing_Source_Files : Error_Warning; end record; Gprbuild_Flags : constant Processing_Flags := @@ -1611,7 +1617,8 @@ private Compiler_Driver_Mandatory => True, Error_On_Unknown_Language => True, Require_Obj_Dirs => Error, - Allow_Invalid_External => Error); + Allow_Invalid_External => Error, + Missing_Source_Files => Error); Gprclean_Flags : constant Processing_Flags := (Report_Error => null, @@ -1621,7 +1628,8 @@ private Compiler_Driver_Mandatory => True, Error_On_Unknown_Language => True, Require_Obj_Dirs => Warning, - Allow_Invalid_External => Error); + Allow_Invalid_External => Error, + Missing_Source_Files => Warning); Gnatmake_Flags : constant Processing_Flags := (Report_Error => null, @@ -1631,6 +1639,7 @@ private Compiler_Driver_Mandatory => False, Error_On_Unknown_Language => False, Require_Obj_Dirs => Error, - Allow_Invalid_External => Error); + Allow_Invalid_External => Error, + Missing_Source_Files => Error); end Prj; Index: prj-nmsc.adb =================================================================== --- prj-nmsc.adb (revision 161166) +++ prj-nmsc.adb (working copy) @@ -6537,19 +6537,40 @@ package body Prj.Nmsc is if not NL.Found then Err_Vars.Error_Msg_File_1 := NL.Name; - if First_Error then - Error_Msg - (Data.Flags, - "source file { not found", - NL.Location, Project.Project); - First_Error := False; - - else - Error_Msg - (Data.Flags, - "\source file { not found", - NL.Location, Project.Project); - end if; + case Data.Flags.Missing_Source_Files is + when Error => + if First_Error then + Error_Msg + (Data.Flags, + "source file { not found", + NL.Location, Project.Project); + First_Error := False; + + else + Error_Msg + (Data.Flags, + "\source file { not found", + NL.Location, Project.Project); + end if; + + when Warning => + if First_Error then + Error_Msg + (Data.Flags, + "?source file { not found", + NL.Location, Project.Project); + First_Error := False; + + else + Error_Msg + (Data.Flags, + "?\source file { not found", + NL.Location, Project.Project); + end if; + + when Silent => + null; + end case; end if; NL := Source_Names_Htable.Get_Next (Project.Source_Names);