From: Vincent Celier Date: Tue, 27 May 2008 11:00:07 +0000 (+0200) Subject: 2008-05-27 Vincent Celier X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3b3c04308eef477c84841ef6090ad28e71315220;p=gcc.git 2008-05-27 Vincent Celier * gnatcmd.adb, prj-proc.adb, make.adb, mlib-prj.adb, prj.adb, prj.ads, makegpr.adb, makeutl.adb, clean.adb, prj-nmsc.adb, mlib-tgt.adb, prj-env.adb, prj-env.ads: (Path_Information): New record type Use component of type Path_Information when there are two paths, one in canonical format and one in display format. Update the project manager to these new components. From-SVN: r136008 --- diff --git a/gcc/ada/clean.adb b/gcc/ada/clean.adb index 876ec5a19a3..5db4c4efc67 100644 --- a/gcc/ada/clean.adb +++ b/gcc/ada/clean.adb @@ -346,7 +346,7 @@ package body Clean is -- The name of the archive dependency file for this project Obj_Dir : constant String := - Get_Name_String (Data.Display_Object_Dir); + Get_Name_String (Data.Object_Directory.Display_Name); begin Change_Dir (Obj_Dir); @@ -551,10 +551,10 @@ package body Clean is Unit : Unit_Data; begin - if Data.Library and then Data.Library_Src_Dir /= No_Path then + if Data.Library and then Data.Library_Src_Dir /= No_Path_Information then declare Directory : constant String := - Get_Name_String (Data.Display_Library_Src_Dir); + Get_Name_String (Data.Library_Src_Dir.Display_Name); begin Change_Dir (Directory); @@ -663,10 +663,11 @@ package body Clean is declare Lib_Directory : constant String := - Get_Name_String (Data.Display_Library_Dir); + Get_Name_String + (Data.Library_Dir.Display_Name); Lib_ALI_Directory : constant String := Get_Name_String - (Data.Display_Library_ALI_Dir); + (Data.Library_ALI_Dir.Display_Name); begin Canonical_Case_File_Name (Archive_Name); @@ -863,10 +864,11 @@ package body Clean is Processed_Projects.Increment_Last; Processed_Projects.Table (Processed_Projects.Last) := Project; - if Data.Object_Directory /= No_Path then + if Data.Object_Directory /= No_Path_Information then declare Obj_Dir : constant String := - Get_Name_String (Data.Display_Object_Dir); + Get_Name_String + (Data.Object_Directory.Display_Name); begin Change_Dir (Obj_Dir); @@ -1089,16 +1091,16 @@ package body Clean is if not Compile_Only then Clean_Library_Directory (Project); - if Data.Library_Src_Dir /= No_Path then + if Data.Library_Src_Dir /= No_Path_Information then Clean_Interface_Copy_Directory (Project); end if; end if; if Data.Standalone_Library and then - Data.Object_Directory /= No_Path + Data.Object_Directory /= No_Path_Information then Delete_Binder_Generated_Files - (Get_Name_String (Data.Display_Object_Dir), + (Get_Name_String (Data.Object_Directory.Display_Name), File_Name_Type (Data.Library_Name)); end if; end if; @@ -1156,10 +1158,12 @@ package body Clean is -- The executables are deleted only if switch -c is not specified - if Project = Main_Project and then Data.Exec_Directory /= No_Path then + if Project = Main_Project + and then Data.Exec_Directory /= No_Path_Information + then declare Exec_Dir : constant String := - Get_Name_String (Data.Display_Exec_Dir); + Get_Name_String (Data.Exec_Directory.Display_Name); begin Change_Dir (Exec_Dir); @@ -1193,9 +1197,9 @@ package body Clean is end; end if; - if Data.Object_Directory /= No_Path then + if Data.Object_Directory /= No_Path_Information then Delete_Binder_Generated_Files - (Get_Name_String (Data.Display_Object_Dir), + (Get_Name_String (Data.Object_Directory.Display_Name), Strip_Suffix (Main_Source_File)); end if; end loop; diff --git a/gcc/ada/gnatcmd.adb b/gcc/ada/gnatcmd.adb index 8135bfc8a4d..1082fb15b10 100644 --- a/gcc/ada/gnatcmd.adb +++ b/gcc/ada/gnatcmd.adb @@ -349,9 +349,9 @@ procedure GNATCmd is while Main /= Nil_String loop File := new String' - (Get_Name_String (Data.Object_Directory) & - Directory_Separator & - B_Start.all & + (Get_Name_String (Data.Object_Directory.Name) & + Directory_Separator & + B_Start.all & MLib.Fil.Ext_To (Get_Name_String (Project_Tree.String_Elements.Table @@ -375,10 +375,10 @@ procedure GNATCmd is File := new String' - (Get_Name_String (Data.Object_Directory) & - Directory_Separator & - B_Start.all & - Get_Name_String (Data.Library_Name) & + (Get_Name_String (Data.Object_Directory.Name) & + Directory_Separator & + B_Start.all & + Get_Name_String (Data.Library_Name) & ".ci"); if Is_Regular_File (File.all) then @@ -403,7 +403,7 @@ procedure GNATCmd is if Unit_Data.File_Names (Body_Part).Name /= No_File and then - Unit_Data.File_Names (Body_Part).Path /= Slash + Unit_Data.File_Names (Body_Part).Path.Name /= Slash then -- There is a body, check if it is for this project @@ -415,7 +415,8 @@ procedure GNATCmd is if Unit_Data.File_Names (Specification).Name = No_File or else - Unit_Data.File_Names (Specification).Path = Slash + Unit_Data.File_Names + (Specification).Path.Name = Slash then -- We have a body with no spec: we need to check if -- this is a subunit, because gnatls will complain @@ -428,7 +429,7 @@ procedure GNATCmd is Src_Ind := Sinput.P.Load_Project_File (Get_Name_String (Unit_Data.File_Names - (Body_Part).Path)); + (Body_Part).Path.Name)); Subunit := Sinput.P.Source_File_Is_Subunit @@ -449,7 +450,7 @@ procedure GNATCmd is elsif Unit_Data.File_Names (Specification).Name /= No_File and then - Unit_Data.File_Names (Specification).Path /= Slash + Unit_Data.File_Names (Specification).Path.Name /= Slash then -- We have a spec with no body; check if it is for this -- project. @@ -475,7 +476,7 @@ procedure GNATCmd is if Unit_Data.File_Names (Body_Part).Name /= No_File and then - Unit_Data.File_Names (Body_Part).Path /= Slash + Unit_Data.File_Names (Body_Part).Path.Name /= Slash then -- There is a body. Check if .ci files for this project -- must be added. @@ -489,7 +490,8 @@ procedure GNATCmd is if Unit_Data.File_Names (Specification).Name = No_File or else - Unit_Data.File_Names (Specification).Path = Slash + Unit_Data.File_Names + (Specification).Path.Name = Slash then -- We have a body with no spec: we need to check -- if this is a subunit, because .ci files are not @@ -501,7 +503,8 @@ procedure GNATCmd is begin Src_Ind := Sinput.P.Load_Project_File (Get_Name_String - (Unit_Data.File_Names (Body_Part).Path)); + (Unit_Data.File_Names + (Body_Part).Path.Name)); Subunit := Sinput.P.Source_File_Is_Subunit (Src_Ind); @@ -516,7 +519,7 @@ procedure GNATCmd is (Project_Tree.Projects.Table (Unit_Data.File_Names (Body_Part).Project). - Object_Directory) & + Object_Directory.Name) & Directory_Separator & MLib.Fil.Ext_To (Get_Name_String @@ -529,7 +532,7 @@ procedure GNATCmd is elsif Unit_Data.File_Names (Specification).Name /= No_File and then - Unit_Data.File_Names (Specification).Path /= Slash + Unit_Data.File_Names (Specification).Path.Name /= Slash then -- We have a spec with no body. Check if it is for this -- project. @@ -546,7 +549,7 @@ procedure GNATCmd is (Project_Tree.Projects.Table (Unit_Data.File_Names (Specification).Project). - Object_Directory) & + Object_Directory.Name) & Dir_Separator & MLib.Fil.Ext_To (Get_Name_String @@ -565,14 +568,14 @@ procedure GNATCmd is if Check_Project (Unit_Data.File_Names (Kind).Project, Project) and then Unit_Data.File_Names (Kind).Name /= No_File - and then Unit_Data.File_Names (Kind).Path /= Slash + and then Unit_Data.File_Names (Kind).Path.Name /= Slash then Last_Switches.Increment_Last; Last_Switches.Table (Last_Switches.Last) := new String' (Get_Name_String (Unit_Data.File_Names - (Kind).Display_Path)); + (Kind).Path.Display_Name)); end if; end loop; end if; @@ -688,7 +691,7 @@ procedure GNATCmd is end loop; Get_Name_String (Project_Tree.Projects.Table - (Project).Exec_Directory); + (Project).Exec_Directory.Name); if Name_Buffer (Name_Len) /= Directory_Separator then Name_Len := Name_Len + 1; @@ -870,7 +873,7 @@ procedure GNATCmd is Get_Name_String (Udata.File_Names (Specification).Name) = Line (1 .. Last) then - Path := Udata.File_Names (Specification).Path; + Path := Udata.File_Names (Specification).Path.Name; exit; elsif Udata.File_Names (Body_Part).Name /= No_File @@ -878,7 +881,7 @@ procedure GNATCmd is Get_Name_String (Udata.File_Names (Body_Part).Name) = Line (1 .. Last) then - Path := Udata.File_Names (Body_Part).Path; + Path := Udata.File_Names (Body_Part).Path.Name; exit; end if; end loop; @@ -1103,7 +1106,7 @@ procedure GNATCmd is Dir : constant String := Get_Name_String (Project_Tree.Projects.Table - (Prj).Object_Directory); + (Prj).Object_Directory.Name); begin if Is_Regular_File (Dir & @@ -1184,7 +1187,7 @@ procedure GNATCmd is new String'("-o"); Get_Name_String (Project_Tree.Projects.Table - (Project).Exec_Directory); + (Project).Exec_Directory.Name); Last_Switches.Increment_Last; Last_Switches.Table (Last_Switches.Last) := new String'(Name_Buffer (1 .. Name_Len) & @@ -1222,7 +1225,7 @@ procedure GNATCmd is new String'("-L" & Get_Name_String (Project_Tree.Projects.Table - (Project).Library_Dir)); + (Project).Library_Dir.Name)); -- Add the -l switch @@ -1244,7 +1247,7 @@ procedure GNATCmd is Library_Paths.Table (Library_Paths.Last) := new String'(Get_Name_String (Project_Tree.Projects.Table - (Project).Library_Dir)); + (Project).Library_Dir.Name)); end if; end if; end Set_Library_For; @@ -1336,7 +1339,14 @@ procedure GNATCmd is Put (To_Lower (Command_List (C).Cname.all)); Set_Col (25); - Put (Program_Name (Command_List (C).Unixcmd.all).all); + + -- No prefix for gnatstack + + if C = Stack then + Put (Command_List (C).Unixcmd.all); + else + Put (Program_Name (Command_List (C).Unixcmd.all).all); + end if; declare Sws : Argument_List_Access renames Command_List (C).Unixsws; @@ -1560,18 +1570,24 @@ begin end if; declare - Program : constant String := - Program_Name (Command_List (The_Command).Unixcmd.all).all; - + Program : String_Access; Exec_Path : String_Access; begin + if The_Command = Stack then + Program := new String'(Command_List (The_Command).Unixcmd.all); + + else + Program := + Program_Name (Command_List (The_Command).Unixcmd.all); + end if; + -- Locate the executable for the command - Exec_Path := Locate_Exec_On_Path (Program); + Exec_Path := Locate_Exec_On_Path (Program.all); if Exec_Path = null then - Put_Line (Standard_Error, "could not locate " & Program); + Put_Line (Standard_Error, "could not locate " & Program.all); raise Error_Exit; end if; @@ -1978,7 +1994,7 @@ begin Change_Dir (Get_Name_String (Project_Tree.Projects.Table - (Project).Object_Directory)); + (Project).Object_Directory.Name)); end if; -- Set up the env vars for project path files @@ -2191,7 +2207,7 @@ begin end loop; Get_Name_String - (Project_Tree.Projects.Table (Project).Directory); + (Project_Tree.Projects.Table (Project).Directory.Name); declare Project_Dir : constant String := Name_Buffer (1 .. Name_Len); @@ -2291,7 +2307,8 @@ begin if The_Command = Metric and then - Project_Tree.Projects.Table (Project).Object_Directory /= No_Path + Project_Tree.Projects.Table (Project).Object_Directory /= + No_Path_Information then First_Switches.Increment_Last; First_Switches.Table (2 .. First_Switches.Last) := @@ -2300,7 +2317,7 @@ begin new String'("-d=" & Get_Name_String (Project_Tree.Projects.Table - (Project).Object_Directory)); + (Project).Object_Directory.Name)); end if; -- For gnat check, -rules and the following switches need to be the diff --git a/gcc/ada/make.adb b/gcc/ada/make.adb index 304f15556ca..c1737b7ed47 100644 --- a/gcc/ada/make.adb +++ b/gcc/ada/make.adb @@ -1068,7 +1068,7 @@ package body Make is else Get_Name_String - (Project_Tree.Projects.Table (Main_Project).Display_Directory); + (Project_Tree.Projects.Table (Main_Project).Directory.Display_Name); Add_Lib_Search_Dir (Normalize_Pathname (Path, Name_Buffer (1 .. Name_Len))); end if; @@ -1120,7 +1120,7 @@ package body Make is else Get_Name_String - (Project_Tree.Projects.Table (Main_Project).Display_Directory); + (Project_Tree.Projects.Table (Main_Project).Directory.Display_Name); Add_Src_Search_Dir (Normalize_Pathname (Path, Name_Buffer (1 .. Name_Len))); end if; @@ -1391,7 +1391,7 @@ package body Make is if Project_Of_Current_Object_Directory /= Actual_Project then Project_Of_Current_Object_Directory := Actual_Project; Object_Directory := - Project_Tree.Projects.Table (Actual_Project).Object_Directory; + Project_Tree.Projects.Table (Actual_Project).Object_Directory.Name; -- Set the working directory to the object directory of the actual -- project. @@ -1415,7 +1415,7 @@ package body Make is Make_Failed ("unable to change to object directory """ & Path_Or_File_Name (Project_Tree.Projects.Table - (Actual_Project).Object_Directory) & + (Actual_Project).Object_Directory.Name) & """ of project " & Get_Name_String (Project_Tree.Projects.Table (Actual_Project).Display_Name)); @@ -1938,7 +1938,7 @@ package body Make is while ALI_Project /= No_Project and then Obj_Dir /= Project_Tree.Projects.Table - (ALI_Project).Object_Directory + (ALI_Project).Object_Directory.Name loop ALI_Project := Project_Tree.Projects.Table (ALI_Project).Extended_By; @@ -2330,7 +2330,7 @@ package body Make is if Data.Dir_Path = null then Data.Dir_Path := - new String'(Get_Name_String (Data.Display_Directory)); + new String'(Get_Name_String (Data.Directory.Display_Name)); Project_Tree.Projects.Table (Arguments_Project) := Data; end if; @@ -3580,7 +3580,8 @@ package body Make is Udata.File_Names (Body_Part).Name /= No_File and then - Udata.File_Names (Body_Part).Path /= Slash + Udata.File_Names (Body_Part).Path.Name /= + Slash then Sfile := Udata.File_Names (Body_Part).Name; Source_Index := @@ -3590,8 +3591,8 @@ package body Make is Udata.File_Names (Specification).Name /= No_File and then - Udata.File_Names (Specification).Path /= - Slash + Udata.File_Names + (Specification).Path.Name /= Slash then Sfile := Udata.File_Names (Specification).Name; @@ -3796,7 +3797,7 @@ package body Make is Parent_Directory : constant String := Get_Name_String (Project_Tree.Projects.Table - (Project).Display_Directory); + (Project).Directory.Display_Name); begin if Parent_Directory (Parent_Directory'Last) = @@ -4538,9 +4539,9 @@ package body Make is -- for other projects, use the object directory. if PD.Library then - Get_Name_String (PD.Library_Dir); + Get_Name_String (PD.Library_Dir.Name); else - Get_Name_String (PD.Object_Directory); + Get_Name_String (PD.Object_Directory.Name); end if; if Name_Buffer (Name_Len) /= @@ -4987,7 +4988,7 @@ package body Make is if Main_Project /= No_Project then if Project_Tree.Projects.Table - (Main_Project).Object_Directory /= No_Path + (Main_Project).Object_Directory /= No_Path_Information then -- Change current directory to object directory of main project @@ -5264,7 +5265,7 @@ package body Make is -- impossible to build the library. So fail immediately. if Project_Tree.Projects.Table (Proj).Object_Directory = - No_Path + No_Path_Information then Make_Failed ("no object files to build library for project """, @@ -5308,7 +5309,7 @@ package body Make is if not Is_Absolute_Path (Exec_File_Name) then Get_Name_String (Project_Tree.Projects.Table - (Main_Project).Exec_Directory); + (Main_Project).Exec_Directory.Name); if Name_Buffer (Name_Len) /= Directory_Separator then Name_Len := Name_Len + 1; @@ -5337,7 +5338,7 @@ package body Make is Dir_Path : constant String_Access := new String'(Get_Name_String (Project_Tree.Projects.Table - (Main_Project).Directory)); + (Main_Project).Directory.Name)); begin for J in 1 .. Binder_Switches.Last loop Test_If_Relative_Path @@ -5554,8 +5555,9 @@ package body Make is begin if not Is_Absolute_Path (Exec_File_Name) then - Get_Name_String (Project_Tree.Projects.Table - (Main_Project).Display_Exec_Dir); + Get_Name_String + (Project_Tree.Projects.Table + (Main_Project).Exec_Directory.Display_Name); if Name_Buffer (Name_Len) /= Directory_Separator then Name_Len := Name_Len + 1; @@ -6141,7 +6143,7 @@ package body Make is new String' (Get_Name_String (Project_Tree.Projects.Table - (Proj1).Display_Library_Dir)); + (Proj1).Library_Dir.Display_Name)); end if; end if; end loop; @@ -6156,7 +6158,7 @@ package body Make is Get_Name_String (Project_Tree.Projects.Table (Library_Projs.Table (Index)). - Display_Library_Dir)); + Library_Dir.Display_Name)); -- Add the -l switch @@ -6462,7 +6464,7 @@ package body Make is Dir_Path : constant String_Access := new String'(Get_Name_String (Project_Tree.Projects.Table - (Main_Project).Directory)); + (Main_Project).Directory.Name)); begin for J in Last_Binder_Switch + 1 .. Binder_Switches.Last @@ -6961,7 +6963,7 @@ package body Make is -- locally removed, if Unit.File_Names (Body_Part).Name /= No_File - and then Unit.File_Names (Body_Part).Path /= Slash + and then Unit.File_Names (Body_Part).Path.Name /= Slash then -- And it is a source for the specified project @@ -6988,7 +6990,7 @@ package body Make is begin Src_Ind := Sinput.P.Load_Project_File (Get_Name_String - (Unit.File_Names (Body_Part).Path)); + (Unit.File_Names (Body_Part).Path.Name)); -- If it is a subunit, discard it @@ -7008,7 +7010,7 @@ package body Make is end if; elsif Unit.File_Names (Specification).Name /= No_File - and then Unit.File_Names (Specification).Path /= Slash + and then Unit.File_Names (Specification).Path.Name /= Slash and then Check_Project (Unit.File_Names (Specification).Project) then -- If there is no source for the body, but there is a source @@ -7184,8 +7186,8 @@ package body Make is declare Object_Directory : constant String := Normalize_Pathname - (Get_Name_String - (Data.Display_Object_Dir)); + (Get_Name_String + (Data.Object_Directory.Display_Name)); Olast : Natural := Object_Directory'Last; @@ -7380,7 +7382,7 @@ package body Make is (Dir, Get_Name_String (Project_Tree.Projects.Table - (Main_Project).Display_Directory)); + (Main_Project).Directory.Display_Name)); begin if Real_Path'Length = 0 then diff --git a/gcc/ada/makegpr.adb b/gcc/ada/makegpr.adb index 684cae99eb8..04996bb4e13 100644 --- a/gcc/ada/makegpr.adb +++ b/gcc/ada/makegpr.adb @@ -551,7 +551,7 @@ package body Makegpr is if not For_Gnatmake then if Data.Library_Kind = Static then Add_Argument - (Get_Name_String (Data.Display_Library_Dir) & + (Get_Name_String (Data.Library_Dir.Display_Name) & Directory_Separator & "lib" & Get_Name_String (Data.Library_Name) & '.' & Archive_Ext, @@ -565,7 +565,7 @@ package body Makegpr is ("-l" & Get_Name_String (Data.Library_Name), Verbose_Mode); - Get_Name_String (Data.Display_Library_Dir); + Get_Name_String (Data.Library_Dir.Display_Name); Add_Argument ("-L" & Name_Buffer (1 .. Name_Len), @@ -617,7 +617,7 @@ package body Makegpr is elsif Project = Main_Project and then Global_Archive_Exists then Add_Argument - (Get_Name_String (Data.Display_Object_Dir) & + (Get_Name_String (Data.Object_Directory.Display_Name) & Directory_Separator & "lib" & Get_Name_String (Data.Display_Name) & '.' & Archive_Ext, @@ -1069,13 +1069,13 @@ package body Makegpr is if Project_Of_Current_Object_Directory /= Main_Project then Project_Of_Current_Object_Directory := Main_Project; - Change_Dir (Get_Name_String (Data.Object_Directory)); + Change_Dir (Get_Name_String (Data.Object_Directory.Name)); if Verbose_Mode then Write_Str ("Changing to object directory of """); Write_Name (Data.Display_Name); Write_Str (""": """); - Write_Name (Data.Display_Object_Dir); + Write_Name (Data.Object_Directory.Display_Name); Write_Line (""""); end if; end if; @@ -1647,7 +1647,8 @@ package body Makegpr is MLib.Build_Library (Ofiles => Arguments (1 .. Last_Argument), Output_File => Get_Name_String (Data.Library_Name), - Output_Dir => Get_Name_String (Data.Display_Library_Dir)); + Output_Dir => Get_Name_String + (Data.Library_Dir.Display_Name)); else -- Link with g++ if C++ is one of the languages, otherwise @@ -1709,7 +1710,7 @@ package body Makegpr is Options => Lib_Opts.all, Interfaces => No_Argument, Lib_Filename => Get_Name_String (Data.Library_Name), - Lib_Dir => Get_Name_String (Data.Library_Dir), + Lib_Dir => Get_Name_String (Data.Library_Dir.Name), Symbol_Data => No_Symbols, Driver_Name => Driver_Name, Lib_Version => "", @@ -2460,13 +2461,13 @@ package body Makegpr is if Project_Of_Current_Object_Directory /= Main_Project then Project_Of_Current_Object_Directory := Main_Project; - Change_Dir (Get_Name_String (Data.Object_Directory)); + Change_Dir (Get_Name_String (Data.Object_Directory.Name)); if Verbose_Mode then Write_Str ("Changing to object directory of """); Write_Name (Data.Name); Write_Str (""": """); - Write_Name (Data.Display_Object_Dir); + Write_Name (Data.Object_Directory.Display_Name); Write_Line (""""); end if; end if; @@ -2567,7 +2568,7 @@ package body Makegpr is -- Specify the project file Add_Argument (Dash_P, True); - Add_Argument (Get_Name_String (Data.Display_Path_Name), True); + Add_Argument (Get_Name_String (Data.Path.Display_Name), True); -- Add the saved switches, if any @@ -2774,13 +2775,13 @@ package body Makegpr is if Project_Of_Current_Object_Directory /= Project then Project_Of_Current_Object_Directory := Project; - Change_Dir (Get_Name_String (Data.Object_Directory)); + Change_Dir (Get_Name_String (Data.Object_Directory.Name)); if Verbose_Mode then Write_Str ("Changing to object directory of """); Write_Name (Data.Display_Name); Write_Str (""": """); - Write_Name (Data.Display_Object_Dir); + Write_Name (Data.Object_Directory.Display_Name); Write_Line (""""); end if; end if; @@ -3351,7 +3352,7 @@ package body Makegpr is if not Compile_Only and then not Data.Library - and then Data.Object_Directory /= No_Path + and then Data.Object_Directory /= No_Path_Information then Build_Global_Archive; Link_Executables; @@ -3513,7 +3514,7 @@ package body Makegpr is -- True if main sources were specified on the command line Object_Dir : constant String := - Get_Name_String (Data.Display_Object_Dir); + Get_Name_String (Data.Object_Directory.Display_Name); -- Path of the object directory of the main project Source_Id : Other_Source_Id; @@ -3576,7 +3577,8 @@ package body Makegpr is if Data.Other_Sources_Present then declare Archive_Path : constant String := Get_Name_String - (Prj_Data.Display_Object_Dir) & Directory_Separator + (Prj_Data.Object_Directory.Display_Name) + & Directory_Separator & "lib" & Get_Name_String (Prj_Data.Display_Name) & '.' & Archive_Ext; Archive_TS : Time_Stamp_Type; @@ -3641,7 +3643,7 @@ package body Makegpr is Executable_Path : constant String := Get_Name_String - (Data.Display_Exec_Dir) & + (Data.Exec_Directory.Display_Name) & Directory_Separator & Executable_Name; -- Path name of the executable @@ -3699,7 +3701,7 @@ package body Makegpr is Add_Argument (Dash_o, True); Add_Argument - (Get_Name_String (Data.Display_Exec_Dir) & + (Get_Name_String (Data.Exec_Directory.Display_Name) & Directory_Separator & Get_Name_String (Executable_Of diff --git a/gcc/ada/makeutl.adb b/gcc/ada/makeutl.adb index 442f4312126..1755ade229c 100644 --- a/gcc/ada/makeutl.adb +++ b/gcc/ada/makeutl.adb @@ -442,7 +442,7 @@ package body Makeutl is new String' (Get_Name_String (In_Tree.Projects.Table - (Proj). Directory)); + (Proj).Directory.Name)); end if; while Options /= Nil_String loop diff --git a/gcc/ada/mlib-prj.adb b/gcc/ada/mlib-prj.adb index 193b54ca408..3730199d69a 100644 --- a/gcc/ada/mlib-prj.adb +++ b/gcc/ada/mlib-prj.adb @@ -322,7 +322,7 @@ package body MLib.Prj is -- g-trasym.obj. Object_Directory_Path : constant String := - Get_Name_String (Data.Display_Object_Dir); + Get_Name_String (Data.Object_Directory.Display_Name); Standalone : constant Boolean := Data.Standalone_Library; @@ -713,14 +713,15 @@ package body MLib.Prj is if Libgnarl_Needed = Unknown then if Data.Libgnarl_Needed = Unknown - and then Data.Object_Directory /= No_Path + and then Data.Object_Directory /= No_Path_Information then -- Check if libgnarl is needed for this library declare Object_Dir_Path : constant String := Get_Name_String - (Data.Display_Object_Dir); + (Data.Object_Directory. + Display_Name); Object_Dir : Dir_Type; Filename : String (1 .. 255); Last : Natural; @@ -799,7 +800,7 @@ package body MLib.Prj is Current := Library_Projs.Table (Index); Get_Name_String - (In_Tree.Projects.Table (Current).Display_Library_Dir); + (In_Tree.Projects.Table (Current).Library_Dir.Display_Name); Opts.Increment_Last; Opts.Table (Opts.Last) := new String'("-L" & Name_Buffer (1 .. Name_Len)); @@ -966,7 +967,7 @@ package body MLib.Prj is Unit := In_Tree.Units.Table (Source); if Unit.File_Names (Body_Part).Name /= No_File - and then Unit.File_Names (Body_Part).Path /= Slash + and then Unit.File_Names (Body_Part).Path.Name /= Slash then if Check_Project (Unit.File_Names (Body_Part).Project) @@ -979,7 +980,7 @@ package body MLib.Prj is Src_Ind := Sinput.P.Load_Project_File (Get_Name_String (Unit.File_Names - (Body_Part).Path)); + (Body_Part).Path.Name)); -- Add the ALI file only if it is not a subunit @@ -999,7 +1000,7 @@ package body MLib.Prj is end if; elsif Unit.File_Names (Specification).Name /= No_File - and then Unit.File_Names (Specification).Path /= Slash + and then Unit.File_Names (Specification).Path.Name /= Slash and then Check_Project (Unit.File_Names (Specification).Project) then @@ -1318,7 +1319,7 @@ package body MLib.Prj is end if; Lib_Dirpath := - new String'(Get_Name_String (Data.Display_Library_Dir)); + new String'(Get_Name_String (Data.Library_Dir.Display_Name)); Lib_Filename := new String'(Get_Name_String (Data.Library_Name)); case Data.Library_Kind is @@ -1355,176 +1356,187 @@ package body MLib.Prj is There_Are_Foreign_Sources := Data.Other_Sources_Present; loop - declare - Object_Dir_Path : constant String := - Get_Name_String (Data.Display_Object_Dir); - Object_Dir : Dir_Type; - Filename : String (1 .. 255); - Last : Natural; - Id : Name_Id; + if Data.Object_Directory /= No_Path_Information then + declare + Object_Dir_Path : constant String := + Get_Name_String + (Data.Object_Directory.Display_Name); + Object_Dir : Dir_Type; + Filename : String (1 .. 255); + Last : Natural; + Id : Name_Id; - begin - Open (Dir => Object_Dir, Dir_Name => Object_Dir_Path); + begin + Open (Dir => Object_Dir, Dir_Name => Object_Dir_Path); - -- For all entries in the object directory + -- For all entries in the object directory - loop - Read (Object_Dir, Filename, Last); + loop + Read (Object_Dir, Filename, Last); - exit when Last = 0; + exit when Last = 0; - -- Check if it is an object file + -- Check if it is an object file - if Is_Obj (Filename (1 .. Last)) then - declare - Object_Path : constant String := - Normalize_Pathname - (Object_Dir_Path & Directory_Separator & - Filename (1 .. Last)); - C_Object_Path : String := Object_Path; - C_Filename : String := Filename (1 .. Last); + if Is_Obj (Filename (1 .. Last)) then + declare + Object_Path : constant String := + Normalize_Pathname + (Object_Dir_Path & + Directory_Separator & + Filename (1 .. Last)); + C_Object_Path : String := Object_Path; + C_Filename : String := Filename (1 .. Last); - begin - Canonical_Case_File_Name (C_Object_Path); - Canonical_Case_File_Name (C_Filename); + begin + Canonical_Case_File_Name (C_Object_Path); + Canonical_Case_File_Name (C_Filename); - -- If in the object directory of an extended project, - -- do not consider generated object files. + -- If in the object directory of an extended + -- project, do not consider generated object files. - if In_Main_Object_Directory - or else Last < 5 - or else C_Filename (1 .. B_Start'Length) /= - B_Start.all - then - Name_Len := Last; - Name_Buffer (1 .. Name_Len) := - C_Filename (1 .. Last); - Id := Name_Find; - - if not Objects_Htable.Get (Id) then - declare - ALI_File : constant String := - Ext_To - (C_Filename - (1 .. Last), "ali"); - ALI_Path : constant String := - Ext_To (C_Object_Path, "ali"); - Add_It : Boolean := - There_Are_Foreign_Sources - or else - (Last > 5 + if In_Main_Object_Directory + or else Last < 5 + or else C_Filename (1 .. B_Start'Length) /= + B_Start.all + then + Name_Len := Last; + Name_Buffer (1 .. Name_Len) := + C_Filename (1 .. Last); + Id := Name_Find; + + if not Objects_Htable.Get (Id) then + declare + ALI_File : constant String := + Ext_To + (C_Filename + (1 .. Last), "ali"); + ALI_Path : constant String := + Ext_To (C_Object_Path, "ali"); + Add_It : Boolean := + There_Are_Foreign_Sources + or else + (Last > 5 and then - C_Filename - (1 .. B_Start'Length) = - B_Start.all); - Fname : File_Name_Type; - Proj : Project_Id; - - begin - if Is_Regular_File (ALI_Path) then - - -- If there is an ALI file, check if the - -- object file should be added to the - -- library. If there are foreign sources - -- we put all object files in the library. - - if not Add_It then - for Index in - 1 .. Unit_Table.Last (In_Tree.Units) - loop - if In_Tree.Units.Table - (Index).File_Names - (Body_Part).Name /= No_File - then - Proj := - In_Tree.Units.Table (Index). - File_Names - (Body_Part).Project; - Fname := - In_Tree.Units.Table (Index). - File_Names (Body_Part).Name; - - elsif - In_Tree.Units.Table - (Index).File_Names - (Specification).Name /= No_File - then - Proj := - In_Tree.Units.Table - (Index).File_Names - (Specification).Project; - Fname := + C_Filename + (1 .. B_Start'Length) = + B_Start.all); + Fname : File_Name_Type; + Proj : Project_Id; + + begin + if Is_Regular_File (ALI_Path) then + + -- If there is an ALI file, check if + -- the object file should be added to + -- the library. If there are foreign + -- sources we put all object files in + -- the library. + + if not Add_It then + for Index in + 1 .. Unit_Table.Last + (In_Tree.Units) + loop + if In_Tree.Units.Table + (Index).File_Names + (Body_Part).Name /= No_File + then + Proj := + In_Tree.Units.Table (Index). + File_Names + (Body_Part).Project; + Fname := + In_Tree.Units.Table (Index). + File_Names (Body_Part).Name; + + elsif In_Tree.Units.Table (Index).File_Names - (Specification).Name; - - else - Proj := No_Project; - end if; - - Add_It := Proj /= No_Project; - - -- If the source is in the project - -- or a project it extends, we may - -- put it in the library. - - if Add_It then - Add_It := Check_Project (Proj); - end if; - - -- But we don't, if the ALI file - -- does not correspond to the unit. - - if Add_It then - declare - F : constant String := - Ext_To - (Get_Name_String - (Fname), "ali"); - begin - Add_It := F = ALI_File; - end; - end if; - - exit when Add_It; - end loop; - end if; + (Specification).Name /= + No_File + then + Proj := + In_Tree.Units.Table + (Index).File_Names + (Specification).Project; + Fname := + In_Tree.Units.Table + (Index).File_Names + (Specification).Name; + + else + Proj := No_Project; + end if; + + Add_It := Proj /= No_Project; + + -- If the source is in the + -- project or a project it + -- extends, we may put it in the + -- library. + + if Add_It then + Add_It := Check_Project (Proj); + end if; + + -- But we don't, if the ALI file + -- does not correspond to the + -- unit. + + if Add_It then + declare + F : constant String := + Ext_To + (Get_Name_String + (Fname), "ali"); + begin + Add_It := F = ALI_File; + end; + end if; + + exit when Add_It; + end loop; + end if; - if Add_It then - Objects_Htable.Set (Id, True); - Objects.Append - (new String'(Object_Path)); + if Add_It then + Objects_Htable.Set (Id, True); + Objects.Append + (new String'(Object_Path)); - -- Record the ALI file + -- Record the ALI file - ALIs.Append (new String'(ALI_Path)); + ALIs.Append (new String'(ALI_Path)); - -- Find out if for this ALI file, - -- libgnarl or libdecgnat or - -- g-trasym.obj (on OpenVMS) is - -- necessary. + -- Find out if for this ALI file, + -- libgnarl or libdecgnat or + -- g-trasym.obj (on OpenVMS) is + -- necessary. - Check_Libs (ALI_Path, True); - end if; + Check_Libs (ALI_Path, True); + end if; - elsif There_Are_Foreign_Sources then - Objects.Append (new String'(Object_Path)); - end if; - end; + elsif There_Are_Foreign_Sources then + Objects.Append + (new String'(Object_Path)); + end if; + end; + end if; end if; - end if; - end; - end if; - end loop; + end; + end if; + end loop; - Close (Dir => Object_Dir); + Close (Dir => Object_Dir); - exception - when Directory_Error => - Com.Fail ("cannot find object directory """, - Get_Name_String (Data.Object_Directory), - """"); - end; + exception + when Directory_Error => + Com.Fail ("cannot find object directory """, + Get_Name_String + (Data.Object_Directory.Display_Name), + """"); + end; + end if; exit when Data.Extends = No_Project; @@ -1798,7 +1810,7 @@ package body MLib.Prj is begin Get_Name_String - (In_Tree.Projects.Table (For_Project).Library_Dir); + (In_Tree.Projects.Table (For_Project).Library_Dir.Name); Change_Dir (Name_Buffer (1 .. Name_Len)); exception @@ -1938,21 +1950,22 @@ package body MLib.Prj is Copy_ALI_Files (Files => Ali_Files.all, - To => In_Tree.Projects.Table (For_Project).Library_ALI_Dir, + To => In_Tree.Projects.Table + (For_Project).Library_ALI_Dir.Name, Interfaces => Arguments (1 .. Argument_Number)); -- Copy interface sources if Library_Src_Dir specified if Standalone and then In_Tree.Projects.Table - (For_Project).Library_Src_Dir /= No_Path + (For_Project).Library_Src_Dir /= No_Path_Information then -- Clean the interface copy directory: remove any source that -- could be a source of the project. begin Get_Name_String - (In_Tree.Projects.Table (For_Project).Library_Src_Dir); + (In_Tree.Projects.Table (For_Project).Library_Src_Dir.Name); Change_Dir (Name_Buffer (1 .. Name_Len)); exception @@ -2030,7 +2043,7 @@ package body MLib.Prj is In_Tree => In_Tree, Interfaces => Arguments (1 .. Argument_Number), To_Dir => In_Tree.Projects.Table - (For_Project).Display_Library_Src_Dir); + (For_Project).Library_Src_Dir.Display_Name); end if; end if; @@ -2084,14 +2097,14 @@ package body MLib.Prj is Lib_Name : constant File_Name_Type := Library_File_Name_For (For_Project, In_Tree); begin - Change_Dir (Get_Name_String (Data.Library_Dir)); + Change_Dir (Get_Name_String (Data.Library_Dir.Name)); Lib_TS := File_Stamp (Lib_Name); In_Tree.Projects.Table (For_Project).Library_TS := Lib_TS; end; if not Data.Externally_Built and then not Data.Need_To_Build_Lib - and then Data.Object_Directory /= No_Path + and then Data.Object_Directory /= No_Path_Information then declare Obj_TS : Time_Stamp_Type; @@ -2105,7 +2118,7 @@ package body MLib.Prj is -- If the library file does not exist, then the time stamp will -- be Empty_Time_Stamp, earlier than any other time stamp. - Change_Dir (Get_Name_String (Data.Object_Directory)); + Change_Dir (Get_Name_String (Data.Object_Directory.Name)); Open (Dir => Object_Dir, Dir_Name => "."); -- For all entries in the object directory @@ -2209,7 +2222,7 @@ package body MLib.Prj is and then Data.File_Names (J).Name = File_Name then Copy_File - (Get_Name_String (Data.File_Names (J).Path), + (Get_Name_String (Data.File_Names (J).Path.Name), Target, Success, Mode => Overwrite, @@ -2250,8 +2263,7 @@ package body MLib.Prj is Change_Dir (Get_Name_String - (In_Tree.Projects.Table - (For_Project).Object_Directory)); + (In_Tree.Projects.Table (For_Project).Object_Directory.Name)); for Index in Interfaces'Range loop diff --git a/gcc/ada/mlib-tgt.adb b/gcc/ada/mlib-tgt.adb index e4d0441d55a..b2c7c952ede 100644 --- a/gcc/ada/mlib-tgt.adb +++ b/gcc/ada/mlib-tgt.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2001-2007, AdaCore -- +-- Copyright (C) 2001-2008, AdaCore -- -- -- -- 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- -- @@ -340,7 +340,7 @@ package body MLib.Tgt is declare Lib_Dir : constant String := Get_Name_String - (In_Tree.Projects.Table (Project).Library_Dir); + (In_Tree.Projects.Table (Project).Library_Dir.Name); Lib_Name : constant String := Get_Name_String (In_Tree.Projects.Table (Project).Library_Name); diff --git a/gcc/ada/prj-env.adb b/gcc/ada/prj-env.adb index bbc45c57d3c..dd52f353287 100644 --- a/gcc/ada/prj-env.adb +++ b/gcc/ada/prj-env.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2001-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2008, 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- -- @@ -251,7 +251,7 @@ package body Prj.Env is if (Data.Library and then Including_Libraries) or else - (Data.Object_Directory /= No_Path + (Data.Object_Directory /= No_Path_Information and then (not Including_Libraries or else not Data.Library)) then @@ -260,19 +260,22 @@ package body Prj.Env is -- files; otherwise add the object directory. if Data.Library then - if Data.Object_Directory = No_Path + if Data.Object_Directory = No_Path_Information or else - Contains_ALI_Files (Data.Library_ALI_Dir) + Contains_ALI_Files (Data.Library_ALI_Dir.Name) then - Add_To_Path (Get_Name_String (Data.Library_ALI_Dir)); + Add_To_Path + (Get_Name_String (Data.Library_ALI_Dir.Name)); else - Add_To_Path (Get_Name_String (Data.Object_Directory)); + Add_To_Path + (Get_Name_String (Data.Object_Directory.Name)); end if; else -- For a non library project, add the object directory - Add_To_Path (Get_Name_String (Data.Object_Directory)); + Add_To_Path + (Get_Name_String (Data.Object_Directory.Name)); end if; end if; @@ -520,7 +523,7 @@ package body Prj.Env is -- If we don't know the path name of the body of this unit, -- we compute it, and we store it. - if Data.File_Names (Body_Part).Path = No_Path then + if Data.File_Names (Body_Part).Path = No_Path_Information then declare Current_Source : String_List_Id := In_Tree.Projects.Table @@ -530,7 +533,7 @@ package body Prj.Env is begin -- By default, put the file name - Data.File_Names (Body_Part).Path := + Data.File_Names (Body_Part).Path.Name := Path_Name_Type (Data.File_Names (Body_Part).Name); -- For each source directory @@ -550,7 +553,7 @@ package body Prj.Env is if Path /= null then Name_Len := Path'Length; Name_Buffer (1 .. Name_Len) := Path.all; - Data.File_Names (Body_Part).Path := Name_Enter; + Data.File_Names (Body_Part).Path.Name := Name_Enter; exit; else @@ -566,7 +569,7 @@ package body Prj.Env is -- Returned the stored value - return Namet.Get_Name_String (Data.File_Names (Body_Part).Path); + return Namet.Get_Name_String (Data.File_Names (Body_Part).Path.Name); end Body_Path_Name_Of; ------------------------ @@ -1005,13 +1008,13 @@ package body Prj.Env is -- If there is a spec, put it in the mapping if Data.Name /= No_File then - if Data.Path = Slash then + if Data.Path.Name = Slash then Fmap.Add_Forbidden_File_Name (Data.Name); else Fmap.Add_To_File_Map (Unit_Name => Unit_Name_Type (The_Unit_Data.Name), File_Name => Data.Name, - Path_Name => File_Name_Type (Data.Path)); + Path_Name => File_Name_Type (Data.Path.Name)); end if; end if; @@ -1020,13 +1023,13 @@ package body Prj.Env is -- If there is a body (or subunit) put it in the mapping if Data.Name /= No_File then - if Data.Path = Slash then + if Data.Path.Name = Slash then Fmap.Add_Forbidden_File_Name (Data.Name); else Fmap.Add_To_File_Map (Unit_Name => Unit_Name_Type (The_Unit_Data.Name), File_Name => Data.Name, - Path_Name => File_Name_Type (Data.Path)); + Path_Name => File_Name_Type (Data.Path.Name)); end if; end if; end if; @@ -1111,7 +1114,7 @@ package body Prj.Env is -- Line with the path name - Get_Name_String (Data.Path); + Get_Name_String (Data.Path.Name); Put_Name_Buffer; end Put_Data; @@ -1334,7 +1337,7 @@ package body Prj.Env is if Src_Data.Language_Name = Language and then not Src_Data.Locally_Removed and then Src_Data.Replaced_By = No_Source - and then Src_Data.Path /= No_Path + and then Src_Data.Path.Name /= No_Path then if Src_Data.Unit /= No_Name then Get_Name_String (Src_Data.Unit); @@ -1359,7 +1362,7 @@ package body Prj.Env is Get_Name_String (Src_Data.File); Put_Name_Buffer; - Get_Name_String (Src_Data.Path); + Get_Name_String (Src_Data.Path.Name); Put_Name_Buffer; end if; @@ -1542,7 +1545,7 @@ package body Prj.Env is if Full_Path then return Get_Name_String - (Unit.File_Names (Body_Part).Path); + (Unit.File_Names (Body_Part).Path.Name); else return Get_Name_String (Current_Name); @@ -1558,7 +1561,7 @@ package body Prj.Env is if Full_Path then return Get_Name_String - (Unit.File_Names (Body_Part).Path); + (Unit.File_Names (Body_Part).Path.Name); else return Extended_Body_Name; @@ -1605,7 +1608,7 @@ package body Prj.Env is if Full_Path then return Get_Name_String - (Unit.File_Names (Specification).Path); + (Unit.File_Names (Specification).Path.Name); else return Get_Name_String (Current_Name); end if; @@ -1620,7 +1623,7 @@ package body Prj.Env is if Full_Path then return Get_Name_String - (Unit.File_Names (Specification).Path); + (Unit.File_Names (Specification).Path.Name); else return Extended_Spec_Name; end if; @@ -1723,8 +1726,8 @@ package body Prj.Env is -- If there is an object directory, call Action with its name - if Data.Object_Directory /= No_Path then - Get_Name_String (Data.Display_Object_Dir); + if Data.Object_Directory /= No_Path_Information then + Get_Name_String (Data.Object_Directory.Display_Name); Action (Name_Buffer (1 .. Name_Len)); end if; @@ -1899,16 +1902,17 @@ package body Prj.Env is and then Namet.Get_Name_String (Unit.File_Names (Specification).Name) = Original_Name) - or else (Unit.File_Names (Specification).Path /= No_Path + or else (Unit.File_Names (Specification).Path /= + No_Path_Information and then Namet.Get_Name_String - (Unit.File_Names (Specification).Path) = + (Unit.File_Names (Specification).Path.Name) = Original_Name) then Project := Ultimate_Extension_Of (Project => Unit.File_Names (Specification).Project, In_Tree => In_Tree); - Path := Unit.File_Names (Specification).Display_Path; + Path := Unit.File_Names (Specification).Path.Display_Name; if Current_Verbosity > Default then Write_Str ("Done: Specification."); @@ -1921,15 +1925,15 @@ package body Prj.Env is and then Namet.Get_Name_String (Unit.File_Names (Body_Part).Name) = Original_Name) - or else (Unit.File_Names (Body_Part).Path /= No_Path + or else (Unit.File_Names (Body_Part).Path /= No_Path_Information and then Namet.Get_Name_String - (Unit.File_Names (Body_Part).Path) = + (Unit.File_Names (Body_Part).Path.Name) = Original_Name) then Project := Ultimate_Extension_Of (Project => Unit.File_Names (Body_Part).Project, In_Tree => In_Tree); - Path := Unit.File_Names (Body_Part).Display_Path; + Path := Unit.File_Names (Body_Part).Path.Display_Name; if Current_Verbosity > Default then Write_Str ("Done: Body."); @@ -2121,7 +2125,7 @@ package body Prj.Env is Write_Str (" Project: "); Get_Name_String (In_Tree.Projects.Table - (Unit.File_Names (Specification).Project).Path_Name); + (Unit.File_Names (Specification).Project).Path.Name); Write_Line (Name_Buffer (1 .. Name_Len)); end if; @@ -2139,7 +2143,7 @@ package body Prj.Env is Write_Str (" Project: "); Get_Name_String (In_Tree.Projects.Table - (Unit.File_Names (Body_Part).Project).Path_Name); + (Unit.File_Names (Body_Part).Project).Path.Name); Write_Line (Name_Buffer (1 .. Name_Len)); end if; @@ -2328,7 +2332,7 @@ package body Prj.Env is if (Data.Library and Including_Libraries) or else - (Data.Object_Directory /= No_Path + (Data.Object_Directory /= No_Path_Information and then (not Including_Libraries or else not Data.Library)) then @@ -2338,14 +2342,15 @@ package body Prj.Env is -- otherwise add the object directory. if Data.Library then - if Data.Object_Directory = No_Path - or else Contains_ALI_Files (Data.Library_ALI_Dir) + if Data.Object_Directory = No_Path_Information + or else Contains_ALI_Files + (Data.Library_ALI_Dir.Name) then Add_To_Object_Path - (Data.Library_ALI_Dir, In_Tree); + (Data.Library_ALI_Dir.Name, In_Tree); else Add_To_Object_Path - (Data.Object_Directory, In_Tree); + (Data.Object_Directory.Name, In_Tree); end if; -- For a non-library project, add the object @@ -2359,7 +2364,7 @@ package body Prj.Env is and then There_Are_Ada_Sources (In_Tree, Project) then Add_To_Object_Path - (Data.Object_Directory, In_Tree); + (Data.Object_Directory.Name, In_Tree); end if; end if; end if; @@ -2566,7 +2571,7 @@ package body Prj.Env is Data : Unit_Data := In_Tree.Units.Table (Unit); begin - if Data.File_Names (Specification).Path = No_Path then + if Data.File_Names (Specification).Path.Name = No_Path then declare Current_Source : String_List_Id := In_Tree.Projects.Table @@ -2574,7 +2579,7 @@ package body Prj.Env is Path : GNAT.OS_Lib.String_Access; begin - Data.File_Names (Specification).Path := + Data.File_Names (Specification).Path.Name := Path_Name_Type (Data.File_Names (Specification).Name); while Current_Source /= Nil_String loop @@ -2588,7 +2593,7 @@ package body Prj.Env is if Path /= null then Name_Len := Path'Length; Name_Buffer (1 .. Name_Len) := Path.all; - Data.File_Names (Specification).Path := Name_Enter; + Data.File_Names (Specification).Path.Name := Name_Enter; exit; else Current_Source := @@ -2601,7 +2606,7 @@ package body Prj.Env is end; end if; - return Namet.Get_Name_String (Data.File_Names (Specification).Path); + return Namet.Get_Name_String (Data.File_Names (Specification).Path.Name); end Spec_Path_Name_Of; --------------------------- diff --git a/gcc/ada/prj-env.ads b/gcc/ada/prj-env.ads index 83da472229f..39e369256a8 100644 --- a/gcc/ada/prj-env.ads +++ b/gcc/ada/prj-env.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2001-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2008, 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- -- @@ -85,14 +85,14 @@ package Prj.Env is function Ada_Include_Path (Project : Project_Id; In_Tree : Project_Tree_Ref) return String_Access; - -- Get the ADA_INCLUDE_PATH of a Project file. For the first call, compute - -- it and cache it. + -- Get the source search path of a Project file. For the first call, + -- compute it and cache it. function Ada_Include_Path (Project : Project_Id; In_Tree : Project_Tree_Ref; Recursive : Boolean) return String; - -- Get the ADA_INCLUDE_PATH of a Project file. If Recursive it True, + -- Get the source search path of a Project file. If Recursive it True, -- get all the source directories of the imported and modified project -- files (recursively). If Recursive is False, just get the path for the -- source directories of Project. Note: the resulting String may be empty diff --git a/gcc/ada/prj-nmsc.adb b/gcc/ada/prj-nmsc.adb index 54877c812ee..7e61f55bfdf 100644 --- a/gcc/ada/prj-nmsc.adb +++ b/gcc/ada/prj-nmsc.adb @@ -696,8 +696,7 @@ package body Prj.Nmsc is end if; if Path /= No_Path then - Src_Data.Path := Path; - Src_Data.Display_Path := Display_Path; + Src_Data.Path := (Path, Display_Path); Source_Paths_Htable.Set (In_Tree.Source_Paths_HT, Path, Id); end if; @@ -2565,7 +2564,7 @@ package body Prj.Nmsc is -- Compute the object path name - Get_Name_String (Data.Display_Object_Dir); + Get_Name_String (Data.Object_Directory.Display_Name); if Name_Buffer (Name_Len) /= Directory_Separator and then Name_Buffer (Name_Len) /= '/' @@ -2588,7 +2587,7 @@ package body Prj.Nmsc is -- Compute the dependency path name - Get_Name_String (Data.Display_Object_Dir); + Get_Name_String (Data.Object_Directory.Display_Name); if Name_Buffer (Name_Len) /= Directory_Separator and then Name_Buffer (Name_Len) /= '/' @@ -2858,7 +2857,7 @@ package body Prj.Nmsc is if Current_Verbosity = High then Write_Str (" interface: "); - Write_Line (Get_Name_String (Src_Data.Path)); + Write_Line (Get_Name_String (Src_Data.Path.Name)); end if; end if; @@ -3952,8 +3951,6 @@ package body Prj.Nmsc is -- inherit library directory. Data.Library_Dir := Extended_Data.Library_Dir; - Data.Display_Library_Dir := - Extended_Data.Display_Library_Dir; Library_Directory_Present := True; end if; end if; @@ -3994,20 +3991,20 @@ package body Prj.Nmsc is else -- Find path name (unless inherited), check that it is a directory - if Data.Library_Dir = No_Path then + if Data.Library_Dir = No_Path_Information then Locate_Directory (Project, In_Tree, File_Name_Type (Lib_Dir.Value), - Data.Display_Directory, - Data.Library_Dir, - Data.Display_Library_Dir, + Data.Directory.Display_Name, + Data.Library_Dir.Name, + Data.Library_Dir.Display_Name, Create => "library", Current_Dir => Current_Dir, Location => Lib_Dir.Location); end if; - if Data.Library_Dir = No_Path then + if Data.Library_Dir = No_Path_Information then -- Get the absolute name of the library directory that -- does not exist, to report an error. @@ -4022,7 +4019,7 @@ package body Prj.Nmsc is File_Name_Type (Lib_Dir.Value); else - Get_Name_String (Data.Display_Directory); + Get_Name_String (Data.Directory.Display_Name); if Name_Buffer (Name_Len) /= Directory_Separator then Name_Len := Name_Len + 1; @@ -4047,14 +4044,13 @@ package body Prj.Nmsc is -- The library directory cannot be the same as the Object -- directory. - elsif Data.Library_Dir = Data.Object_Directory then + elsif Data.Library_Dir.Name = Data.Object_Directory.Name then Error_Msg (Project, In_Tree, "library directory cannot be the same " & "as object directory", Lib_Dir.Location); - Data.Library_Dir := No_Path; - Data.Display_Library_Dir := No_Path; + Data.Library_Dir := No_Path_Information; else declare @@ -4071,7 +4067,9 @@ package body Prj.Nmsc is Dir_Elem := In_Tree.String_Elements.Table (Dirs_Id); Dirs_Id := Dir_Elem.Next; - if Data.Library_Dir = Path_Name_Type (Dir_Elem.Value) then + if + Data.Library_Dir.Name = Path_Name_Type (Dir_Elem.Value) + then Err_Vars.Error_Msg_File_1 := File_Name_Type (Dir_Elem.Value); Error_Msg @@ -4099,7 +4097,7 @@ package body Prj.Nmsc is In_Tree.String_Elements.Table (Dirs_Id); Dirs_Id := Dir_Elem.Next; - if Data.Library_Dir = + if Data.Library_Dir.Name = Path_Name_Type (Dir_Elem.Value) then Err_Vars.Error_Msg_File_1 := @@ -4121,15 +4119,15 @@ package body Prj.Nmsc is end if; if not OK then - Data.Library_Dir := No_Path; - Data.Display_Library_Dir := No_Path; + Data.Library_Dir := No_Path_Information; elsif Current_Verbosity = High then -- Display the Library directory in high verbosity Write_Str ("Library directory ="""); - Write_Str (Get_Name_String (Data.Display_Library_Dir)); + Write_Str + (Get_Name_String (Data.Library_Dir.Display_Name)); Write_Line (""""); end if; end; @@ -4139,7 +4137,7 @@ package body Prj.Nmsc is end if; Data.Library := - Data.Library_Dir /= No_Path + Data.Library_Dir /= No_Path_Information and then Data.Library_Name /= No_Name; @@ -4188,7 +4186,6 @@ package body Prj.Nmsc is Write_Line ("No library ALI directory specified"); end if; Data.Library_ALI_Dir := Data.Library_Dir; - Data.Display_Library_ALI_Dir := Data.Display_Library_Dir; else -- Find path name, check that it is a directory @@ -4197,14 +4194,14 @@ package body Prj.Nmsc is (Project, In_Tree, File_Name_Type (Lib_ALI_Dir.Value), - Data.Display_Directory, - Data.Library_ALI_Dir, - Data.Display_Library_ALI_Dir, + Data.Directory.Display_Name, + Data.Library_ALI_Dir.Name, + Data.Library_ALI_Dir.Display_Name, Create => "library ALI", Current_Dir => Current_Dir, Location => Lib_ALI_Dir.Location); - if Data.Library_ALI_Dir = No_Path then + if Data.Library_ALI_Dir = No_Path_Information then -- Get the absolute name of the library ALI directory that -- does not exist, to report an error. @@ -4219,7 +4216,7 @@ package body Prj.Nmsc is File_Name_Type (Lib_Dir.Value); else - Get_Name_String (Data.Display_Directory); + Get_Name_String (Data.Directory.Display_Name); if Name_Buffer (Name_Len) /= Directory_Separator then Name_Len := Name_Len + 1; @@ -4253,8 +4250,7 @@ package body Prj.Nmsc is "library 'A'L'I directory cannot be the same " & "as object directory", Lib_ALI_Dir.Location); - Data.Library_ALI_Dir := No_Path; - Data.Display_Library_ALI_Dir := No_Path; + Data.Library_ALI_Dir := No_Path_Information; else declare @@ -4271,7 +4267,7 @@ package body Prj.Nmsc is Dir_Elem := In_Tree.String_Elements.Table (Dirs_Id); Dirs_Id := Dir_Elem.Next; - if Data.Library_ALI_Dir = + if Data.Library_ALI_Dir.Name = Path_Name_Type (Dir_Elem.Value) then Err_Vars.Error_Msg_File_1 := @@ -4305,7 +4301,7 @@ package body Prj.Nmsc is In_Tree.String_Elements.Table (Dirs_Id); Dirs_Id := Dir_Elem.Next; - if Data.Library_ALI_Dir = + if Data.Library_ALI_Dir.Name = Path_Name_Type (Dir_Elem.Value) then Err_Vars.Error_Msg_File_1 := @@ -4328,8 +4324,7 @@ package body Prj.Nmsc is end if; if not OK then - Data.Library_ALI_Dir := No_Path; - Data.Display_Library_ALI_Dir := No_Path; + Data.Library_ALI_Dir := No_Path_Information; elsif Current_Verbosity = High then @@ -4338,7 +4333,8 @@ package body Prj.Nmsc is Write_Str ("Library ALI directory ="""); Write_Str - (Get_Name_String (Data.Display_Library_ALI_Dir)); + (Get_Name_String + (Data.Library_ALI_Dir.Display_Name)); Write_Line (""""); end if; end; @@ -5074,8 +5070,8 @@ package body Prj.Nmsc is In_Tree.Units.Table (The_Unit_Id); if The_Unit_Data.File_Names (Body_Part).Name /= No_File - and then The_Unit_Data.File_Names (Body_Part).Path /= - Slash + and then The_Unit_Data.File_Names + (Body_Part).Path.Name /= Slash then if Check_Project (The_Unit_Data.File_Names (Body_Part).Project, @@ -5095,7 +5091,7 @@ package body Prj.Nmsc is Src_Ind := Sinput.P.Load_Project_File (Get_Name_String (The_Unit_Data.File_Names - (Body_Part).Path)); + (Body_Part).Path.Name)); if Sinput.P.Source_File_Is_Subunit (Src_Ind) @@ -5129,7 +5125,7 @@ package body Prj.Nmsc is elsif The_Unit_Data.File_Names (Specification).Name /= No_File and then The_Unit_Data.File_Names - (Specification).Path /= Slash + (Specification).Path.Name /= Slash and then Check_Project (The_Unit_Data.File_Names (Specification).Project, @@ -5304,16 +5300,16 @@ package body Prj.Nmsc is (Project, In_Tree, Dir_Id, - Data.Display_Directory, - Data.Library_Src_Dir, - Data.Display_Library_Src_Dir, + Data.Directory.Display_Name, + Data.Library_Src_Dir.Name, + Data.Library_Src_Dir.Display_Name, Create => "library source copy", Current_Dir => Current_Dir, Location => Lib_Src_Dir.Location); -- If directory does not exist, report an error - if Data.Library_Src_Dir = No_Path then + if Data.Library_Src_Dir = No_Path_Information then -- Get the absolute name of the library directory that does -- not exist, to report an error. @@ -5327,7 +5323,7 @@ package body Prj.Nmsc is Err_Vars.Error_Msg_File_1 := Dir_Id; else - Get_Name_String (Data.Directory); + Get_Name_String (Data.Directory.Name); if Name_Buffer (Name_Len) /= Directory_Separator @@ -5362,7 +5358,7 @@ package body Prj.Nmsc is "directory to copy interfaces cannot be " & "the object directory", Lib_Src_Dir.Location); - Data.Library_Src_Dir := No_Path; + Data.Library_Src_Dir := No_Path_Information; else declare @@ -5379,7 +5375,7 @@ package body Prj.Nmsc is -- Report error if it is one of the source directories - if Data.Library_Src_Dir = + if Data.Library_Src_Dir.Name = Path_Name_Type (Src_Dir.Value) then Error_Msg @@ -5387,14 +5383,14 @@ package body Prj.Nmsc is "directory to copy interfaces cannot " & "be one of the source directories", Lib_Src_Dir.Location); - Data.Library_Src_Dir := No_Path; + Data.Library_Src_Dir := No_Path_Information; exit; end if; Src_Dirs := Src_Dir.Next; end loop; - if Data.Library_Src_Dir /= No_Path then + if Data.Library_Src_Dir /= No_Path_Information then -- It cannot be a source directory of any other -- project either. @@ -5411,7 +5407,7 @@ package body Prj.Nmsc is -- Report error if it is one of the source -- directories - if Data.Library_Src_Dir = + if Data.Library_Src_Dir.Name = Path_Name_Type (Src_Dir.Value) then Error_Msg_File_1 := @@ -5424,7 +5420,7 @@ package body Prj.Nmsc is "be the same as source directory { of " & "project %%", Lib_Src_Dir.Location); - Data.Library_Src_Dir := No_Path; + Data.Library_Src_Dir := No_Path_Information; exit Project_Loop; end if; @@ -5437,11 +5433,11 @@ package body Prj.Nmsc is -- In high verbosity, if there is a valid Library_Src_Dir, -- display its path name. - if Data.Library_Src_Dir /= No_Path + if Data.Library_Src_Dir /= No_Path_Information and then Current_Verbosity = High then Write_Str ("Directory to copy interfaces ="""); - Write_Str (Get_Name_String (Data.Library_Src_Dir)); + Write_Str (Get_Name_String (Data.Library_Src_Dir.Name)); Write_Line (""""); end if; end if; @@ -5566,7 +5562,8 @@ package body Prj.Nmsc is else if not Is_Absolute_Path (Name_Buffer (1 .. Name_Len)) then Name_Len := 0; - Add_Str_To_Name_Buffer (Get_Name_String (Data.Directory)); + Add_Str_To_Name_Buffer + (Get_Name_String (Data.Directory.Name)); Add_Char_To_Name_Buffer (Directory_Separator); Add_Str_To_Name_Buffer (Get_Name_String (Lib_Ref_Symbol_File.Value)); @@ -5615,7 +5612,7 @@ package body Prj.Nmsc is Symb_Path : constant String := Normalize_Pathname (Get_Name_String - (Data.Object_Directory) & + (Data.Object_Directory.Name) & Directory_Separator & Name_Buffer (1 .. Name_Len), Directory => Current_Dir, @@ -6376,7 +6373,7 @@ package body Prj.Nmsc is Normalize_Pathname (Name => Get_Name_String (Base_Dir), Directory => - Get_Name_String (Data.Display_Directory), + Get_Name_String (Data.Directory.Display_Name), Resolve_Links => False, Case_Sensitive => True); @@ -6428,7 +6425,7 @@ package body Prj.Nmsc is (Project => Project, In_Tree => In_Tree, Name => From, - Parent => Data.Display_Directory, + Parent => Data.Directory.Display_Name, Dir => Path_Name, Display => Display_Path_Name, Current_Dir => Current_Dir); @@ -6563,7 +6560,6 @@ package body Prj.Nmsc is -- We set the object directory to its default Data.Object_Directory := Data.Directory; - Data.Display_Object_Dir := Data.Display_Directory; if Object_Dir.Value /= Empty_String then Get_Name_String (Object_Dir.Value); @@ -6581,14 +6577,14 @@ package body Prj.Nmsc is (Project, In_Tree, File_Name_Type (Object_Dir.Value), - Data.Display_Directory, - Data.Object_Directory, - Data.Display_Object_Dir, + Data.Directory.Display_Name, + Data.Object_Directory.Name, + Data.Object_Directory.Display_Name, Create => "object", Location => Object_Dir.Location, Current_Dir => Current_Dir); - if Data.Object_Directory = No_Path then + if Data.Object_Directory = No_Path_Information then -- The object directory does not exist, report an error if the -- project is not externally built. @@ -6607,14 +6603,16 @@ package body Prj.Nmsc is -- tools that recover from errors; for example, these tools -- could create the non existent directory. - Data.Display_Object_Dir := Path_Name_Type (Object_Dir.Value); + Data.Object_Directory.Display_Name := + Path_Name_Type (Object_Dir.Value); if Osint.File_Names_Case_Sensitive then - Data.Object_Directory := Path_Name_Type (Object_Dir.Value); + Data.Object_Directory.Name := + Path_Name_Type (Object_Dir.Value); else Get_Name_String (Object_Dir.Value); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); - Data.Object_Directory := Name_Find; + Data.Object_Directory.Name := Name_Find; end if; end if; end if; @@ -6626,20 +6624,20 @@ package body Prj.Nmsc is (Project, In_Tree, Name_Find, - Data.Display_Directory, - Data.Object_Directory, - Data.Display_Object_Dir, + Data.Directory.Name, + Data.Object_Directory.Name, + Data.Object_Directory.Display_Name, Create => "object", Location => Object_Dir.Location, Current_Dir => Current_Dir); end if; if Current_Verbosity = High then - if Data.Object_Directory = No_Path then + if Data.Object_Directory = No_Path_Information then Write_Line ("No object directory"); else Write_Str ("Object directory: """); - Write_Str (Get_Name_String (Data.Display_Object_Dir)); + Write_Str (Get_Name_String (Data.Object_Directory.Display_Name)); Write_Line (""""); end if; end if; @@ -6652,7 +6650,6 @@ package body Prj.Nmsc is -- We set the object directory to its default Data.Exec_Directory := Data.Object_Directory; - Data.Display_Exec_Dir := Data.Display_Object_Dir; if Exec_Dir.Value /= Empty_String then Get_Name_String (Exec_Dir.Value); @@ -6670,14 +6667,14 @@ package body Prj.Nmsc is (Project, In_Tree, File_Name_Type (Exec_Dir.Value), - Data.Display_Directory, - Data.Exec_Directory, - Data.Display_Exec_Dir, + Data.Directory.Name, + Data.Exec_Directory.Name, + Data.Exec_Directory.Display_Name, Create => "exec", Location => Exec_Dir.Location, Current_Dir => Current_Dir); - if Data.Exec_Directory = No_Path then + if Data.Exec_Directory = No_Path_Information then Err_Vars.Error_Msg_File_1 := File_Name_Type (Exec_Dir.Value); Error_Msg (Project, In_Tree, @@ -6688,11 +6685,11 @@ package body Prj.Nmsc is end if; if Current_Verbosity = High then - if Data.Exec_Directory = No_Path then + if Data.Exec_Directory = No_Path_Information then Write_Line ("No exec directory"); else Write_Str ("Exec directory: """); - Write_Str (Get_Name_String (Data.Display_Exec_Dir)); + Write_Str (Get_Name_String (Data.Exec_Directory.Display_Name)); Write_Line (""""); end if; end if; @@ -6721,7 +6718,7 @@ package body Prj.Nmsc is if Data.Extends = No_Project and then Data.Object_Directory = Data.Directory then - Data.Object_Directory := No_Path; + Data.Object_Directory := No_Path_Information; end if; elsif Source_Dirs.Default then @@ -6734,8 +6731,8 @@ package body Prj.Nmsc is Data.Source_Dirs := String_Element_Table.Last (In_Tree.String_Elements); In_Tree.String_Elements.Table (Data.Source_Dirs) := - (Value => Name_Id (Data.Directory), - Display_Value => Name_Id (Data.Display_Directory), + (Value => Name_Id (Data.Directory.Name), + Display_Value => Name_Id (Data.Directory.Display_Name), Location => No_Location, Flag => False, Next => Nil_String, @@ -6744,7 +6741,7 @@ package body Prj.Nmsc is if Current_Verbosity = High then Write_Line ("Single source directory:"); Write_Str (" """); - Write_Str (Get_Name_String (Data.Display_Directory)); + Write_Str (Get_Name_String (Data.Directory.Display_Name)); Write_Line (""""); end if; @@ -6765,7 +6762,7 @@ package body Prj.Nmsc is if Data.Extends = No_Project and then Data.Object_Directory = Data.Directory then - Data.Object_Directory := No_Path; + Data.Object_Directory := No_Path_Information; end if; Data.Source_Dirs := Nil_String; @@ -7541,7 +7538,7 @@ package body Prj.Nmsc is Path_Name_Of (File_Name_Type (Excluded_Source_List_File.Value), - Data.Directory); + Data.Directory.Name); begin if Source_File_Path_Name'Length = 0 then @@ -7681,7 +7678,7 @@ package body Prj.Nmsc is if Data.Extends = No_Project and then Data.Object_Directory = Data.Directory then - Data.Object_Directory := No_Path; + Data.Object_Directory := No_Path_Information; end if; end if; end if; @@ -7774,7 +7771,7 @@ package body Prj.Nmsc is declare Source_File_Path_Name : constant String := Path_Name_Of - (File_Name_Type (Source_List_File.Value), Data.Directory); + (File_Name_Type (Source_List_File.Value), Data.Directory.Name); begin if Source_File_Path_Name'Length = 0 then @@ -7852,7 +7849,7 @@ package body Prj.Nmsc is Src_Data := In_Tree.Sources.Table (Source); if Src_Data.Naming_Exception - and then Src_Data.Path = No_Path + and then Src_Data.Path = No_Path_Information then if Src_Data.Unit /= No_Name then Error_Msg_Name_1 := Name_Id (Src_Data.Display_File); @@ -8528,9 +8525,8 @@ package body Prj.Nmsc is Check_Name := True; else - In_Tree.Sources.Table (Name_Loc.Source).Path := Path_Id; - In_Tree.Sources.Table - (Name_Loc.Source).Display_Path := Display_Path_Id; + In_Tree.Sources.Table (Name_Loc.Source).Path := + (Path_Id, Display_Path_Id); Source_Paths_Htable.Set (In_Tree.Source_Paths_HT, @@ -8658,7 +8654,7 @@ package body Prj.Nmsc is Error_Msg_Name_1 := In_Tree.Projects.Table (Src_Data.Project).Name; - Error_Msg_Name_2 := Name_Id (Src_Data.Display_Path); + Error_Msg_Name_2 := Name_Id (Src_Data.Path.Display_Name); Error_Msg (Project, In_Tree, "\ project %%, %%", No_Location); @@ -8875,7 +8871,7 @@ package body Prj.Nmsc is if Extended = Project or else Project_Extends (Project, Extended, In_Tree) then - Unit.File_Names (Kind).Path := Slash; + Unit.File_Names (Kind).Path.Name := Slash; Unit.File_Names (Kind).Needs_Pragma := False; In_Tree.Units.Table (Index) := Unit; Add_Forbidden_File_Name @@ -9196,7 +9192,7 @@ package body Prj.Nmsc is Src_Ind : constant Source_File_Index := Sinput.P.Load_Project_File (Get_Name_String - (Src_Data.Path)); + (Src_Data.Path.Name)); begin if Sinput.P.Source_File_Is_Subunit @@ -9497,14 +9493,17 @@ package body Prj.Nmsc is if (The_Unit_Data.File_Names (Unit_Kind).Name = Canonical_File_Name and then - The_Unit_Data.File_Names (Unit_Kind).Path = Slash) + The_Unit_Data.File_Names + (Unit_Kind).Path.Name = Slash) or else The_Unit_Data.File_Names (Unit_Kind).Name = No_File or else Project_Extends (Data.Extends, The_Unit_Data.File_Names (Unit_Kind).Project, In_Tree) then - if The_Unit_Data.File_Names (Unit_Kind).Path = Slash then + if + The_Unit_Data.File_Names (Unit_Kind).Path.Name = Slash + then Remove_Forbidden_File_Name (The_Unit_Data.File_Names (Unit_Kind).Name); end if; @@ -9521,8 +9520,7 @@ package body Prj.Nmsc is (Name => Canonical_File_Name, Index => Unit_Ind, Display_Name => File_Name, - Path => Canonical_Path_Name, - Display_Path => Path_Name, + Path => (Canonical_Path_Name, Path_Name), Project => Project, Needs_Pragma => Needs_Pragma); In_Tree.Units.Table (The_Unit) := The_Unit_Data; @@ -9531,8 +9529,8 @@ package body Prj.Nmsc is elsif The_Unit_Data.File_Names (Unit_Kind).Project = Project and then (Data.Known_Order_Of_Source_Dirs or else - The_Unit_Data.File_Names (Unit_Kind).Path = - Canonical_Path_Name) + The_Unit_Data.File_Names + (Unit_Kind).Path.Name = Canonical_Path_Name) then if Previous_Source = Nil_String then Data.Ada_Sources := Nil_String; @@ -9564,7 +9562,7 @@ package body Prj.Nmsc is (The_Unit_Data.File_Names (Unit_Kind).Project).Name; Err_Vars.Error_Msg_File_1 := File_Name_Type - (The_Unit_Data.File_Names (Unit_Kind).Path); + (The_Unit_Data.File_Names (Unit_Kind).Path.Name); Error_Msg (Project, In_Tree, "\ project file %%, {", The_Location); @@ -9614,8 +9612,7 @@ package body Prj.Nmsc is (Name => Canonical_File_Name, Index => Unit_Ind, Display_Name => File_Name, - Path => Canonical_Path_Name, - Display_Path => Path_Name, + Path => (Canonical_Path_Name, Path_Name), Project => Project, Needs_Pragma => Needs_Pragma); In_Tree.Units.Table (The_Unit) := The_Unit_Data; diff --git a/gcc/ada/prj-proc.adb b/gcc/ada/prj-proc.adb index 13f1d947804..67ae8ba85f0 100644 --- a/gcc/ada/prj-proc.adb +++ b/gcc/ada/prj-proc.adb @@ -2315,13 +2315,13 @@ package body Prj.Proc is declare Object_Dir : constant Path_Name_Type := In_Tree.Projects.Table - (Project).Object_Directory; + (Project).Object_Directory.Name; begin for Index in Project_Table.First .. Project_Table.Last (In_Tree.Projects) loop if In_Tree.Projects.Table (Index).Virtual then - In_Tree.Projects.Table (Index).Object_Directory := + In_Tree.Projects.Table (Index).Object_Directory.Name := Object_Dir; end if; end loop; @@ -2338,7 +2338,7 @@ package body Prj.Proc is Extending := In_Tree.Projects.Table (Proj).Extended_By; if Extending /= No_Project then - Obj_Dir := In_Tree.Projects.Table (Proj).Object_Directory; + Obj_Dir := In_Tree.Projects.Table (Proj).Object_Directory.Name; -- Check that a project being extended does not share its -- object directory with any project that extends it, directly @@ -2351,8 +2351,8 @@ package body Prj.Proc is if In_Tree.Projects.Table (Extending2).Ada_Sources /= Nil_String and then - In_Tree.Projects.Table (Extending2).Object_Directory = - Obj_Dir + In_Tree.Projects.Table + (Extending2).Object_Directory.Name = Obj_Dir then if In_Tree.Projects.Table (Extending2).Virtual then Error_Msg_Name_1 := @@ -2562,20 +2562,20 @@ package body Prj.Proc is Processed_Data.Display_Name := Name_Find; end if; - Processed_Data.Display_Path_Name := + Processed_Data.Path.Display_Name := Path_Name_Of (From_Project_Node, From_Project_Node_Tree); - Get_Name_String (Processed_Data.Display_Path_Name); + Get_Name_String (Processed_Data.Path.Display_Name); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); - Processed_Data.Path_Name := Name_Find; + Processed_Data.Path.Name := Name_Find; Processed_Data.Location := Location_Of (From_Project_Node, From_Project_Node_Tree); - Processed_Data.Display_Directory := + Processed_Data.Directory.Display_Name := Directory_Of (From_Project_Node, From_Project_Node_Tree); - Get_Name_String (Processed_Data.Display_Directory); + Get_Name_String (Processed_Data.Directory.Display_Name); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); - Processed_Data.Directory := Name_Find; + Processed_Data.Directory.Name := Name_Find; Processed_Data.Extended_By := Extended_By; diff --git a/gcc/ada/prj.adb b/gcc/ada/prj.adb index 0435509988e..d838b114442 100644 --- a/gcc/ada/prj.adb +++ b/gcc/ada/prj.adb @@ -95,21 +95,16 @@ package body Prj is First_Referred_By => No_Project, Name => No_Name, Display_Name => No_Name, - Path_Name => No_Path, - Display_Path_Name => No_Path, + Path => No_Path_Information, Virtual => False, Location => No_Location, Mains => Nil_String, - Directory => No_Path, - Display_Directory => No_Path, + Directory => No_Path_Information, Dir_Path => null, Library => False, - Library_Dir => No_Path, - Display_Library_Dir => No_Path, - Library_Src_Dir => No_Path, - Display_Library_Src_Dir => No_Path, - Library_ALI_Dir => No_Path, - Display_Library_ALI_Dir => No_Path, + Library_Dir => No_Path_Information, + Library_Src_Dir => No_Path_Information, + Library_ALI_Dir => No_Path_Information, Library_Name => No_Name, Library_Kind => Static, Lib_Internal_Name => No_Name, @@ -131,11 +126,9 @@ package body Prj is Include_Language => No_Language_Index, Source_Dirs => Nil_String, Known_Order_Of_Source_Dirs => True, - Object_Directory => No_Path, - Display_Object_Dir => No_Path, + Object_Directory => No_Path_Information, Library_TS => Empty_Time_Stamp, - Exec_Directory => No_Path, - Display_Exec_Dir => No_Path, + Exec_Directory => No_Path_Information, Extends => No_Project, Extended_By => No_Project, Naming => Std_Naming_Data, diff --git a/gcc/ada/prj.ads b/gcc/ada/prj.ads index a27e3a31f81..edeb3ace65c 100644 --- a/gcc/ada/prj.ads +++ b/gcc/ada/prj.ads @@ -150,6 +150,13 @@ package Prj is function Empty_String return Name_Id; -- Return the id for an empty string "" + type Path_Information is record + Name : Path_Name_Type := No_Path; + Display_Name : Path_Name_Type := No_Path; + end record; + + No_Path_Information : constant Path_Information := (No_Path, No_Path); + type Project_Id is new Nat; No_Project : constant Project_Id := 0; -- Id of a Project File @@ -672,11 +679,8 @@ package Prj is Display_File : File_Name_Type := No_File; -- File name of the source, for display purposes - Path : Path_Name_Type := No_Path; - -- Canonical path name of the source - - Display_Path : Path_Name_Type := No_Path; - -- Path name of the source, for display purposes + Path : Path_Information := No_Path_Information; + -- Path name of the source Source_TS : Time_Stamp_Type := Empty_Time_Stamp; -- Time stamp of the source file @@ -756,8 +760,7 @@ package Prj is Replaced_By => No_Source, File => No_File, Display_File => No_File, - Path => No_Path, - Display_Path => No_Path, + Path => No_Path_Information, Source_TS => Empty_Time_Stamp, Object_Project => No_Project, Object_Exists => True, @@ -1252,6 +1255,17 @@ package Prj is -- separator. type Project_Data is record + + ------------- + -- General -- + ------------- + + Name : Name_Id := No_Name; + -- The name of the project + + Display_Name : Name_Id := No_Name; + -- The name of the project with the spelling of its declaration + Qualifier : Project_Qualifier := Unspecified; -- The eventual qualifier for this project @@ -1259,90 +1273,115 @@ package Prj is -- True if the project is externally built. In such case, the Project -- Manager will not modify anything in this project. + Config : Project_Configuration; + + Path : Path_Information := No_Path_Information; + -- The path name of the project file + + Virtual : Boolean := False; + -- True for virtual extending projects + + Location : Source_Ptr := No_Location; + -- The location in the project file source of the reserved word project + + Naming : Naming_Data := Standard_Naming_Data; + -- The naming scheme of this project file + + --------------- + -- Languages -- + --------------- + Languages : Name_List_Index := No_Name_List; -- The list of languages of the sources of this project - Config : Project_Configuration; + Include_Language : Language_Index := No_Language_Index; + + First_Language_Processing : Language_Index := No_Language_Index; + -- First index of the language data in the project + + Unit_Based_Language_Name : Name_Id := No_Name; + Unit_Based_Language_Index : Language_Index := No_Language_Index; + -- The name and index, if any, of the unit-based language of some + -- sources of the project. There may be only one unit-based language + -- in one project. + + -------------- + -- Projects -- + -------------- First_Referred_By : Project_Id := No_Project; -- The project, if any, that was the first to be known as importing or -- extending this project - Name : Name_Id := No_Name; - -- The name of the project + Mains : String_List_Id := Nil_String; + -- List of mains specified by attribute Main - Display_Name : Name_Id := No_Name; - -- The name of the project with the spelling of its declaration + Extends : Project_Id := No_Project; + -- The reference of the project file, if any, that this project file + -- extends. - Path_Name : Path_Name_Type := No_Path; - -- The path name of the project file + Extended_By : Project_Id := No_Project; + -- The reference of the project file, if any, that extends this project + -- file. - Display_Path_Name : Path_Name_Type := No_Path; - -- The path name used for display purposes. May be different from - -- Path_Name for platforms where the file names are case-insensitive. + Decl : Declarations := No_Declarations; + -- The declarations (variables, attributes and packages) of this project + -- file. - Virtual : Boolean := False; - -- True for virtual extending projects + Imported_Projects : Project_List := Empty_Project_List; + -- The list of all directly imported projects, if any - Location : Source_Ptr := No_Location; - -- The location in the project file source of the reserved word project + All_Imported_Projects : Project_List := Empty_Project_List; + -- The list of all projects imported directly or indirectly, if any - Mains : String_List_Id := Nil_String; - -- List of mains specified by attribute Main + ----------------- + -- Directories -- + ----------------- - Directory : Path_Name_Type := No_Path; + Directory : Path_Information := No_Path_Information; -- Path name of the directory where the project file resides - Display_Directory : Path_Name_Type := No_Path; - -- The path name of the project directory, for display purposes. May be - -- different from Directory for platforms where the file names are - -- case-insensitive. - Dir_Path : String_Access; - -- Same as Directory, but as an access to String + -- Same as Directory.Name, but as an access to String + + Object_Directory : Path_Information := No_Path_Information; + -- The path name of the object directory of this project file + + Exec_Directory : Path_Information := No_Path_Information; + -- The path name of the exec directory of this project file. Default is + -- equal to Object_Directory. + + ------------- + -- Library -- + ------------- + + Library : Boolean := False; + -- True if this is a library project + + Library_Name : Name_Id := No_Name; + -- If a library project, name of the library - Library_Dir : Path_Name_Type := No_Path; + Library_Kind : Lib_Kind := Static; + -- If a library project, kind of library + + Library_Dir : Path_Information := No_Path_Information; -- If a library project, path name of the directory where the library -- resides. - Display_Library_Dir : Path_Name_Type := No_Path; - -- The path name of the library directory, for display purposes. May be - -- different from Library_Dir for platforms where the file names are - -- case-insensitive. - Library_TS : Time_Stamp_Type := Empty_Time_Stamp; -- The timestamp of a library file in a library project - Library_Src_Dir : Path_Name_Type := No_Path; + Library_Src_Dir : Path_Information := No_Path_Information; -- If a Stand-Alone Library project, path name of the directory where -- the sources of the interfaces of the library are copied. By default, -- if attribute Library_Src_Dir is not specified, sources of the -- interfaces are not copied anywhere. - Display_Library_Src_Dir : Path_Name_Type := No_Path; - -- The path name of the library source directory, for display purposes. - -- May be different from Library_Src_Dir for platforms where the file - -- names are case-insensitive. - - Library_ALI_Dir : Path_Name_Type := No_Path; + Library_ALI_Dir : Path_Information := No_Path_Information; -- In a library project, path name of the directory where the ALI files -- are copied. If attribute Library_ALI_Dir is not specified, ALI files -- are copied in the Library_Dir. - Display_Library_ALI_Dir : Path_Name_Type := No_Path; - -- The path name of the library ALI directory, for display purposes. May - -- be different from Library_ALI_Dir for platforms where the file names - -- are case-insensitive. - - Library : Boolean := False; - -- True if this is a library project - - Library_Name : Name_Id := No_Name; - -- If a library project, name of the library - - Library_Kind : Lib_Kind := Static; - -- If a library project, kind of library - Lib_Internal_Name : Name_Id := No_Name; -- If a library project, internal name store inside the library @@ -1357,12 +1396,17 @@ package Prj is -- For non static Stand-Alone Library Project Files, indicate if -- the library initialisation should be automatic. - Libgnarl_Needed : Yes_No_Unknown := Unknown; - -- Set to True when libgnarl is needed to link - Symbol_Data : Symbol_Record := No_Symbols; -- Symbol file name, reference symbol file name, symbol policy + Need_To_Build_Lib : Boolean := False; + -- Indicates that the library of a Library Project needs to be built or + -- rebuilt. + + ------------- + -- Sources -- + ------------- + Ada_Sources : String_List_Id := Nil_String; -- The list of all the Ada source file names (gnatmake only) @@ -1377,19 +1421,15 @@ package Prj is -- True if attribute Interfaces is declared for the project or any -- project it extends. - Unit_Based_Language_Name : Name_Id := No_Name; - Unit_Based_Language_Index : Language_Index := No_Language_Index; - -- The name and index, if any, of the unit-based language of some - -- sources of the project. There may be only one unit-based language - -- in one project. - Imported_Directories_Switches : Argument_List_Access := null; -- List of the source search switches (-I) to be used when -- compiling. Include_Path : String_Access := null; - -- Value of the environment variable to indicate the source search path, - -- instead of a list of switches (Imported_Directories_Switches). + -- The search source path for the project. Used as the value for an + -- environment variable, specified by attribute Include_Path + -- (). The names of the environment variables are in component + -- Include_Path of the records Language_Config. Include_Path_File : Path_Name_Type := No_Path; -- The path name of the of the source search directory file @@ -1397,8 +1437,6 @@ package Prj is Include_Data_Set : Boolean := False; -- Set True when Imported_Directories_Switches or Include_Path are set - Include_Language : Language_Index := No_Language_Index; - Source_Dirs : String_List_Id := Nil_String; -- The list of all the source directories @@ -1407,57 +1445,38 @@ package Prj is -- the ordering of the source subdirs depend on the OS. If True, -- duplicate file names in the same project file are allowed. - Object_Directory : Path_Name_Type := No_Path; - -- The path name of the object directory of this project file - - Display_Object_Dir : Path_Name_Type := No_Path; - -- The path name of the object directory, for display purposes. May be - -- different from Object_Directory for platforms where the file names - -- are case-insensitive. - - Exec_Directory : Path_Name_Type := No_Path; - -- The path name of the exec directory of this project file. Default is - -- equal to Object_Directory. - - Display_Exec_Dir : Path_Name_Type := No_Path; - -- The path name of the exec directory, for display purposes. May be - -- different from Exec_Directory for platforms where the file names are - -- case-insensitive. - - Extends : Project_Id := No_Project; - -- The reference of the project file, if any, that this project file - -- extends. - - Extended_By : Project_Id := No_Project; - -- The reference of the project file, if any, that extends this project - -- file. - - Naming : Naming_Data := Standard_Naming_Data; - -- The naming scheme of this project file + Ada_Include_Path : String_Access := null; + -- The cached value of source search path for this project file. Set by + -- the first call to Prj.Env.Ada_Include_Path for the project. Do not + -- use this field directly outside of the project manager, use + -- Prj.Env.Ada_Include_Path instead. - First_Language_Processing : Language_Index := No_Language_Index; - -- First index of the language data in the project + ------------- + -- Linking -- + ------------- - Decl : Declarations := No_Declarations; - -- The declarations (variables, attributes and packages) of this project - -- file. + Linker_Name : File_Name_Type := No_File; + -- Value of attribute Language_Processing'Linker in the project file - Imported_Projects : Project_List := Empty_Project_List; - -- The list of all directly imported projects, if any + Linker_Path : Path_Name_Type := No_Path; + -- Path of linker when attribute Language_Processing'Linker is specified - All_Imported_Projects : Project_List := Empty_Project_List; - -- The list of all projects imported directly or indirectly, if any + Minimum_Linker_Options : Name_List_Index := No_Name_List; + -- List of options specified in attribute + -- Language_Processing'Minimum_Linker_Options. - Ada_Include_Path : String_Access := null; - -- The cached value of ADA_INCLUDE_PATH for this project file. Do not - -- use this field directly outside of the compiler, use - -- Prj.Env.Ada_Include_Path instead. + ------------------- + -- Miscellaneous -- + ------------------- Ada_Objects_Path : String_Access := null; -- The cached value of ADA_OBJECTS_PATH for this project file. Do not -- use this field directly outside of the compiler, use -- Prj.Env.Ada_Objects_Path instead. + Libgnarl_Needed : Yes_No_Unknown := Unknown; + -- Set to True when libgnarl is needed to link + Objects_Path : String_Access := null; -- The cached value of the object dir path, used during the binding -- phase of gprbuild. @@ -1477,16 +1496,6 @@ package Prj is -- An indication that the configuration pragmas file is a temporary file -- that must be deleted at the end. - Linker_Name : File_Name_Type := No_File; - -- Value of attribute Language_Processing'Linker in the project file - - Linker_Path : Path_Name_Type := No_Path; - -- Path of linker when attribute Language_Processing'Linker is specified - - Minimum_Linker_Options : Name_List_Index := No_Name_List; - -- List of options specified in attribute - -- Language_Processing'Minimum_Linker_Options. - Config_Checked : Boolean := False; -- A flag to avoid checking repetitively the configuration pragmas file @@ -1498,10 +1507,6 @@ package Prj is -- A flag to mark a project as "visited" to avoid processing the same -- project several time. - Need_To_Build_Lib : Boolean := False; - -- Indicates that the library of a Library Project needs to be built or - -- rebuilt. - Depth : Natural := 0; -- The maximum depth of a project in the project graph. Depth of main -- project is 0. @@ -1575,13 +1580,12 @@ package Prj is type Spec_Or_Body is (Specification, Body_Part); type File_Name_Data is record - Name : File_Name_Type := No_File; - Index : Int := 0; - Display_Name : File_Name_Type := No_File; - Path : Path_Name_Type := No_Path; - Display_Path : Path_Name_Type := No_Path; - Project : Project_Id := No_Project; - Needs_Pragma : Boolean := False; + Name : File_Name_Type := No_File; + Index : Int := 0; + Display_Name : File_Name_Type := No_File; + Path : Path_Information := No_Path_Information; + Project : Project_Id := No_Project; + Needs_Pragma : Boolean := False; end record; -- File and Path name of a spec or body