diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2004-12-08 12:25:51 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2004-12-08 12:25:51 +0100 |
commit | 44e1918abd19b6012e27acc89c85230797a2fc79 (patch) | |
tree | 5f264e895f21f42a7c2b643a609e2b267faf6e7e /gcc/ada/prj-part.adb | |
parent | a7e5b6df8d190ca4d8bc15abf1da93088b57afc1 (diff) | |
download | gcc-44e1918abd19b6012e27acc89c85230797a2fc79.zip gcc-44e1918abd19b6012e27acc89c85230797a2fc79.tar.gz gcc-44e1918abd19b6012e27acc89c85230797a2fc79.tar.bz2 |
make.adb (Check_Mains, [...]): Adapt to name changes in package Prj (Current_Spec_Suffix => Ada_Spec_Suffix...
* make.adb (Check_Mains, Switches_Of): Adapt to name changes in
package Prj (Current_Spec_Suffix => Ada_Spec_Suffix,
Current_Body_Suffix => Ada_Body_Suffix).
Take into account Externally_Built attribute.
* clean.adb (In_Extension_Chain): Always return False when one of the
parameter is No_Project.
(Clean_Project): Adapt to changes in package Prj (Lang_Ada =>
Ada_Language_Index).
(Gnatclean): Adapt to change in package Prj.Pars (no parameter
Process_Languages for procedure Parse).
* gnatcmd.adb (Carg_Switches): New table.
(GNATCmd): Put all switches following -cargs in the Carg_Switches table.
Adapt to name changes in package Prj (Current_Spec_Suffix =>
Ada_Spec_Suffix, Current_Body_Suffix => Ada_Body_Suffix).
* mlib-prj.adb: Adapt to changes in packages Prj and Prj.Com: type
Header_Num and function Hash are now declared in package Prj,
not Prj.Com.
* prj.adb (Suffix_Of): New function.
(Set (Suffix)): New procedure.
(Hash): One function moved from Prj.Com
(Is_Present, Language_Processing_Data_Of): New functions
(Set): Two new procedures
(Add_Language_Name, Display_Language_Name): New procedures
* prj.ads: (Suffix_Of): New function
(Set (Suffix)): New procedure
Add several types and tables for multi-language support.
(Header_Num): Type moved from Prj.Com
(Hash): Two functions moved from Prj.Com
(Is_Present, Language_Processing_Data_Of): New functions
(Set): Two new procedures
(Add_Language_Name, Display_Language_Name): New procedures
(Naming): Component name changes:
Current_Spec_Suffix => Ada_Spec_Suffix,
Current_Body_Suffix => Ada_Body_Suffix. Add new components:
Impl_Suffixes, Supp_Suffixes.
(Project_Data): New components: Externally_Built, Supp_Languages,
First_Language_Processing, Supp_Language_Processing, Default_Linker,
Default_Linker_Path.
* prj-attr.adb: Add new attributes Ada_Roots and Externally_Built and
new package Language_Processing with its attributes (Compiler_Driver,
Compiler_Kind, Dependency_Option, Compute_Dependency, Include_Option,
Binder_Driver, Default_Linker).
* prj-com.ads, prj-com.adb (Hash): Function moved to package Prj.
(Header_Num): Type moved to package Prj
* prj-env.adb: Adapt to name changes in package Prj
(Current_Spec_Suffix => Ada_Spec_Suffix,
Current_Body_Suffix => Ada_Body_Suffix).
* prj-ext.adb: Add the default project dir (<prefix>/log/gnat) by
default to the project path, except the "-" is one of the directories
in env var ADA_PROJECT_PATH.
(Current_Project_Path): Global variable, replacing Project_Path
that was in the body of Prj.Part.
(Project_Path): New function
(Set_Project_Path): New procedure
Initialize Current_Project_Path during elaboration of the package
Remove dependency on Prj.Com, no longer needed
* prj-ext.ads (Project_Path): New function
(Set_Project_Path): New procedure
* prj-nmsc.adb (Body_Suffix_Of): New function. Returns .<lang> when no
suffix is defined for language <lang>.
(Find_Sources, Record_Other_Sources): Use Body_Suffix_Of, instead of
accessing directly the components of Naming.
(Look_For_Sources): Use Set (Suffix) to set the suffix of a language.
Reorganise of this package.
Break procedure Check in several procedures.
* prj-nmsc.ads: Replace all procedures (Ada_Check,
Other_Languages_Check and Language_Independent_Check) with a single
procedure Check.
* prj-pars.ads, prj-pars.adb (Parse): Remove parameter
Process_Languages, no longer needed.
* prj-part.adb (Project_Path): Move to the body of Prj.Ext as
Current_Project_Path.
Remove elaboration code, moved to the body of Prj.Ext
Use new function Prj.Ext.Project_Path instead of old variable
Project_Path.
(Post_Parse_Context_Clause): Get Resolved_Path as a case-sensitive path.
When comparing with project paths on the stack, first put the resolved
path in canonical case.
(Parse_Single_Project): Set the path name of the project file in the
tree to the normalized path.
* prj-proc.ads, prj-proc.adb (Check, Recursive_Check, Process): Remove
parameter Process_Languages, no longer needed.
(Recursive_Check): Call Prj.Nmsc.Check, instead of Ada_Check and
Other_Languages_Check.
* prj-tree.ads (Project_Name_And_Node): New component Canonical_Path
to store the resolved canonical path of the project file.
Remove dependency to Prj.Com, no longer needed
* prj-util.adb: Adapt to name changes in package Prj
(Current_Spec_Suffix => Ada_Spec_Suffix, Current_Body_Suffix =>
Ada_Body_Suffix).
* snames.ads, snames.adb: New standard names: Ada_Roots, Binder_Driver,
Compiler_Driver, Compiler_Kind, Compute_Dependency, Default_Linker,
Externally_Built, Include_Option, Language_Processing.
* makegpr.adb: Numerous changes due to changes in packages
Prj and Prj.Nmsc.
* gnatls.adb: Add the default project dir (<prefix>/log/gnat) by
default to the project path, except whe "-" is one of the directories
in env var ADA_PROJECT_PATH.
(Gnatls): In verbose mode, add the new section "Project Search Path:"
From-SVN: r91877
Diffstat (limited to 'gcc/ada/prj-part.adb')
-rw-r--r-- | gcc/ada/prj-part.adb | 145 |
1 files changed, 55 insertions, 90 deletions
diff --git a/gcc/ada/prj-part.adb b/gcc/ada/prj-part.adb index c09f8fa..291fc23 100644 --- a/gcc/ada/prj-part.adb +++ b/gcc/ada/prj-part.adb @@ -32,8 +32,8 @@ with Output; use Output; with Prj.Com; use Prj.Com; with Prj.Dect; with Prj.Err; use Prj.Err; +with Prj.Ext; use Prj.Ext; with Scans; use Scans; -with Sdefault; with Sinput; use Sinput; with Sinput.P; use Sinput.P; with Snames; @@ -54,18 +54,6 @@ package body Prj.Part is Dir_Sep : Character renames GNAT.OS_Lib.Directory_Separator; - Project_Path : String_Access; - -- The project path; initialized during package elaboration. - -- Contains at least the current working directory. - - Ada_Project_Path : constant String := "ADA_PROJECT_PATH"; - -- Name of the env. variable that contains path name(s) of directories - -- where project files may reside. - - Prj_Path : constant String_Access := Getenv (Ada_Project_Path); - -- The path name(s) of directories where project files may reside. - -- May be empty. - type Extension_Origin is (None, Extending_Simple, Extending_All); -- Type of parameter From_Extended for procedures Parse_Single_Project and -- Post_Parse_Context_Clause. Extending_All means that we are parsing the @@ -449,7 +437,7 @@ package body Prj.Part is if Current_Verbosity >= Medium then Write_Str ("ADA_PROJECT_PATH="""); - Write_Str (Project_Path.all); + Write_Str (Project_Path); Write_Line (""""); end if; @@ -707,7 +695,7 @@ package body Prj.Part is Normalize_Pathname (Imported_Path_Name, Resolve_Links => True, - Case_Sensitive => False); + Case_Sensitive => True); Withed_Project : Project_Node_Id := Empty_Node; @@ -763,6 +751,7 @@ package body Prj.Part is begin Name_Len := Resolved_Path'Length; Name_Buffer (1 .. Name_Len) := Resolved_Path; + Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Canonical_Path_Name := Name_Find; for Index in 1 .. Project_Stack.Last loop @@ -922,73 +911,60 @@ package body Prj.Part is Project_Stack.Table (Project_Stack.Last).Canonical_Path_Name := Canonical_Path_Name; - -- Check if the project file has already been parsed. + -- Check if the project file has already been parsed while A_Project_Name_And_Node /= Tree_Private_Part.No_Project_Name_And_Node loop - declare - Path_Id : Name_Id := Path_Name_Of (A_Project_Name_And_Node.Node); - - begin - if Path_Id /= No_Name then - Get_Name_String (Path_Id); - Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); - Path_Id := Name_Find; - end if; - - if Path_Id = Canonical_Path_Name then - if Extended then + if A_Project_Name_And_Node.Canonical_Path = Canonical_Path_Name then + if Extended then - if A_Project_Name_And_Node.Extended then - Error_Msg - ("cannot extend the same project file several times", - Token_Ptr); - - else - Error_Msg - ("cannot extend an already imported project file", - Token_Ptr); - end if; + if A_Project_Name_And_Node.Extended then + Error_Msg + ("cannot extend the same project file several times", + Token_Ptr); + else + Error_Msg + ("cannot extend an already imported project file", + Token_Ptr); + end if; - elsif A_Project_Name_And_Node.Extended then - Extends_All := - Is_Extending_All (A_Project_Name_And_Node.Node); + elsif A_Project_Name_And_Node.Extended then + Extends_All := + Is_Extending_All (A_Project_Name_And_Node.Node); - -- If the imported project is an extended project A, - -- and we are in an extended project, replace A with the - -- ultimate project extending A. + -- If the imported project is an extended project A, + -- and we are in an extended project, replace A with the + -- ultimate project extending A. - if From_Extended /= None then - declare - Decl : Project_Node_Id := - Project_Declaration_Of - (A_Project_Name_And_Node.Node); + if From_Extended /= None then + declare + Decl : Project_Node_Id := + Project_Declaration_Of + (A_Project_Name_And_Node.Node); - Prj : Project_Node_Id := - Extending_Project_Of (Decl); + Prj : Project_Node_Id := Extending_Project_Of (Decl); - begin - loop - Decl := Project_Declaration_Of (Prj); - exit when Extending_Project_Of (Decl) = Empty_Node; - Prj := Extending_Project_Of (Decl); - end loop; + begin + loop + Decl := Project_Declaration_Of (Prj); + exit when Extending_Project_Of (Decl) = Empty_Node; + Prj := Extending_Project_Of (Decl); + end loop; - A_Project_Name_And_Node.Node := Prj; - end; - else - Error_Msg - ("cannot import an already extended project file", - Token_Ptr); - end if; + A_Project_Name_And_Node.Node := Prj; + end; + else + Error_Msg + ("cannot import an already extended project file", + Token_Ptr); end if; - - Project := A_Project_Name_And_Node.Node; - Project_Stack.Decrement_Last; - return; end if; - end; + + Project := A_Project_Name_And_Node.Node; + Project_Stack.Decrement_Last; + return; + end if; A_Project_Name_And_Node := Tree_Private_Part.Projects_Htable.Get_Next; end loop; @@ -1037,7 +1013,7 @@ package body Prj.Part is Project := Default_Project_Node (Of_Kind => N_Project); Project_Stack.Table (Project_Stack.Last).Id := Project; Set_Directory_Of (Project, Project_Directory); - Set_Path_Name_Of (Project, Canonical_Path_Name); + Set_Path_Name_Of (Project, Normed_Path_Name); Set_Location_Of (Project, Token_Ptr); Expect (Tok_Project, "PROJECT"); @@ -1052,7 +1028,6 @@ package body Prj.Part is -- Clear the Buffer Buffer_Last := 0; - loop Expect (Tok_Identifier, "identifier"); @@ -1201,9 +1176,10 @@ package body Prj.Part is Tree_Private_Part.Projects_Htable.Set (K => Name_Of_Project, - E => (Name => Name_Of_Project, - Node => Project, - Extended => Extended)); + E => (Name => Name_Of_Project, + Node => Project, + Canonical_Path => Canonical_Path_Name, + Extended => Extended)); end if; end; @@ -1370,7 +1346,7 @@ package body Prj.Part is Project_Declaration : Project_Node_Id := Empty_Node; begin - -- No need to Scan past "is", Prj.Dect.Parse will do it. + -- No need to Scan past "is", Prj.Dect.Parse will do it Prj.Dect.Parse (Declarations => Project_Declaration, @@ -1630,7 +1606,7 @@ package body Prj.Part is Locate_Regular_File (File_Name => Directory & Directory_Separator & Project_File_Name & Project_File_Extension, - Path => Project_Path.all); + Path => Project_Path); -- Then we try <directory>/<file_name> @@ -1646,7 +1622,7 @@ package body Prj.Part is Locate_Regular_File (File_Name => Directory & Directory_Separator & Project_File_Name, - Path => Project_Path.all); + Path => Project_Path); end if; end if; @@ -1663,7 +1639,7 @@ package body Prj.Part is Result := Locate_Regular_File (File_Name => Project_File_Name & Project_File_Extension, - Path => Project_Path.all); + Path => Project_Path); end if; if Result = null then @@ -1678,7 +1654,7 @@ package body Prj.Part is Result := Locate_Regular_File (File_Name => Project_File_Name, - Path => Project_Path.all); + Path => Project_Path); end if; -- If we cannot find the project file, we return an empty string @@ -1700,15 +1676,4 @@ package body Prj.Part is end if; end Project_Path_Name_Of; -begin - -- Initialize Project_Path during package elaboration - - if Prj_Path.all = "" then - Project_Path := - new String'("." & Path_Separator & Sdefault.Search_Dir_Prefix.all & - ".." & Directory_Separator & ".." & Directory_Separator & - ".." & Directory_Separator & "gnat"); - else - Project_Path := new String'("." & Path_Separator & Prj_Path.all); - end if; end Prj.Part; |