diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-02-15 09:43:00 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-02-15 09:43:00 +0000 |
commit | 049853aed8cb9022f3e4b5d1aa2f2649ef9ee6a8 (patch) | |
tree | f8548be927bcc6442533b3a94bc79d2981bc1312 /gcc/ada/prj-nmsc.adb | |
parent | e7c3eff78c00b0b3ab6572de81bd104e871cc29c (diff) | |
download | gcc-049853aed8cb9022f3e4b5d1aa2f2649ef9ee6a8.tar.gz |
2006-02-13 Vincent Celier <celier@adacore.com>
* prj.ads (Error_Warning): New enumeration type
* prj-nmsc.ads, prj-nmsc.adb (Error_Msg): If location parameter is
unknown, use the location of the project to report the error.
(When_No_Sources): New global variable
(Report_No_Ada_Sources): New procedure
(Check): New parameter When_No_Sources. Set value of global variable
When_No_Sources,
(Find_Sources): Call Report_No_Ada_Sources when appropriate
(Get_Sources_From_File): Ditto
(Warn_If_Not_Sources): Better warning messages indicating the unit name
and the file name.
* prj-pars.ads, prj-pars.adb (Parse): New parameter When_No_Sources.
Call Prj.Proc.Process with parameter When_No_Sources.
* prj-proc.ads, prj-proc.adb (Check): New parameter When_No_Sources.
Call Recursive_Check with parameter When_No_Sources.
(Recursive_Check): New parameter When_No_Sources. Call itself and
Prj.Nmsc.Check with parameter When_No_Sources.
(Process): New parameter When_No_Sources. Call Check with parameter
When_No_Sources.
(Copy_Package_Declarations): New procedure to copy renamed parameters
and setting the location of the declared attributes to the location
of the renamed package.
(Process_Declarative_Items): Call Copy_Package_Declarations for renamed
packages.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111084 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/prj-nmsc.adb')
-rw-r--r-- | gcc/ada/prj-nmsc.adb | 77 |
1 files changed, 59 insertions, 18 deletions
diff --git a/gcc/ada/prj-nmsc.adb b/gcc/ada/prj-nmsc.adb index 3a7dd9630e9..67d59201d98 100644 --- a/gcc/ada/prj-nmsc.adb +++ b/gcc/ada/prj-nmsc.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2000-2005, Free Software Foundation, Inc. -- +-- Copyright (C) 2000-2006, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -27,11 +27,10 @@ with Err_Vars; use Err_Vars; with Fmap; use Fmap; with Hostparm; -with MLib.Tgt; +with MLib.Tgt; use MLib.Tgt; with Namet; use Namet; with Osint; use Osint; with Output; use Output; -with MLib.Tgt; use MLib.Tgt; with Prj.Env; use Prj.Env; with Prj.Err; with Prj.Util; use Prj.Util; @@ -54,6 +53,10 @@ package body Prj.Nmsc is Error_Report : Put_Line_Access := null; -- Set to point to error reporting procedure + When_No_Sources : Error_Warning := Error; + -- Indicates what should be done when there is no Ada sources in a non + -- extending Ada project. + ALI_Suffix : constant String := ".ali"; -- File suffix for ali files @@ -352,6 +355,12 @@ package body Prj.Nmsc is -- When Naming_Exceptions is True, mark the found sources as such, to -- later remove those that are not named in a list of sources. + procedure Report_No_Ada_Sources + (Project : Project_Id; + In_Tree : Project_Tree_Ref; + Location : Source_Ptr); + -- Report an error or a warning depending on the value of When_No_Sources + procedure Show_Source_Dirs (Project : Project_Id; In_Tree : Project_Tree_Ref); -- List all the source directories of a project @@ -398,15 +407,17 @@ package body Prj.Nmsc is ----------- procedure Check - (Project : Project_Id; - In_Tree : Project_Tree_Ref; - Report_Error : Put_Line_Access; - Follow_Links : Boolean) + (Project : Project_Id; + In_Tree : Project_Tree_Ref; + Report_Error : Put_Line_Access; + Follow_Links : Boolean; + When_No_Sources : Error_Warning) is Data : Project_Data := In_Tree.Projects.Table (Project); Extending : Boolean := False; begin + Nmsc.When_No_Sources := When_No_Sources; Error_Report := Report_Error; Recursive_Dirs.Reset; @@ -2793,6 +2804,7 @@ package body Prj.Nmsc is Msg : String; Flag_Location : Source_Ptr) is + Real_Location : Source_Ptr := Flag_Location; Error_Buffer : String (1 .. 5_000); Error_Last : Natural := 0; Msg_Name : Natural := 0; @@ -2832,8 +2844,14 @@ package body Prj.Nmsc is -- Start of processing for Error_Msg begin + -- If location of error is unknown, use the location of the project + + if Real_Location = No_Location then + Real_Location := In_Tree.Projects.Table (Project).Location; + end if; + if Error_Report = null then - Prj.Err.Error_Msg (Msg, Flag_Location); + Prj.Err.Error_Msg (Msg, Real_Location); return; end if; @@ -3024,10 +3042,7 @@ package body Prj.Nmsc is Data.Ada_Sources_Present := True; elsif Data.Extends = No_Project then - Error_Msg - (Project, In_Tree, - "there are no Ada sources in this project", - Data.Location); + Report_No_Ada_Sources (Project, In_Tree, Data.Location); end if; end if; end Find_Sources; @@ -4243,12 +4258,10 @@ package body Prj.Nmsc is Get_Path_Names_And_Record_Sources (Follow_Links); -- We should have found at least one source. - -- If not, report an error. + -- If not, report an error/warning. if Data.Sources = Nil_String then - Error_Msg (Project, In_Tree, - "there are no Ada sources in this project", - Location); + Report_No_Ada_Sources (Project, In_Tree, Location); end if; end Get_Sources_From_File; @@ -5304,6 +5317,30 @@ package body Prj.Nmsc is end if; end Record_Other_Sources; + --------------------------- + -- Report_No_Ada_Sources -- + --------------------------- + + procedure Report_No_Ada_Sources + (Project : Project_Id; + In_Tree : Project_Tree_Ref; + Location : Source_Ptr) + is + begin + case When_No_Sources is + when Silent => + null; + + when Warning | Error => + Error_Msg_Warn := When_No_Sources = Warning; + + Error_Msg + (Project, In_Tree, + "<there are no Ada sources in this project", + Location); + end case; + end Report_No_Ada_Sources; + ---------------------- -- Show_Source_Dirs -- ---------------------- @@ -5413,6 +5450,8 @@ package body Prj.Nmsc is else The_Unit_Data := In_Tree.Units.Table (The_Unit_Id); + Error_Msg_Name_2 := + In_Tree.Array_Elements.Table (Conv).Value.Value; if Specs then if not Check_Project @@ -5421,7 +5460,8 @@ package body Prj.Nmsc is then Error_Msg (Project, In_Tree, - "?unit{ has no spec in this project", + "?source of spec of unit { ({)" & + " cannot be found in this project", Location); end if; @@ -5432,7 +5472,8 @@ package body Prj.Nmsc is then Error_Msg (Project, In_Tree, - "?unit{ has no body in this project", + "?source of body of unit { ({)" & + " cannot be found in this project", Location); end if; end if; |