1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 2001-2014, Free Software Foundation, Inc. --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 ------------------------------------------------------------------------------
27 with Osint
; use Osint
;
28 with Output
; use Output
;
31 with Prj
.Err
; use Prj
.Err
;
32 with Snames
; use Snames
;
33 with Uintp
; use Uintp
;
35 with Ada
.Characters
.Handling
; use Ada
.Characters
.Handling
;
36 with Ada
.Containers
.Ordered_Sets
;
37 with Ada
.Unchecked_Deallocation
;
39 with GNAT
.Case_Util
; use GNAT
.Case_Util
;
40 with GNAT
.Directory_Operations
; use GNAT
.Directory_Operations
;
46 type Restricted_Lang_Access
is access Restricted_Lang
;
47 type Restricted_Lang
is record
49 Next
: Restricted_Lang_Access
;
52 Restricted_Languages
: Restricted_Lang_Access
:= null;
53 -- When null, all languages are allowed, otherwise only the languages in
54 -- the list are allowed.
56 Object_Suffix
: constant String := Get_Target_Object_Suffix
.all;
57 -- File suffix for object files
59 Initial_Buffer_Size
: constant := 100;
60 -- Initial size for extensible buffer used in Add_To_Buffer
62 The_Empty_String
: Name_Id
:= No_Name
;
63 The_Dot_String
: Name_Id
:= No_Name
;
65 Debug_Level
: Integer := 0;
66 -- Current indentation level for debug traces
68 type Cst_String_Access
is access constant String;
70 All_Lower_Case_Image
: aliased constant String := "lowercase";
71 All_Upper_Case_Image
: aliased constant String := "UPPERCASE";
72 Mixed_Case_Image
: aliased constant String := "MixedCase";
74 The_Casing_Images
: constant array (Known_Casing
) of Cst_String_Access
:=
75 (All_Lower_Case
=> All_Lower_Case_Image
'Access,
76 All_Upper_Case
=> All_Upper_Case_Image
'Access,
77 Mixed_Case
=> Mixed_Case_Image
'Access);
79 procedure Free
(Project
: in out Project_Id
);
80 -- Free memory allocated for Project
82 procedure Free_List
(Languages
: in out Language_Ptr
);
83 procedure Free_List
(Source
: in out Source_Id
);
84 procedure Free_List
(Languages
: in out Language_List
);
85 -- Free memory allocated for the list of languages or sources
87 procedure Reset_Units_In_Table
(Table
: in out Units_Htable
.Instance
);
88 -- Resets all Units to No_Unit_Index Unit.File_Names (Spec).Unit &
89 -- Unit.File_Names (Impl).Unit in the given table.
91 procedure Free_Units
(Table
: in out Units_Htable
.Instance
);
92 -- Free memory allocated for unit information in the project
94 procedure Language_Changed
(Iter
: in out Source_Iterator
);
95 procedure Project_Changed
(Iter
: in out Source_Iterator
);
96 -- Called when a new project or language was selected for this iterator
98 function Contains_ALI_Files
(Dir
: Path_Name_Type
) return Boolean;
99 -- Return True if there is at least one ALI file in the directory Dir
101 -----------------------------
102 -- Add_Restricted_Language --
103 -----------------------------
105 procedure Add_Restricted_Language
(Name
: String) is
106 N
: String (1 .. Name
'Length) := Name
;
110 Add_Str_To_Name_Buffer
(N
);
111 Restricted_Languages
:=
112 new Restricted_Lang
'(Name => Name_Find, Next => Restricted_Languages);
113 end Add_Restricted_Language;
115 -------------------------------------
116 -- Remove_All_Restricted_Languages --
117 -------------------------------------
119 procedure Remove_All_Restricted_Languages is
121 Restricted_Languages := null;
122 end Remove_All_Restricted_Languages;
128 procedure Add_To_Buffer
130 To : in out String_Access;
131 Last : in out Natural)
135 To := new String (1 .. Initial_Buffer_Size);
139 -- If Buffer is too small, double its size
141 while Last + S'Length > To'Last loop
143 New_Buffer : constant String_Access :=
144 new String (1 .. 2 * To'Length);
146 New_Buffer (1 .. Last) := To (1 .. Last);
152 To (Last + 1 .. Last + S'Length) := S;
153 Last := Last + S'Length;
156 ---------------------------------
157 -- Current_Object_Path_File_Of --
158 ---------------------------------
160 function Current_Object_Path_File_Of
161 (Shared : Shared_Project_Tree_Data_Access) return Path_Name_Type
164 return Shared.Private_Part.Current_Object_Path_File;
165 end Current_Object_Path_File_Of;
167 ---------------------------------
168 -- Current_Source_Path_File_Of --
169 ---------------------------------
171 function Current_Source_Path_File_Of
172 (Shared : Shared_Project_Tree_Data_Access)
173 return Path_Name_Type is
175 return Shared.Private_Part.Current_Source_Path_File;
176 end Current_Source_Path_File_Of;
178 ---------------------------
179 -- Delete_Temporary_File --
180 ---------------------------
182 procedure Delete_Temporary_File
183 (Shared : Shared_Project_Tree_Data_Access := null;
184 Path : Path_Name_Type)
187 pragma Warnings (Off, Dont_Care);
190 if not Opt.Keep_Temporary_Files then
191 if Current_Verbosity = High then
192 Write_Line ("Removing temp file: " & Get_Name_String (Path));
195 Delete_File (Get_Name_String (Path), Dont_Care);
197 if Shared /= null then
199 1 .. Temp_Files_Table.Last (Shared.Private_Part.Temp_Files)
201 if Shared.Private_Part.Temp_Files.Table (Index) = Path then
202 Shared.Private_Part.Temp_Files.Table (Index) := No_Path;
207 end Delete_Temporary_File;
209 ------------------------------
210 -- Delete_Temp_Config_Files --
211 ------------------------------
213 procedure Delete_Temp_Config_Files (Project_Tree : Project_Tree_Ref) is
215 pragma Warnings (Off, Success);
220 if not Opt.Keep_Temporary_Files then
221 if Project_Tree /= null then
222 Proj := Project_Tree.Projects;
223 while Proj /= null loop
224 if Proj.Project.Config_File_Temp then
225 Delete_Temporary_File
226 (Project_Tree.Shared, Proj.Project.Config_File_Name);
228 -- Make sure that we don't have a config file for this
229 -- project, in case there are several mains. In this case,
230 -- we will recreate another config file: we cannot reuse the
231 -- one that we just deleted.
233 Proj.Project.Config_Checked := False;
234 Proj.Project.Config_File_Name := No_Path;
235 Proj.Project.Config_File_Temp := False;
242 end Delete_Temp_Config_Files;
244 ---------------------------
245 -- Delete_All_Temp_Files --
246 ---------------------------
248 procedure Delete_All_Temp_Files
249 (Shared : Shared_Project_Tree_Data_Access)
252 pragma Warnings (Off, Dont_Care);
254 Path : Path_Name_Type;
257 if not Opt.Keep_Temporary_Files then
259 1 .. Temp_Files_Table.Last (Shared.Private_Part.Temp_Files)
261 Path := Shared.Private_Part.Temp_Files.Table (Index);
263 if Path /= No_Path then
264 if Current_Verbosity = High then
265 Write_Line ("Removing temp file: "
266 & Get_Name_String (Path));
269 Delete_File (Get_Name_String (Path), Dont_Care);
273 Temp_Files_Table.Free (Shared.Private_Part.Temp_Files);
274 Temp_Files_Table.Init (Shared.Private_Part.Temp_Files);
277 -- If any of the environment variables ADA_PRJ_INCLUDE_FILE or
278 -- ADA_PRJ_OBJECTS_FILE has been set, then reset their value to
281 if Shared.Private_Part.Current_Source_Path_File /= No_Path then
282 Setenv (Project_Include_Path_File, "");
285 if Shared.Private_Part.Current_Object_Path_File /= No_Path then
286 Setenv (Project_Objects_Path_File, "");
288 end Delete_All_Temp_Files;
290 ---------------------
291 -- Dependency_Name --
292 ---------------------
294 function Dependency_Name
295 (Source_File_Name : File_Name_Type;
296 Dependency : Dependency_File_Kind) return File_Name_Type
304 return Extend_Name (Source_File_Name, Makefile_Dependency_Suffix);
306 when ALI_File | ALI_Closure =>
307 return Extend_Name (Source_File_Name, ALI_Dependency_Suffix);
315 function Dot_String return Name_Id is
317 return The_Dot_String;
324 function Empty_File return File_Name_Type is
326 return File_Name_Type (The_Empty_String);
333 function Empty_Project
334 (Qualifier : Project_Qualifier) return Project_Data
337 Prj.Initialize (Tree => No_Project_Tree);
340 Data : Project_Data (Qualifier => Qualifier);
343 -- Only the fields for which no default value could be provided in
344 -- prj.ads are initialized below.
346 Data.Config := Default_Project_Config;
355 function Empty_String return Name_Id is
357 return The_Empty_String;
364 procedure Expect (The_Token : Token_Type; Token_Image : String) is
366 if Token /= The_Token then
368 -- ??? Should pass user flags here instead
370 Error_Msg (Gnatmake_Flags, Token_Image & " expected", Token_Ptr);
379 (File : File_Name_Type;
380 With_Suffix : String) return File_Name_Type
385 Get_Name_String (File);
386 Last := Name_Len + 1;
388 while Name_Len /= 0 and then Name_Buffer (Name_Len) /= '.' loop
389 Name_Len := Name_Len - 1;
392 if Name_Len <= 1 then
396 for J in With_Suffix'Range loop
397 Name_Buffer (Name_Len) := With_Suffix (J);
398 Name_Len := Name_Len + 1;
401 Name_Len := Name_Len - 1;
405 -------------------------
406 -- Is_Allowed_Language --
407 -------------------------
409 function Is_Allowed_Language (Name : Name_Id) return Boolean is
410 R : Restricted_Lang_Access := Restricted_Languages;
411 Lang : constant String := Get_Name_String (Name);
419 if Get_Name_String (R.Name) = Lang then
428 end Is_Allowed_Language;
430 ---------------------
431 -- Project_Changed --
432 ---------------------
434 procedure Project_Changed (Iter : in out Source_Iterator) is
436 if Iter.Project /= null then
437 Iter.Language := Iter.Project.Project.Languages;
438 Language_Changed (Iter);
442 ----------------------
443 -- Language_Changed --
444 ----------------------
446 procedure Language_Changed (Iter : in out Source_Iterator) is
448 Iter.Current := No_Source;
450 if Iter.Language_Name /= No_Name then
451 while Iter.Language /= null
452 and then Iter.Language.Name /= Iter.Language_Name
454 Iter.Language := Iter.Language.Next;
458 -- If there is no matching language in this project, move to next
460 if Iter.Language = No_Language_Index then
461 if Iter.All_Projects then
463 Iter.Project := Iter.Project.Next;
464 exit when Iter.Project = null
465 or else Iter.Encapsulated_Libs
466 or else not Iter.Project.From_Encapsulated_Lib;
469 Project_Changed (Iter);
471 Iter.Project := null;
475 Iter.Current := Iter.Language.First_Source;
477 if Iter.Current = No_Source then
478 Iter.Language := Iter.Language.Next;
479 Language_Changed (Iter);
481 elsif not Iter.Locally_Removed
482 and then Iter.Current.Locally_Removed
487 end Language_Changed;
489 ---------------------
490 -- For_Each_Source --
491 ---------------------
493 function For_Each_Source
494 (In_Tree : Project_Tree_Ref;
495 Project : Project_Id := No_Project;
496 Language : Name_Id := No_Name;
497 Encapsulated_Libs : Boolean := True;
498 Locally_Removed : Boolean := True) return Source_Iterator
500 Iter : Source_Iterator;
502 Iter := Source_Iterator'
504 Project
=> In_Tree
.Projects
,
505 All_Projects
=> Project
= No_Project
,
506 Language_Name
=> Language
,
507 Language
=> No_Language_Index
,
508 Current
=> No_Source
,
509 Encapsulated_Libs
=> Encapsulated_Libs
,
510 Locally_Removed
=> Locally_Removed
);
512 if Project
/= null then
513 while Iter
.Project
/= null
514 and then Iter
.Project
.Project
/= Project
516 Iter
.Project
:= Iter
.Project
.Next
;
520 while not Iter
.Encapsulated_Libs
521 and then Iter
.Project
.From_Encapsulated_Lib
523 Iter
.Project
:= Iter
.Project
.Next
;
527 Project_Changed
(Iter
);
536 function Element
(Iter
: Source_Iterator
) return Source_Id
is
545 procedure Next
(Iter
: in out Source_Iterator
) is
548 Iter
.Current
:= Iter
.Current
.Next_In_Lang
;
550 exit when Iter
.Locally_Removed
551 or else Iter
.Current
= No_Source
552 or else not Iter
.Current
.Locally_Removed
;
555 if Iter
.Current
= No_Source
then
556 Iter
.Language
:= Iter
.Language
.Next
;
557 Language_Changed
(Iter
);
561 --------------------------------
562 -- For_Every_Project_Imported --
563 --------------------------------
565 procedure For_Every_Project_Imported_Context
567 Tree
: Project_Tree_Ref
;
568 With_State
: in out State
;
569 Include_Aggregated
: Boolean := True;
570 Imported_First
: Boolean := False)
572 use Project_Boolean_Htable
;
574 procedure Recursive_Check_Context
575 (Project
: Project_Id
;
576 Tree
: Project_Tree_Ref
;
577 In_Aggregate_Lib
: Boolean;
578 From_Encapsulated_Lib
: Boolean);
579 -- Recursively handle the project tree creating a new context for
580 -- keeping track about already handled projects.
582 -----------------------------
583 -- Recursive_Check_Context --
584 -----------------------------
586 procedure Recursive_Check_Context
587 (Project
: Project_Id
;
588 Tree
: Project_Tree_Ref
;
589 In_Aggregate_Lib
: Boolean;
590 From_Encapsulated_Lib
: Boolean)
592 package Name_Id_Set
is
593 new Ada
.Containers
.Ordered_Sets
(Element_Type
=> Name_Id
);
595 Seen_Name
: Name_Id_Set
.Set
;
596 -- This set is needed to ensure that we do not handle the same
597 -- project twice in the context of aggregate libraries.
599 procedure Recursive_Check
600 (Project
: Project_Id
;
601 Tree
: Project_Tree_Ref
;
602 In_Aggregate_Lib
: Boolean;
603 From_Encapsulated_Lib
: Boolean);
604 -- Check if project has already been seen. If not, mark it as Seen,
605 -- Call Action, and check all its imported and aggregated projects.
607 ---------------------
608 -- Recursive_Check --
609 ---------------------
611 procedure Recursive_Check
612 (Project
: Project_Id
;
613 Tree
: Project_Tree_Ref
;
614 In_Aggregate_Lib
: Boolean;
615 From_Encapsulated_Lib
: Boolean)
618 function Has_Sources
(P
: Project_Id
) return Boolean;
619 -- Returns True if P has sources
621 function Get_From_Tree
(P
: Project_Id
) return Project_Id
;
622 -- Get project P from Tree. If P has no sources get another
623 -- instance of this project with sources. If P has sources,
630 function Has_Sources
(P
: Project_Id
) return Boolean is
635 while Lang
/= No_Language_Index
loop
636 if Lang
.First_Source
/= No_Source
then
650 function Get_From_Tree
(P
: Project_Id
) return Project_Id
is
651 List
: Project_List
:= Tree
.Projects
;
654 if not Has_Sources
(P
) then
655 while List
/= null loop
656 if List
.Project
.Name
= P
.Name
657 and then Has_Sources
(List
.Project
)
673 -- Start of processing for Recursive_Check
676 if not Seen_Name
.Contains
(Project
.Name
) then
678 -- Even if a project is aggregated multiple times in an
679 -- aggregated library, we will only return it once.
681 Seen_Name
.Include
(Project
.Name
);
683 if not Imported_First
then
685 (Get_From_Tree
(Project
),
687 Project_Context
'(In_Aggregate_Lib, From_Encapsulated_Lib),
691 -- Visit all extended projects
693 if Project.Extends /= No_Project then
695 (Project.Extends, Tree,
696 In_Aggregate_Lib, From_Encapsulated_Lib);
699 -- Visit all imported projects
701 List := Project.Imported_Projects;
702 while List /= null loop
706 From_Encapsulated_Lib
707 or else Project.Standalone_Library = Encapsulated);
711 -- Visit all aggregated projects
713 if Include_Aggregated
714 and then Project.Qualifier in Aggregate_Project
717 Agg : Aggregated_Project_List;
720 Agg := Project.Aggregated_Projects;
721 while Agg /= null loop
722 pragma Assert (Agg.Project /= No_Project);
724 -- For aggregated libraries, the tree must be the one
725 -- of the aggregate library.
727 if Project.Qualifier = Aggregate_Library then
731 From_Encapsulated_Lib
733 Project.Standalone_Library = Encapsulated);
736 -- Use a new context as we want to returns the same
737 -- project in different project tree for aggregated
740 Recursive_Check_Context
741 (Agg.Project, Agg.Tree, False, False);
749 if Imported_First then
751 (Get_From_Tree (Project),
753 Project_Context'(In_Aggregate_Lib
, From_Encapsulated_Lib
),
759 -- Start of processing for Recursive_Check_Context
763 (Project
, Tree
, In_Aggregate_Lib
, From_Encapsulated_Lib
);
764 end Recursive_Check_Context
;
766 -- Start of processing for For_Every_Project_Imported
769 Recursive_Check_Context
772 In_Aggregate_Lib
=> False,
773 From_Encapsulated_Lib
=> False);
774 end For_Every_Project_Imported_Context
;
776 procedure For_Every_Project_Imported
778 Tree
: Project_Tree_Ref
;
779 With_State
: in out State
;
780 Include_Aggregated
: Boolean := True;
781 Imported_First
: Boolean := False)
784 (Project
: Project_Id
;
785 Tree
: Project_Tree_Ref
;
786 Context
: Project_Context
;
787 With_State
: in out State
);
788 -- Action wrapper for handling the context
795 (Project
: Project_Id
;
796 Tree
: Project_Tree_Ref
;
797 Context
: Project_Context
;
798 With_State
: in out State
)
800 pragma Unreferenced
(Context
);
802 Action
(Project
, Tree
, With_State
);
805 procedure For_Projects
is
806 new For_Every_Project_Imported_Context
(State
, Internal
);
809 For_Projects
(By
, Tree
, With_State
, Include_Aggregated
, Imported_First
);
810 end For_Every_Project_Imported
;
817 (In_Tree
: Project_Tree_Ref
;
818 Project
: Project_Id
;
819 In_Imported_Only
: Boolean := False;
820 In_Extended_Only
: Boolean := False;
821 Base_Name
: File_Name_Type
;
822 Index
: Int
:= 0) return Source_Id
824 Result
: Source_Id
:= No_Source
;
826 procedure Look_For_Sources
828 Tree
: Project_Tree_Ref
;
829 Src
: in out Source_Id
);
830 -- Look for Base_Name in the sources of Proj
832 ----------------------
833 -- Look_For_Sources --
834 ----------------------
836 procedure Look_For_Sources
838 Tree
: Project_Tree_Ref
;
839 Src
: in out Source_Id
)
841 Iterator
: Source_Iterator
;
844 Iterator
:= For_Each_Source
(In_Tree
=> Tree
, Project
=> Proj
);
845 while Element
(Iterator
) /= No_Source
loop
846 if Element
(Iterator
).File
= Base_Name
847 and then (Index
= 0 or else Element
(Iterator
).Index
= Index
)
849 Src
:= Element
(Iterator
);
851 -- If the source has been excluded, continue looking. We will
852 -- get the excluded source only if there is no other source
853 -- with the same base name that is not locally removed.
855 if not Element
(Iterator
).Locally_Removed
then
862 end Look_For_Sources
;
864 procedure For_Imported_Projects
is new For_Every_Project_Imported
865 (State
=> Source_Id
, Action
=> Look_For_Sources
);
869 -- Start of processing for Find_Source
872 if In_Extended_Only
then
874 while Proj
/= No_Project
loop
875 Look_For_Sources
(Proj
, In_Tree
, Result
);
876 exit when Result
/= No_Source
;
878 Proj
:= Proj
.Extends
;
881 elsif In_Imported_Only
then
882 Look_For_Sources
(Project
, In_Tree
, Result
);
884 if Result
= No_Source
then
885 For_Imported_Projects
888 Include_Aggregated
=> False,
889 With_State
=> Result
);
893 Look_For_Sources
(No_Project
, In_Tree
, Result
);
899 ----------------------
900 -- Find_All_Sources --
901 ----------------------
903 function Find_All_Sources
904 (In_Tree
: Project_Tree_Ref
;
905 Project
: Project_Id
;
906 In_Imported_Only
: Boolean := False;
907 In_Extended_Only
: Boolean := False;
908 Base_Name
: File_Name_Type
;
909 Index
: Int
:= 0) return Source_Ids
911 Result
: Source_Ids
(1 .. 1_000
);
914 type Empty_State
is null record;
915 No_State
: Empty_State
;
916 -- This is needed for the State parameter of procedure Look_For_Sources
917 -- below, because of the instantiation For_Imported_Projects of generic
918 -- procedure For_Every_Project_Imported. As procedure Look_For_Sources
919 -- does not modify parameter State, there is no need to give its type
920 -- more than one value.
922 procedure Look_For_Sources
924 Tree
: Project_Tree_Ref
;
925 State
: in out Empty_State
);
926 -- Look for Base_Name in the sources of Proj
928 ----------------------
929 -- Look_For_Sources --
930 ----------------------
932 procedure Look_For_Sources
934 Tree
: Project_Tree_Ref
;
935 State
: in out Empty_State
)
937 Iterator
: Source_Iterator
;
943 Iterator
:= For_Each_Source
(In_Tree
=> Tree
, Project
=> Proj
);
944 while Element
(Iterator
) /= No_Source
loop
945 if Element
(Iterator
).File
= Base_Name
948 (Element
(Iterator
).Unit
/= No_Unit_Index
950 Element
(Iterator
).Index
= Index
))
952 Src
:= Element
(Iterator
);
954 -- If the source has been excluded, continue looking. We will
955 -- get the excluded source only if there is no other source
956 -- with the same base name that is not locally removed.
958 if not Element
(Iterator
).Locally_Removed
then
960 Result
(Last
) := Src
;
966 end Look_For_Sources
;
968 procedure For_Imported_Projects
is new For_Every_Project_Imported
969 (State
=> Empty_State
, Action
=> Look_For_Sources
);
973 -- Start of processing for Find_All_Sources
976 if In_Extended_Only
then
978 while Proj
/= No_Project
loop
979 Look_For_Sources
(Proj
, In_Tree
, No_State
);
981 Proj
:= Proj
.Extends
;
984 elsif In_Imported_Only
then
985 Look_For_Sources
(Project
, In_Tree
, No_State
);
988 For_Imported_Projects
991 Include_Aggregated
=> False,
992 With_State
=> No_State
);
996 Look_For_Sources
(No_Project
, In_Tree
, No_State
);
999 return Result
(1 .. Last
);
1000 end Find_All_Sources
;
1006 function Hash
is new GNAT
.HTable
.Hash
(Header_Num
=> Header_Num
);
1007 -- Used in implementation of other functions Hash below
1013 function Hash
(Name
: File_Name_Type
) return Header_Num
is
1015 return Hash
(Get_Name_String
(Name
));
1018 function Hash
(Name
: Name_Id
) return Header_Num
is
1020 return Hash
(Get_Name_String
(Name
));
1023 function Hash
(Name
: Path_Name_Type
) return Header_Num
is
1025 return Hash
(Get_Name_String
(Name
));
1028 function Hash
(Project
: Project_Id
) return Header_Num
is
1030 if Project
= No_Project
then
1031 return Header_Num
'First;
1033 return Hash
(Get_Name_String
(Project
.Name
));
1041 function Image
(The_Casing
: Casing_Type
) return String is
1043 return The_Casing_Images
(The_Casing
).all;
1046 -----------------------------
1047 -- Is_Standard_GNAT_Naming --
1048 -----------------------------
1050 function Is_Standard_GNAT_Naming
1051 (Naming
: Lang_Naming_Data
) return Boolean
1054 return Get_Name_String
(Naming
.Spec_Suffix
) = ".ads"
1055 and then Get_Name_String
(Naming
.Body_Suffix
) = ".adb"
1056 and then Get_Name_String
(Naming
.Dot_Replacement
) = "-";
1057 end Is_Standard_GNAT_Naming
;
1063 procedure Initialize
(Tree
: Project_Tree_Ref
) is
1065 if The_Empty_String
= No_Name
then
1068 The_Empty_String
:= Name_Find
;
1071 Name_Buffer
(1) := '.';
1072 The_Dot_String
:= Name_Find
;
1074 Prj
.Attr
.Initialize
;
1076 -- Make sure that new reserved words after Ada 95 may be used as
1079 Opt
.Ada_Version
:= Opt
.Ada_95
;
1080 Opt
.Ada_Version_Pragma
:= Empty
;
1082 Set_Name_Table_Byte
(Name_Project
, Token_Type
'Pos (Tok_Project
));
1083 Set_Name_Table_Byte
(Name_Extends
, Token_Type
'Pos (Tok_Extends
));
1084 Set_Name_Table_Byte
(Name_External
, Token_Type
'Pos (Tok_External
));
1086 (Name_External_As_List
, Token_Type
'Pos (Tok_External_As_List
));
1089 if Tree
/= No_Project_Tree
then
1098 function Is_Extending
1099 (Extending
: Project_Id
;
1100 Extended
: Project_Id
) return Boolean
1106 while Proj
/= No_Project
loop
1107 if Proj
= Extended
then
1111 Proj
:= Proj
.Extends
;
1121 function Object_Name
1122 (Source_File_Name
: File_Name_Type
;
1123 Object_File_Suffix
: Name_Id
:= No_Name
) return File_Name_Type
1126 if Object_File_Suffix
= No_Name
then
1128 (Source_File_Name
, Object_Suffix
);
1131 (Source_File_Name
, Get_Name_String
(Object_File_Suffix
));
1135 function Object_Name
1136 (Source_File_Name
: File_Name_Type
;
1138 Index_Separator
: Character;
1139 Object_File_Suffix
: Name_Id
:= No_Name
) return File_Name_Type
1141 Index_Img
: constant String := Source_Index
'Img;
1145 Get_Name_String
(Source_File_Name
);
1148 while Last
> 1 and then Name_Buffer
(Last
) /= '.' loop
1153 Name_Len
:= Last
- 1;
1156 Add_Char_To_Name_Buffer
(Index_Separator
);
1157 Add_Str_To_Name_Buffer
(Index_Img
(2 .. Index_Img
'Last));
1159 if Object_File_Suffix
= No_Name
then
1160 Add_Str_To_Name_Buffer
(Object_Suffix
);
1162 Add_Str_To_Name_Buffer
(Get_Name_String
(Object_File_Suffix
));
1168 ----------------------
1169 -- Record_Temp_File --
1170 ----------------------
1172 procedure Record_Temp_File
1173 (Shared
: Shared_Project_Tree_Data_Access
;
1174 Path
: Path_Name_Type
)
1177 Temp_Files_Table
.Append
(Shared
.Private_Part
.Temp_Files
, Path
);
1178 end Record_Temp_File
;
1184 procedure Free
(List
: in out Aggregated_Project_List
) is
1185 procedure Unchecked_Free
is new Ada
.Unchecked_Deallocation
1186 (Aggregated_Project
, Aggregated_Project_List
);
1187 Tmp
: Aggregated_Project_List
;
1189 while List
/= null loop
1194 Unchecked_Free
(List
);
1199 ----------------------------
1200 -- Add_Aggregated_Project --
1201 ----------------------------
1203 procedure Add_Aggregated_Project
1204 (Project
: Project_Id
;
1205 Path
: Path_Name_Type
)
1207 Aggregated
: Aggregated_Project_List
;
1210 -- Check if the project is already in the aggregated project list. If it
1211 -- is, do not add it again.
1213 Aggregated
:= Project
.Aggregated_Projects
;
1214 while Aggregated
/= null loop
1215 if Path
= Aggregated
.Path
then
1218 Aggregated
:= Aggregated
.Next
;
1222 Project
.Aggregated_Projects
:= new Aggregated_Project
'
1224 Project => No_Project,
1226 Next => Project.Aggregated_Projects);
1227 end Add_Aggregated_Project;
1233 procedure Free (Project : in out Project_Id) is
1234 procedure Unchecked_Free is new Ada.Unchecked_Deallocation
1235 (Project_Data, Project_Id);
1238 if Project /= null then
1239 Free (Project.Ada_Include_Path);
1240 Free (Project.Objects_Path);
1241 Free (Project.Ada_Objects_Path);
1242 Free (Project.Ada_Objects_Path_No_Libs);
1243 Free_List (Project.Imported_Projects, Free_Project => False);
1244 Free_List (Project.All_Imported_Projects, Free_Project => False);
1245 Free_List (Project.Languages);
1247 case Project.Qualifier is
1248 when Aggregate | Aggregate_Library =>
1249 Free (Project.Aggregated_Projects);
1255 Unchecked_Free (Project);
1263 procedure Free_List (Languages : in out Language_List) is
1264 procedure Unchecked_Free is new Ada.Unchecked_Deallocation
1265 (Language_List_Element, Language_List);
1266 Tmp : Language_List;
1268 while Languages /= null loop
1269 Tmp := Languages.Next;
1270 Unchecked_Free (Languages);
1279 procedure Free_List (Source : in out Source_Id) is
1280 procedure Unchecked_Free is new
1281 Ada.Unchecked_Deallocation (Source_Data, Source_Id);
1286 while Source /= No_Source loop
1287 Tmp := Source.Next_In_Lang;
1288 Free_List (Source.Alternate_Languages);
1290 if Source.Unit /= null
1291 and then Source.Kind in Spec_Or_Body
1293 Source.Unit.File_Names (Source.Kind) := null;
1296 Unchecked_Free (Source);
1306 (List : in out Project_List;
1307 Free_Project : Boolean)
1309 procedure Unchecked_Free is new
1310 Ada.Unchecked_Deallocation (Project_List_Element, Project_List);
1315 while List /= null loop
1318 if Free_Project then
1319 Free (List.Project);
1322 Unchecked_Free (List);
1331 procedure Free_List (Languages : in out Language_Ptr) is
1332 procedure Unchecked_Free is new
1333 Ada.Unchecked_Deallocation (Language_Data, Language_Ptr);
1338 while Languages /= null loop
1339 Tmp := Languages.Next;
1340 Free_List (Languages.First_Source);
1341 Unchecked_Free (Languages);
1346 --------------------------
1347 -- Reset_Units_In_Table --
1348 --------------------------
1350 procedure Reset_Units_In_Table (Table : in out Units_Htable.Instance) is
1354 Unit := Units_Htable.Get_First (Table);
1355 while Unit /= No_Unit_Index loop
1356 if Unit.File_Names (Spec) /= null then
1357 Unit.File_Names (Spec).Unit := No_Unit_Index;
1360 if Unit.File_Names (Impl) /= null then
1361 Unit.File_Names (Impl).Unit := No_Unit_Index;
1364 Unit := Units_Htable.Get_Next (Table);
1366 end Reset_Units_In_Table;
1372 procedure Free_Units (Table : in out Units_Htable.Instance) is
1373 procedure Unchecked_Free is new
1374 Ada.Unchecked_Deallocation (Unit_Data, Unit_Index);
1379 Unit := Units_Htable.Get_First (Table);
1380 while Unit /= No_Unit_Index loop
1382 -- We cannot reset Unit.File_Names (Impl or Spec).Unit here as
1383 -- Source_Data buffer is freed by the following instruction
1384 -- Free_List (Tree.Projects, Free_Project => True);
1386 Unchecked_Free (Unit);
1387 Unit := Units_Htable.Get_Next (Table);
1390 Units_Htable.Reset (Table);
1397 procedure Free (Tree : in out Project_Tree_Ref) is
1398 procedure Unchecked_Free is new
1399 Ada.Unchecked_Deallocation
1400 (Project_Tree_Data, Project_Tree_Ref);
1402 procedure Unchecked_Free is new
1403 Ada.Unchecked_Deallocation
1404 (Project_Tree_Appdata'Class, Project_Tree_Appdata_Access);
1407 if Tree /= null then
1408 if Tree.Is_Root_Tree then
1409 Name_List_Table.Free (Tree.Shared.Name_Lists);
1410 Number_List_Table.Free (Tree.Shared.Number_Lists);
1411 String_Element_Table.Free (Tree.Shared.String_Elements);
1412 Variable_Element_Table.Free (Tree.Shared.Variable_Elements);
1413 Array_Element_Table.Free (Tree.Shared.Array_Elements);
1414 Array_Table.Free (Tree.Shared.Arrays);
1415 Package_Table.Free (Tree.Shared.Packages);
1416 Temp_Files_Table.Free (Tree.Shared.Private_Part.Temp_Files);
1419 if Tree.Appdata /= null then
1420 Free (Tree.Appdata.all);
1421 Unchecked_Free (Tree.Appdata);
1424 Source_Paths_Htable.Reset (Tree.Source_Paths_HT);
1425 Source_Files_Htable.Reset (Tree.Source_Files_HT);
1427 Reset_Units_In_Table (Tree.Units_HT);
1428 Free_List (Tree.Projects, Free_Project => True);
1429 Free_Units (Tree.Units_HT);
1431 Unchecked_Free (Tree);
1439 procedure Reset (Tree : Project_Tree_Ref) is
1443 if Tree.Is_Root_Tree then
1445 -- We cannot use 'Access here
:
1446 -- "illegal attribute for discriminant-dependent component"
1447 -- However, we know this is valid since Shared and Shared_Data have
1448 -- the same lifetime and will always exist concurrently.
1450 Tree
.Shared
:= Tree
.Shared_Data
'Unrestricted_Access;
1451 Name_List_Table
.Init
(Tree
.Shared
.Name_Lists
);
1452 Number_List_Table
.Init
(Tree
.Shared
.Number_Lists
);
1453 String_Element_Table
.Init
(Tree
.Shared
.String_Elements
);
1454 Variable_Element_Table
.Init
(Tree
.Shared
.Variable_Elements
);
1455 Array_Element_Table
.Init
(Tree
.Shared
.Array_Elements
);
1456 Array_Table
.Init
(Tree
.Shared
.Arrays
);
1457 Package_Table
.Init
(Tree
.Shared
.Packages
);
1459 -- Create Dot_String_List
1461 String_Element_Table
.Append
1462 (Tree
.Shared
.String_Elements
,
1464 (Value => The_Dot_String,
1466 Display_Value => The_Dot_String,
1467 Location => No_Location,
1469 Next => Nil_String));
1470 Tree.Shared.Dot_String_List :=
1471 String_Element_Table.Last (Tree.Shared.String_Elements);
1473 -- Private part table
1475 Temp_Files_Table.Init (Tree.Shared.Private_Part.Temp_Files);
1477 Tree.Shared.Private_Part.Current_Source_Path_File := No_Path;
1478 Tree.Shared.Private_Part.Current_Object_Path_File := No_Path;
1481 Source_Paths_Htable.Reset (Tree.Source_Paths_HT);
1482 Source_Files_Htable.Reset (Tree.Source_Files_HT);
1483 Replaced_Source_HTable.Reset (Tree.Replaced_Sources);
1485 Tree.Replaced_Source_Number := 0;
1487 Reset_Units_In_Table (Tree.Units_HT);
1488 Free_List (Tree.Projects, Free_Project => True);
1489 Free_Units (Tree.Units_HT);
1492 -------------------------------------
1493 -- Set_Current_Object_Path_File_Of --
1494 -------------------------------------
1496 procedure Set_Current_Object_Path_File_Of
1497 (Shared : Shared_Project_Tree_Data_Access;
1498 To : Path_Name_Type)
1501 Shared.Private_Part.Current_Object_Path_File := To;
1502 end Set_Current_Object_Path_File_Of;
1504 -------------------------------------
1505 -- Set_Current_Source_Path_File_Of --
1506 -------------------------------------
1508 procedure Set_Current_Source_Path_File_Of
1509 (Shared : Shared_Project_Tree_Data_Access;
1510 To : Path_Name_Type)
1513 Shared.Private_Part.Current_Source_Path_File := To;
1514 end Set_Current_Source_Path_File_Of;
1516 -----------------------
1517 -- Set_Path_File_Var --
1518 -----------------------
1520 procedure Set_Path_File_Var (Name : String; Value : String) is
1521 Host_Spec : String_Access := To_Host_File_Spec (Value);
1523 if Host_Spec = null then
1525 ("could not convert file name """ & Value & """ to host spec");
1527 Setenv (Name, Host_Spec.all);
1530 end Set_Path_File_Var;
1536 function Switches_Name
1537 (Source_File_Name : File_Name_Type) return File_Name_Type
1540 return Extend_Name (Source_File_Name, Switches_Dependency_Suffix);
1547 function Value (Image : String) return Casing_Type is
1549 for Casing in The_Casing_Images'Range loop
1550 if To_Lower (Image) = To_Lower (The_Casing_Images (Casing).all) then
1555 raise Constraint_Error;
1558 ---------------------
1559 -- Has_Ada_Sources --
1560 ---------------------
1562 function Has_Ada_Sources (Data : Project_Id) return Boolean is
1563 Lang : Language_Ptr;
1566 Lang := Data.Languages;
1567 while Lang /= No_Language_Index loop
1568 if Lang.Name = Name_Ada then
1569 return Lang.First_Source /= No_Source;
1575 end Has_Ada_Sources;
1577 ------------------------
1578 -- Contains_ALI_Files --
1579 ------------------------
1581 function Contains_ALI_Files (Dir : Path_Name_Type) return Boolean is
1582 Dir_Name : constant String := Get_Name_String (Dir);
1584 Name : String (1 .. 1_000);
1586 Result : Boolean := False;
1589 Open (Direct, Dir_Name);
1591 -- For each file in the directory, check if it is an ALI file
1594 Read (Direct, Name, Last);
1596 Canonical_Case_File_Name (Name (1 .. Last));
1597 Result := Last >= 5 and then Name (Last - 3 .. Last) = ".ali";
1605 -- If there is any problem, close the directory if open and return True.
1606 -- The library directory will be added to the path.
1609 if Is_Open (Direct) then
1614 end Contains_ALI_Files;
1616 --------------------------
1617 -- Get_Object_Directory --
1618 --------------------------
1620 function Get_Object_Directory
1621 (Project : Project_Id;
1622 Including_Libraries : Boolean;
1623 Only_If_Ada : Boolean := False) return Path_Name_Type
1626 if (Project.Library and then Including_Libraries)
1628 (Project.Object_Directory /= No_Path_Information
1629 and then (not Including_Libraries or else not Project.Library))
1631 -- For a library project, add the library ALI directory if there is
1632 -- no object directory or if the library ALI directory contains ALI
1633 -- files; otherwise add the object directory.
1635 if Project.Library then
1636 if Project.Object_Directory = No_Path_Information
1638 (Including_Libraries
1640 Contains_ALI_Files (Project.Library_ALI_Dir.Display_Name))
1642 return Project.Library_ALI_Dir.Display_Name;
1644 return Project.Object_Directory.Display_Name;
1647 -- For a non-library project, add object directory if it is not a
1648 -- virtual project, and if there are Ada sources in the project or
1649 -- one of the projects it extends. If there are no Ada sources,
1650 -- adding the object directory could disrupt the order of the
1651 -- object dirs in the path.
1653 elsif not Project.Virtual then
1655 Add_Object_Dir : Boolean;
1659 Add_Object_Dir := not Only_If_Ada;
1661 while not Add_Object_Dir and then Prj /= No_Project loop
1662 if Has_Ada_Sources (Prj) then
1663 Add_Object_Dir := True;
1669 if Add_Object_Dir then
1670 return Project.Object_Directory.Display_Name;
1677 end Get_Object_Directory;
1679 -----------------------------------
1680 -- Ultimate_Extending_Project_Of --
1681 -----------------------------------
1683 function Ultimate_Extending_Project_Of
1684 (Proj : Project_Id) return Project_Id
1690 while Prj /= null and then Prj.Extended_By /= No_Project loop
1691 Prj := Prj.Extended_By;
1695 end Ultimate_Extending_Project_Of;
1697 -----------------------------------
1698 -- Compute_All_Imported_Projects --
1699 -----------------------------------
1701 procedure Compute_All_Imported_Projects
1702 (Root_Project : Project_Id;
1703 Tree : Project_Tree_Ref)
1705 procedure Analyze_Tree
1706 (Local_Root : Project_Id;
1707 Local_Tree : Project_Tree_Ref;
1708 Context : Project_Context);
1709 -- Process Project and all its aggregated project to analyze their own
1710 -- imported projects.
1716 procedure Analyze_Tree
1717 (Local_Root : Project_Id;
1718 Local_Tree : Project_Tree_Ref;
1719 Context : Project_Context)
1721 pragma Unreferenced (Local_Root);
1723 Project : Project_Id;
1725 procedure Recursive_Add
1727 Tree : Project_Tree_Ref;
1728 Context : Project_Context;
1729 Dummy : in out Boolean);
1730 -- Recursively add the projects imported by project Project, but not
1731 -- those that are extended.
1737 procedure Recursive_Add
1739 Tree : Project_Tree_Ref;
1740 Context : Project_Context;
1741 Dummy : in out Boolean)
1743 pragma Unreferenced (Tree);
1745 List : Project_List;
1749 -- A project is not importing itself
1751 Prj2 := Ultimate_Extending_Project_Of (Prj);
1753 if Project /= Prj2 then
1755 -- Check that the project is not already in the list. We know
1756 -- the one passed to Recursive_Add have never been visited
1757 -- before, but the one passed it are the extended projects.
1759 List := Project.All_Imported_Projects;
1760 while List /= null loop
1761 if List.Project = Prj2 then
1768 -- Add it to the list
1770 Project.All_Imported_Projects :=
1771 new Project_List_Element'
1773 From_Encapsulated_Lib
=>
1774 Context
.From_Encapsulated_Lib
1775 or else Analyze_Tree
.Context
.From_Encapsulated_Lib
,
1776 Next
=> Project
.All_Imported_Projects
);
1780 procedure For_All_Projects
is
1781 new For_Every_Project_Imported_Context
(Boolean, Recursive_Add
);
1783 Dummy
: Boolean := False;
1784 List
: Project_List
;
1787 List
:= Local_Tree
.Projects
;
1788 while List
/= null loop
1789 Project
:= List
.Project
;
1791 (Project
.All_Imported_Projects
, Free_Project
=> False);
1793 (Project
, Local_Tree
, Dummy
, Include_Aggregated
=> False);
1798 procedure For_Aggregates
is
1799 new For_Project_And_Aggregated_Context
(Analyze_Tree
);
1801 -- Start of processing for Compute_All_Imported_Projects
1804 For_Aggregates
(Root_Project
, Tree
);
1805 end Compute_All_Imported_Projects
;
1811 function Is_Compilable
(Source
: Source_Id
) return Boolean is
1813 case Source
.Compilable
is
1815 if Source
.Language
.Config
.Compiler_Driver
/= No_File
1817 Length_Of_Name
(Source
.Language
.Config
.Compiler_Driver
) /= 0
1818 and then not Source
.Locally_Removed
1819 and then (Source
.Language
.Config
.Kind
/= File_Based
1820 or else Source
.Kind
/= Spec
)
1822 -- Do not modify Source.Compilable before the source record
1823 -- has been initialized.
1825 if Source
.Source_TS
/= Empty_Time_Stamp
then
1826 Source
.Compilable
:= Yes
;
1832 if Source
.Source_TS
/= Empty_Time_Stamp
then
1833 Source
.Compilable
:= No
;
1847 ------------------------------
1848 -- Object_To_Global_Archive --
1849 ------------------------------
1851 function Object_To_Global_Archive
(Source
: Source_Id
) return Boolean is
1853 return Source
.Language
.Config
.Kind
= File_Based
1854 and then Source
.Kind
= Impl
1855 and then Source
.Language
.Config
.Objects_Linked
1856 and then Is_Compilable
(Source
)
1857 and then Source
.Language
.Config
.Object_Generated
;
1858 end Object_To_Global_Archive
;
1860 ----------------------------
1861 -- Get_Language_From_Name --
1862 ----------------------------
1864 function Get_Language_From_Name
1865 (Project
: Project_Id
;
1866 Name
: String) return Language_Ptr
1869 Result
: Language_Ptr
;
1872 Name_Len
:= Name
'Length;
1873 Name_Buffer
(1 .. Name_Len
) := Name
;
1874 To_Lower
(Name_Buffer
(1 .. Name_Len
));
1877 Result
:= Project
.Languages
;
1878 while Result
/= No_Language_Index
loop
1879 if Result
.Name
= N
then
1883 Result
:= Result
.Next
;
1886 return No_Language_Index
;
1887 end Get_Language_From_Name
;
1893 function Other_Part
(Source
: Source_Id
) return Source_Id
is
1895 if Source
.Unit
/= No_Unit_Index
then
1898 return Source
.Unit
.File_Names
(Spec
);
1900 return Source
.Unit
.File_Names
(Impl
);
1913 function Create_Flags
1914 (Report_Error
: Error_Handler
;
1915 When_No_Sources
: Error_Warning
;
1916 Require_Sources_Other_Lang
: Boolean := True;
1917 Allow_Duplicate_Basenames
: Boolean := True;
1918 Compiler_Driver_Mandatory
: Boolean := False;
1919 Error_On_Unknown_Language
: Boolean := True;
1920 Require_Obj_Dirs
: Error_Warning
:= Error
;
1921 Allow_Invalid_External
: Error_Warning
:= Error
;
1922 Missing_Source_Files
: Error_Warning
:= Error
;
1923 Ignore_Missing_With
: Boolean := False)
1924 return Processing_Flags
1927 return Processing_Flags
'
1928 (Report_Error => Report_Error,
1929 When_No_Sources => When_No_Sources,
1930 Require_Sources_Other_Lang => Require_Sources_Other_Lang,
1931 Allow_Duplicate_Basenames => Allow_Duplicate_Basenames,
1932 Error_On_Unknown_Language => Error_On_Unknown_Language,
1933 Compiler_Driver_Mandatory => Compiler_Driver_Mandatory,
1934 Require_Obj_Dirs => Require_Obj_Dirs,
1935 Allow_Invalid_External => Allow_Invalid_External,
1936 Missing_Source_Files => Missing_Source_Files,
1937 Ignore_Missing_With => Ignore_Missing_With);
1945 (Table : Name_List_Table.Instance;
1946 List : Name_List_Index) return Natural
1948 Count : Natural := 0;
1949 Tmp : Name_List_Index;
1953 while Tmp /= No_Name_List loop
1955 Tmp := Table.Table (Tmp).Next;
1965 procedure Debug_Output (Str : String) is
1967 if Current_Verbosity > Default then
1969 Write_Line ((1 .. Debug_Level * 2 => ' ') & Str);
1970 Set_Standard_Output;
1978 procedure Debug_Indent is
1980 if Current_Verbosity = High then
1982 Write_Str ((1 .. Debug_Level * 2 => ' '));
1983 Set_Standard_Output;
1991 procedure Debug_Output (Str : String; Str2 : Name_Id) is
1993 if Current_Verbosity > Default then
1998 if Str2 = No_Name then
1999 Write_Line (" <no_name>");
2001 Write_Line (" """ & Get_Name_String (Str2) & '"');
2004 Set_Standard_Output;
2008 ---------------------------
2009 -- Debug_Increase_Indent --
2010 ---------------------------
2012 procedure Debug_Increase_Indent
2013 (Str : String := ""; Str2 : Name_Id := No_Name)
2016 if Str2 /= No_Name then
2017 Debug_Output (Str, Str2);
2021 Debug_Level := Debug_Level + 1;
2022 end Debug_Increase_Indent;
2024 ---------------------------
2025 -- Debug_Decrease_Indent --
2026 ---------------------------
2028 procedure Debug_Decrease_Indent (Str : String := "") is
2030 if Debug_Level > 0 then
2031 Debug_Level := Debug_Level - 1;
2037 end Debug_Decrease_Indent;
2043 function Debug_Name (Tree : Project_Tree_Ref) return Name_Id is
2048 Add_Str_To_Name_Buffer ("Tree
[");
2051 while P /= null loop
2052 if P /= Tree.Projects then
2053 Add_Char_To_Name_Buffer (',');
2056 Add_Str_To_Name_Buffer (Get_Name_String (P.Project.Name));
2061 Add_Char_To_Name_Buffer (']');
2070 procedure Free (Tree : in out Project_Tree_Appdata) is
2071 pragma Unreferenced (Tree);
2076 --------------------------------
2077 -- For_Project_And_Aggregated --
2078 --------------------------------
2080 procedure For_Project_And_Aggregated
2081 (Root_Project : Project_Id;
2082 Root_Tree : Project_Tree_Ref)
2084 Agg : Aggregated_Project_List;
2087 Action (Root_Project, Root_Tree);
2089 if Root_Project.Qualifier in Aggregate_Project then
2090 Agg := Root_Project.Aggregated_Projects;
2091 while Agg /= null loop
2092 For_Project_And_Aggregated (Agg.Project, Agg.Tree);
2096 end For_Project_And_Aggregated;
2098 ----------------------------------------
2099 -- For_Project_And_Aggregated_Context --
2100 ----------------------------------------
2102 procedure For_Project_And_Aggregated_Context
2103 (Root_Project : Project_Id;
2104 Root_Tree : Project_Tree_Ref)
2107 procedure Recursive_Process
2108 (Project : Project_Id;
2109 Tree : Project_Tree_Ref;
2110 Context : Project_Context);
2111 -- Process Project and all aggregated projects recursively
2113 -----------------------
2114 -- Recursive_Process --
2115 -----------------------
2117 procedure Recursive_Process
2118 (Project : Project_Id;
2119 Tree : Project_Tree_Ref;
2120 Context : Project_Context)
2122 Agg : Aggregated_Project_List;
2123 Ctx : Project_Context;
2126 Action (Project, Tree, Context);
2128 if Project.Qualifier in Aggregate_Project then
2130 (In_Aggregate_Lib => Project.Qualifier = Aggregate_Library,
2131 From_Encapsulated_Lib =>
2132 Context.From_Encapsulated_Lib
2133 or else Project.Standalone_Library = Encapsulated);
2135 Agg := Project.Aggregated_Projects;
2136 while Agg /= null loop
2137 Recursive_Process (Agg.Project, Agg.Tree, Ctx);
2141 end Recursive_Process;
2143 -- Start of processing for For_Project_And_Aggregated_Context
2147 (Root_Project, Root_Tree, Project_Context'(False, False));
2148 end For_Project_And_Aggregated_Context;
2150 --------------------------------
2151 -- Update_Ignore_Missing_With --
2152 --------------------------------
2154 procedure Update_Ignore_Missing_With
2155 (Flags : in out Processing_Flags; Value : Boolean)
2158 Flags.Ignore_Missing_With := Value;
2159 end Update_Ignore_Missing_With;
2161 -- Package initialization for Prj
2164 -- Make sure that the standard config and user project file extensions are
2165 -- compatible with canonical case file naming.
2167 Canonical_Case_File_Name (Config_Project_File_Extension);
2168 Canonical_Case_File_Name (Project_File_Extension);