95588268f09cea343f823d6e7dea0a26ed6ad320
[gcc.git] / gcc / ada / prj.ads
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- P R J --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2001-2013, Free Software Foundation, Inc. --
10 -- --
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. --
20 -- --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
23 -- --
24 ------------------------------------------------------------------------------
25
26 -- The following package declares the data types for GNAT project.
27 -- These data types may be used by GNAT Project-aware tools.
28
29 -- Children of these package implements various services on these data types.
30 -- See in particular Prj.Pars and Prj.Env.
31
32 with Casing; use Casing;
33 with Namet; use Namet;
34 with Osint;
35 with Scans; use Scans;
36 with Types; use Types;
37
38 with GNAT.Dynamic_HTables; use GNAT.Dynamic_HTables;
39 with GNAT.Dynamic_Tables;
40 with GNAT.OS_Lib; use GNAT.OS_Lib;
41
42 package Prj is
43
44 procedure Add_Restricted_Language (Name : String);
45 -- Call by gprbuild for each language specify by switch
46 -- --restricted-to-languages=.
47
48 procedure Remove_All_Restricted_Languages;
49 -- Call by gprbuild in CodePeer mode to ignore switches
50 -- --restricted-to-languages=.
51
52 function Is_Allowed_Language (Name : Name_Id) return Boolean;
53 -- Returns True if --restricted-to-languages= is not used or if Name
54 -- is one of the restricted languages.
55
56 All_Other_Names : constant Name_Id := Names_High_Bound;
57 -- Name used to replace others as an index of an associative array
58 -- attribute in situations where this is allowed.
59
60 Subdirs : String_Ptr := null;
61 -- The value after the equal sign in switch --subdirs=...
62 -- Contains the relative subdirectory.
63
64 type Library_Support is (None, Static_Only, Full);
65 -- Support for Library Project File.
66 -- - None: Library Project Files are not supported at all
67 -- - Static_Only: Library Project Files are only supported for static
68 -- libraries.
69 -- - Full: Library Project Files are supported for static and dynamic
70 -- (shared) libraries.
71
72 type Yes_No_Unknown is (Yes, No, Unknown);
73 -- Tri-state to decide if -lgnarl is needed when linking
74
75 pragma Warnings (Off);
76 type Project_Qualifier is
77 (Unspecified,
78
79 -- The following clash with Standard is OK, and justified by the context
80 -- which really wants to use the same set of qualifiers.
81
82 Standard,
83
84 Library,
85 Configuration,
86 Dry,
87 Aggregate,
88 Aggregate_Library);
89 pragma Warnings (On);
90 -- Qualifiers that can prefix the reserved word "project" in a project
91 -- file:
92 -- Standard: standard project ...
93 -- Library: library project is ...
94 -- Dry: abstract project is
95 -- Aggregate: aggregate project is
96 -- Aggregate_Library: aggregate library project is ...
97 -- Configuration: configuration project is ...
98
99 subtype Aggregate_Project is
100 Project_Qualifier range Aggregate .. Aggregate_Library;
101
102 All_Packages : constant String_List_Access;
103 -- Default value of parameter Packages of procedures Parse, in Prj.Pars and
104 -- Prj.Part, indicating that all packages should be checked.
105
106 type Project_Tree_Data;
107 type Project_Tree_Ref is access all Project_Tree_Data;
108 -- Reference to a project tree. Several project trees may exist in memory
109 -- at the same time.
110
111 No_Project_Tree : constant Project_Tree_Ref;
112
113 procedure Free (Tree : in out Project_Tree_Ref);
114 -- Free memory associated with the tree
115
116 Config_Project_File_Extension : String := ".cgpr";
117 Project_File_Extension : String := ".gpr";
118 -- The standard config and user project file name extensions. They are not
119 -- constants, because Canonical_Case_File_Name is called on these variables
120 -- in the body of Prj.
121
122 function Empty_File return File_Name_Type;
123 function Empty_String return Name_Id;
124 -- Return the id for an empty string ""
125
126 type Path_Information is record
127 Name : Path_Name_Type := No_Path;
128 Display_Name : Path_Name_Type := No_Path;
129 end record;
130 -- Directory names always end with a directory separator
131
132 No_Path_Information : constant Path_Information := (No_Path, No_Path);
133
134 type Project_Data;
135 type Project_Id is access all Project_Data;
136 No_Project : constant Project_Id := null;
137 -- Id of a Project File
138
139 type String_List_Id is new Nat;
140 Nil_String : constant String_List_Id := 0;
141 type String_Element is record
142 Value : Name_Id := No_Name;
143 Index : Int := 0;
144 Display_Value : Name_Id := No_Name;
145 Location : Source_Ptr := No_Location;
146 Flag : Boolean := False;
147 Next : String_List_Id := Nil_String;
148 end record;
149 -- To hold values for string list variables and array elements.
150 -- Component Flag may be used for various purposes. For source
151 -- directories, it indicates if the directory contains Ada source(s).
152
153 package String_Element_Table is new GNAT.Dynamic_Tables
154 (Table_Component_Type => String_Element,
155 Table_Index_Type => String_List_Id,
156 Table_Low_Bound => 1,
157 Table_Initial => 200,
158 Table_Increment => 100);
159 -- The table for string elements in string lists
160
161 type Variable_Kind is (Undefined, List, Single);
162 -- Different kinds of variables
163
164 subtype Defined_Variable_Kind is Variable_Kind range List .. Single;
165 -- The defined kinds of variables
166
167 Ignored : constant Variable_Kind;
168 -- Used to indicate that a package declaration must be ignored while
169 -- processing the project tree (unknown package name).
170
171 type Variable_Value (Kind : Variable_Kind := Undefined) is record
172 Project : Project_Id := No_Project;
173 Location : Source_Ptr := No_Location;
174 Default : Boolean := False;
175 case Kind is
176 when Undefined =>
177 null;
178 when List =>
179 Values : String_List_Id := Nil_String;
180 when Single =>
181 Value : Name_Id := No_Name;
182 Index : Int := 0;
183 end case;
184 end record;
185 -- Values for variables and array elements. Default is True if the
186 -- current value is the default one for the variable.
187
188 Nil_Variable_Value : constant Variable_Value;
189 -- Value of a non existing variable or array element
190
191 type Variable_Id is new Nat;
192 No_Variable : constant Variable_Id := 0;
193 type Variable is record
194 Next : Variable_Id := No_Variable;
195 Name : Name_Id;
196 Value : Variable_Value;
197 end record;
198 -- To hold the list of variables in a project file and in packages
199
200 package Variable_Element_Table is new GNAT.Dynamic_Tables
201 (Table_Component_Type => Variable,
202 Table_Index_Type => Variable_Id,
203 Table_Low_Bound => 1,
204 Table_Initial => 200,
205 Table_Increment => 100);
206 -- The table of variable in list of variables
207
208 type Array_Element_Id is new Nat;
209 No_Array_Element : constant Array_Element_Id := 0;
210 type Array_Element is record
211 Index : Name_Id;
212 Restricted : Boolean := False;
213 Src_Index : Int := 0;
214 Index_Case_Sensitive : Boolean := True;
215 Value : Variable_Value;
216 Next : Array_Element_Id := No_Array_Element;
217 end record;
218 -- Each Array_Element represents an array element and is linked (Next)
219 -- to the next array element, if any, in the array.
220
221 package Array_Element_Table is new GNAT.Dynamic_Tables
222 (Table_Component_Type => Array_Element,
223 Table_Index_Type => Array_Element_Id,
224 Table_Low_Bound => 1,
225 Table_Initial => 200,
226 Table_Increment => 100);
227 -- The table that contains all array elements
228
229 type Array_Id is new Nat;
230 No_Array : constant Array_Id := 0;
231 type Array_Data is record
232 Name : Name_Id := No_Name;
233 Location : Source_Ptr := No_Location;
234 Value : Array_Element_Id := No_Array_Element;
235 Next : Array_Id := No_Array;
236 end record;
237 -- Each Array_Data value represents an array.
238 -- Value is the id of the first element.
239 -- Next is the id of the next array in the project file or package.
240
241 package Array_Table is new GNAT.Dynamic_Tables
242 (Table_Component_Type => Array_Data,
243 Table_Index_Type => Array_Id,
244 Table_Low_Bound => 1,
245 Table_Initial => 200,
246 Table_Increment => 100);
247 -- The table that contains all arrays
248
249 type Package_Id is new Nat;
250 No_Package : constant Package_Id := 0;
251 type Declarations is record
252 Variables : Variable_Id := No_Variable;
253 Attributes : Variable_Id := No_Variable;
254 Arrays : Array_Id := No_Array;
255 Packages : Package_Id := No_Package;
256 end record;
257 -- Contains the declarations (variables, single and array attributes,
258 -- packages) for a project or a package in a project.
259
260 No_Declarations : constant Declarations :=
261 (Variables => No_Variable,
262 Attributes => No_Variable,
263 Arrays => No_Array,
264 Packages => No_Package);
265 -- Default value of Declarations: used if there are no declarations
266
267 type Package_Element is record
268 Name : Name_Id := No_Name;
269 Decl : Declarations := No_Declarations;
270 Parent : Package_Id := No_Package;
271 Next : Package_Id := No_Package;
272 end record;
273 -- A package (includes declarations that may include other packages)
274
275 package Package_Table is new GNAT.Dynamic_Tables
276 (Table_Component_Type => Package_Element,
277 Table_Index_Type => Package_Id,
278 Table_Low_Bound => 1,
279 Table_Initial => 100,
280 Table_Increment => 100);
281 -- The table that contains all packages
282
283 type Language_Data;
284 type Language_Ptr is access all Language_Data;
285 -- Index of language data
286
287 No_Language_Index : constant Language_Ptr := null;
288 -- Constant indicating that there is no language data
289
290 function Get_Language_From_Name
291 (Project : Project_Id;
292 Name : String) return Language_Ptr;
293 -- Get a language from a project. This might return null if no such
294 -- language exists in the project
295
296 Max_Header_Num : constant := 6150;
297 type Header_Num is range 0 .. Max_Header_Num;
298 -- Size for hash table below. The upper bound is an arbitrary value, the
299 -- value here was chosen after testing to determine a good compromise
300 -- between speed of access and memory usage.
301
302 function Hash (Name : Name_Id) return Header_Num;
303 function Hash (Name : File_Name_Type) return Header_Num;
304 function Hash (Name : Path_Name_Type) return Header_Num;
305 function Hash (Project : Project_Id) return Header_Num;
306 -- Used for computing hash values for names put into hash tables
307
308 type Language_Kind is (File_Based, Unit_Based);
309 -- Type for the kind of language. All languages are file based, except Ada
310 -- which is unit based.
311
312 -- Type of dependency to be checked
313
314 type Dependency_File_Kind is
315 (None,
316 -- There is no dependency file, the source must always be recompiled
317
318 Makefile,
319 -- The dependency file is a Makefile fragment indicating all the files
320 -- the source depends on. If the object file or the dependency file is
321 -- more recent than any of these files, the source must be recompiled.
322
323 ALI_File,
324 -- The dependency file is an ALI file and the source must be recompiled
325 -- if the object or ALI file is more recent than any of the sources
326 -- listed in the D lines.
327
328 ALI_Closure);
329 -- The dependency file is an ALI file and the source must be recompiled
330 -- if the object or ALI file is more recent than any source in the full
331 -- closure.
332
333 Makefile_Dependency_Suffix : constant String := ".d";
334 ALI_Dependency_Suffix : constant String := ".ali";
335 Switches_Dependency_Suffix : constant String := ".cswi";
336
337 Binder_Exchange_Suffix : constant String := ".bexch";
338 -- Suffix for binder exchange files
339
340 Library_Exchange_Suffix : constant String := ".lexch";
341 -- Suffix for library exchange files
342
343 type Name_List_Index is new Nat;
344 No_Name_List : constant Name_List_Index := 0;
345
346 type Name_Node is record
347 Name : Name_Id := No_Name;
348 Next : Name_List_Index := No_Name_List;
349 end record;
350
351 package Name_List_Table is new GNAT.Dynamic_Tables
352 (Table_Component_Type => Name_Node,
353 Table_Index_Type => Name_List_Index,
354 Table_Low_Bound => 1,
355 Table_Initial => 10,
356 Table_Increment => 100);
357 -- The table for lists of names
358
359 function Length
360 (Table : Name_List_Table.Instance;
361 List : Name_List_Index) return Natural;
362 -- Return the number of elements in specified list
363
364 type Number_List_Index is new Nat;
365 No_Number_List : constant Number_List_Index := 0;
366
367 type Number_Node is record
368 Number : Natural := 0;
369 Next : Number_List_Index := No_Number_List;
370 end record;
371
372 package Number_List_Table is new GNAT.Dynamic_Tables
373 (Table_Component_Type => Number_Node,
374 Table_Index_Type => Number_List_Index,
375 Table_Low_Bound => 1,
376 Table_Initial => 10,
377 Table_Increment => 100);
378 -- The table for lists of numbers
379
380 package Mapping_Files_Htable is new Simple_HTable
381 (Header_Num => Header_Num,
382 Element => Path_Name_Type,
383 No_Element => No_Path,
384 Key => Path_Name_Type,
385 Hash => Hash,
386 Equal => "=");
387 -- A hash table to store the mapping files that are not used
388
389 -- The following record ???
390
391 type Lang_Naming_Data is record
392 Dot_Replacement : File_Name_Type := No_File;
393 -- The string to replace '.' in the source file name (for Ada)
394
395 Casing : Casing_Type := All_Lower_Case;
396 -- The casing of the source file name (for Ada)
397
398 Separate_Suffix : File_Name_Type := No_File;
399 -- String to append to unit name for source file name of an Ada subunit
400
401 Spec_Suffix : File_Name_Type := No_File;
402 -- The string to append to the unit name for the
403 -- source file name of a spec.
404
405 Body_Suffix : File_Name_Type := No_File;
406 -- The string to append to the unit name for the
407 -- source file name of a body.
408 end record;
409
410 No_Lang_Naming_Data : constant Lang_Naming_Data :=
411 (Dot_Replacement => No_File,
412 Casing => All_Lower_Case,
413 Separate_Suffix => No_File,
414 Spec_Suffix => No_File,
415 Body_Suffix => No_File);
416
417 function Is_Standard_GNAT_Naming (Naming : Lang_Naming_Data) return Boolean;
418 -- True if the naming scheme is GNAT's default naming scheme. This
419 -- is to take into account shortened names like "Ada." (a-), "System." (s-)
420 -- and so on.
421
422 type Source_Data;
423 type Source_Id is access all Source_Data;
424
425 function Is_Compilable (Source : Source_Id) return Boolean;
426 pragma Inline (Is_Compilable);
427 -- Return True if we know how to compile Source (i.e. if a compiler is
428 -- defined). This doesn't indicate whether the source should be compiled.
429
430 function Object_To_Global_Archive (Source : Source_Id) return Boolean;
431 pragma Inline (Object_To_Global_Archive);
432 -- Return True if the object file should be put in the global archive.
433 -- This is for Ada, when only the closure of a main needs to be
434 -- (re)compiled.
435
436 function Other_Part (Source : Source_Id) return Source_Id;
437 pragma Inline (Other_Part);
438 -- Source ID for the other part, if any: for a spec, returns its body;
439 -- for a body, returns its spec.
440
441 No_Source : constant Source_Id := null;
442
443 type Path_Syntax_Kind is
444 (Canonical,
445 -- Unix style
446 Host);
447 -- Host specific syntax, for example on VMS (the default)
448
449 -- The following record describes the configuration of a language
450
451 type Language_Config is record
452 Kind : Language_Kind := File_Based;
453 -- Kind of language. Most languages are file based. A few, such as Ada,
454 -- are unit based.
455
456 Naming_Data : Lang_Naming_Data;
457 -- The naming data for the languages (prefixes, etc.)
458
459 Include_Compatible_Languages : Name_List_Index := No_Name_List;
460 -- List of languages that are "include compatible" with this language. A
461 -- language B (for example "C") is "include compatible" with a language
462 -- A (for example "C++") if it is expected that sources of language A
463 -- may "include" header files from language B.
464
465 Compiler_Driver : File_Name_Type := No_File;
466 -- The name of the executable for the compiler of the language
467
468 Compiler_Driver_Path : String_Access := null;
469 -- The path name of the executable for the compiler of the language
470
471 Compiler_Leading_Required_Switches : Name_List_Index := No_Name_List;
472 -- The list of initial switches that are required as a minimum to invoke
473 -- the compiler driver.
474
475 Compiler_Trailing_Required_Switches : Name_List_Index := No_Name_List;
476 -- The list of final switches that are required as a minimum to invoke
477 -- the compiler driver.
478
479 Multi_Unit_Switches : Name_List_Index := No_Name_List;
480 -- The switch(es) to indicate the index of a unit in a multi-source file
481
482 Multi_Unit_Object_Separator : Character := ' ';
483 -- The string separating the base name of a source from the index of the
484 -- unit in a multi-source file, in the object file name.
485
486 Path_Syntax : Path_Syntax_Kind := Host;
487 -- Value may be Canonical (Unix style) or Host (host syntax, for example
488 -- on VMS for DEC C).
489
490 Source_File_Switches : Name_List_Index := No_Name_List;
491 -- Optional switches to be put before the source file. The source file
492 -- path name is appended to the last switch in the list.
493 -- Example: ("-i", "");
494
495 Object_File_Suffix : Name_Id := No_Name;
496 -- Optional alternate object file suffix
497
498 Object_File_Switches : Name_List_Index := No_Name_List;
499 -- Optional object file switches. When this is defined, the switches
500 -- are used to specify the object file. The object file name is appended
501 -- to the last switch in the list. Example: ("-o", "").
502
503 Object_Path_Switches : Name_List_Index := No_Name_List;
504 -- List of switches to specify to the compiler the path name of a
505 -- temporary file containing the list of object directories in the
506 -- correct order.
507
508 Compilation_PIC_Option : Name_List_Index := No_Name_List;
509 -- The option(s) to compile a source in Position Independent Code for
510 -- shared libraries. Specified in the configuration. When not specified,
511 -- there is no need for such switch.
512
513 Object_Generated : Boolean := True;
514 -- False in no object file is generated
515
516 Objects_Linked : Boolean := True;
517 -- False if object files are not use to link executables and build
518 -- libraries.
519
520 Runtime_Library_Dir : Name_Id := No_Name;
521 -- Path name of the runtime library directory, if any
522
523 Runtime_Source_Dir : Name_Id := No_Name;
524 -- Path name of the runtime source directory, if any
525
526 Mapping_File_Switches : Name_List_Index := No_Name_List;
527 -- The option(s) to provide a mapping file to the compiler. Specified in
528 -- the configuration. When value is No_Name_List, there is no mapping
529 -- file.
530
531 Mapping_Spec_Suffix : File_Name_Type := No_File;
532 -- Placeholder representing the spec suffix in a mapping file
533
534 Mapping_Body_Suffix : File_Name_Type := No_File;
535 -- Placeholder representing the body suffix in a mapping file
536
537 Config_File_Switches : Name_List_Index := No_Name_List;
538 -- The option(s) to provide a config file to the compiler. Specified in
539 -- the configuration. If value is No_Name_List there is no config file.
540
541 Dependency_Kind : Dependency_File_Kind := None;
542 -- The kind of dependency to be checked: none, Makefile fragment or
543 -- ALI file (for Ada).
544
545 Dependency_Option : Name_List_Index := No_Name_List;
546 -- The option(s) to be used to create the dependency file. When value is
547 -- No_Name_List, there is not such option(s).
548
549 Compute_Dependency : Name_List_Index := No_Name_List;
550 -- Hold the value of attribute Dependency_Driver, if declared for the
551 -- language.
552
553 Include_Option : Name_List_Index := No_Name_List;
554 -- Hold the value of attribute Include_Switches, if declared for the
555 -- language.
556
557 Include_Path : Name_Id := No_Name;
558 -- Name of environment variable declared by attribute Include_Path for
559 -- the language.
560
561 Include_Path_File : Name_Id := No_Name;
562 -- Name of environment variable declared by attribute Include_Path_File
563 -- for the language.
564
565 Objects_Path : Name_Id := No_Name;
566 -- Name of environment variable declared by attribute Objects_Path for
567 -- the language.
568
569 Objects_Path_File : Name_Id := No_Name;
570 -- Name of environment variable declared by attribute Objects_Path_File
571 -- for the language.
572
573 Config_Body : Name_Id := No_Name;
574 -- The template for a pragma Source_File_Name(_Project) for a specific
575 -- file name of a body.
576
577 Config_Body_Index : Name_Id := No_Name;
578 -- The template for a pragma Source_File_Name(_Project) for a specific
579 -- file name of a body in a multi-source file.
580
581 Config_Body_Pattern : Name_Id := No_Name;
582 -- The template for a pragma Source_File_Name(_Project) for a naming
583 -- body pattern.
584
585 Config_Spec : Name_Id := No_Name;
586 -- The template for a pragma Source_File_Name(_Project) for a specific
587 -- file name of a spec.
588
589 Config_Spec_Index : Name_Id := No_Name;
590 -- The template for a pragma Source_File_Name(_Project) for a specific
591 -- file name of a spec in a multi-source file.
592
593 Config_Spec_Pattern : Name_Id := No_Name;
594 -- The template for a pragma Source_File_Name(_Project) for a naming
595 -- spec pattern.
596
597 Config_File_Unique : Boolean := False;
598 -- True if the config file specified to the compiler needs to be unique.
599 -- If it is unique, then all config files are concatenated into a temp
600 -- config file.
601
602 Binder_Driver : File_Name_Type := No_File;
603 -- The name of the binder driver for the language, if any
604
605 Binder_Driver_Path : Path_Name_Type := No_Path;
606 -- The path name of the binder driver
607
608 Binder_Required_Switches : Name_List_Index := No_Name_List;
609 -- Hold the value of attribute Binder'Required_Switches for the language
610
611 Binder_Prefix : Name_Id := No_Name;
612 -- Hold the value of attribute Binder'Prefix for the language
613
614 Toolchain_Version : Name_Id := No_Name;
615 -- Hold the value of attribute Toolchain_Version for the language
616
617 Toolchain_Description : Name_Id := No_Name;
618 -- Hold the value of attribute Toolchain_Description for the language
619
620 Clean_Object_Artifacts : Name_List_Index := No_Name_List;
621 -- List of object artifact extensions to be deleted by gprclean
622
623 Clean_Source_Artifacts : Name_List_Index := No_Name_List;
624 -- List of source artifact extensions to be deleted by gprclean
625
626 end record;
627
628 No_Language_Config : constant Language_Config :=
629 (Kind => File_Based,
630 Naming_Data => No_Lang_Naming_Data,
631 Include_Compatible_Languages => No_Name_List,
632 Compiler_Driver => No_File,
633 Compiler_Driver_Path => null,
634 Compiler_Leading_Required_Switches
635 => No_Name_List,
636 Compiler_Trailing_Required_Switches
637 => No_Name_List,
638 Multi_Unit_Switches => No_Name_List,
639 Multi_Unit_Object_Separator => ' ',
640 Path_Syntax => Canonical,
641 Source_File_Switches => No_Name_List,
642 Object_File_Suffix => No_Name,
643 Object_File_Switches => No_Name_List,
644 Object_Path_Switches => No_Name_List,
645 Compilation_PIC_Option => No_Name_List,
646 Object_Generated => True,
647 Objects_Linked => True,
648 Runtime_Library_Dir => No_Name,
649 Runtime_Source_Dir => No_Name,
650 Mapping_File_Switches => No_Name_List,
651 Mapping_Spec_Suffix => No_File,
652 Mapping_Body_Suffix => No_File,
653 Config_File_Switches => No_Name_List,
654 Dependency_Kind => None,
655 Dependency_Option => No_Name_List,
656 Compute_Dependency => No_Name_List,
657 Include_Option => No_Name_List,
658 Include_Path => No_Name,
659 Include_Path_File => No_Name,
660 Objects_Path => No_Name,
661 Objects_Path_File => No_Name,
662 Config_Body => No_Name,
663 Config_Body_Index => No_Name,
664 Config_Body_Pattern => No_Name,
665 Config_Spec => No_Name,
666 Config_Spec_Index => No_Name,
667 Config_Spec_Pattern => No_Name,
668 Config_File_Unique => False,
669 Binder_Driver => No_File,
670 Binder_Driver_Path => No_Path,
671 Binder_Required_Switches => No_Name_List,
672 Binder_Prefix => No_Name,
673 Toolchain_Version => No_Name,
674 Toolchain_Description => No_Name,
675 Clean_Object_Artifacts => No_Name_List,
676 Clean_Source_Artifacts => No_Name_List);
677
678 type Language_Data is record
679 Name : Name_Id := No_Name;
680 -- The name of the language in lower case
681
682 Display_Name : Name_Id := No_Name;
683 -- The name of the language, as found in attribute Languages
684
685 Config : Language_Config := No_Language_Config;
686 -- Configuration of the language
687
688 First_Source : Source_Id := No_Source;
689 -- Head of the list of sources of the language in the project
690
691 Mapping_Files : Mapping_Files_Htable.Instance :=
692 Mapping_Files_Htable.Nil;
693 -- Hash table containing the mapping of the sources to their path names
694
695 Next : Language_Ptr := No_Language_Index;
696 -- Next language of the project
697
698 end record;
699
700 No_Language_Data : constant Language_Data :=
701 (Name => No_Name,
702 Display_Name => No_Name,
703 Config => No_Language_Config,
704 First_Source => No_Source,
705 Mapping_Files => Mapping_Files_Htable.Nil,
706 Next => No_Language_Index);
707
708 type Language_List_Element;
709 type Language_List is access all Language_List_Element;
710 type Language_List_Element is record
711 Language : Language_Ptr := No_Language_Index;
712 Next : Language_List;
713 end record;
714
715 type Source_Kind is (Spec, Impl, Sep);
716 subtype Spec_Or_Body is Source_Kind range Spec .. Impl;
717
718 -- The following declarations declare a structure used to store the Name
719 -- and File and Path names of a unit, with a reference to its GNAT Project
720 -- File(s). Some units might have neither Spec nor Impl when they were
721 -- created for a "separate".
722
723 type File_Names_Data is array (Spec_Or_Body) of Source_Id;
724
725 type Unit_Data is record
726 Name : Name_Id := No_Name;
727 File_Names : File_Names_Data;
728 end record;
729
730 type Unit_Index is access all Unit_Data;
731
732 No_Unit_Index : constant Unit_Index := null;
733 -- Used to indicate a null entry for no unit
734
735 type Source_Roots;
736 type Roots_Access is access Source_Roots;
737 type Source_Roots is record
738 Root : Source_Id;
739 Next : Roots_Access;
740 end record;
741 -- A list to store the roots associated with a main unit. These are the
742 -- files that need to linked along with the main (for instance a C file
743 -- corresponding to an Ada file). In general, these are dependencies that
744 -- cannot be computed automatically by the builder.
745
746 type Naming_Exception_Type is (No, Yes, Inherited);
747
748 -- Structure to define source data
749
750 type Source_Data is record
751 Initialized : Boolean := False;
752 -- Set to True when Source_Data is completely initialized
753
754 Project : Project_Id := No_Project;
755 -- Project of the source
756
757 Location : Source_Ptr := No_Location;
758 -- Location in the project file of the declaration of the source in
759 -- package Naming.
760
761 Source_Dir_Rank : Natural := 0;
762 -- The rank of the source directory in list declared with attribute
763 -- Source_Dirs. Two source files with the same name cannot appears in
764 -- different directory with the same rank. That can happen when the
765 -- recursive notation <dir>/** is used in attribute Source_Dirs.
766
767 Language : Language_Ptr := No_Language_Index;
768 -- Language of the source
769
770 In_Interfaces : Boolean := True;
771 -- False when the source is not included in interfaces, when attribute
772 -- Interfaces is declared.
773
774 Declared_In_Interfaces : Boolean := False;
775 -- True when source is declared in attribute Interfaces
776
777 Alternate_Languages : Language_List := null;
778 -- List of languages a header file may also be, in addition of language
779 -- Language_Name.
780
781 Kind : Source_Kind := Spec;
782 -- Kind of the source: spec, body or subunit
783
784 Unit : Unit_Index := No_Unit_Index;
785 -- Name of the unit, if language is unit based. This is only set for
786 -- those files that are part of the compilation set (for instance a
787 -- file in an extended project that is overridden will not have this
788 -- field set).
789
790 Index : Int := 0;
791 -- Index of the source in a multi unit source file (the same Source_Data
792 -- is duplicated several times when there are several units in the same
793 -- file). Index is 0 if there is either no unit or a single one, and
794 -- starts at 1 when there are multiple units
795
796 Compilable : Yes_No_Unknown := Unknown;
797 -- Updated at the first call to Is_Compilable. Yes if source file is
798 -- compilable.
799
800 In_The_Queue : Boolean := False;
801 -- True if the source has been put in the queue
802
803 Locally_Removed : Boolean := False;
804 -- True if the source has been "excluded"
805
806 Suppressed : Boolean := False;
807 -- True if the source is a locally removed direct source of the project.
808 -- These sources should not be put in the mapping file.
809
810 Replaced_By : Source_Id := No_Source;
811 -- Source in an extending project that replaces the current source
812
813 File : File_Name_Type := No_File;
814 -- Canonical file name of the source
815
816 Display_File : File_Name_Type := No_File;
817 -- File name of the source, for display purposes
818
819 Path : Path_Information := No_Path_Information;
820 -- Path name of the source
821
822 Source_TS : Time_Stamp_Type := Empty_Time_Stamp;
823 -- Time stamp of the source file
824
825 Object_Project : Project_Id := No_Project;
826 -- Project where the object file is. This might be different from
827 -- Project when using extending project files.
828
829 Object : File_Name_Type := No_File;
830 -- File name of the object file
831
832 Current_Object_Path : Path_Name_Type := No_Path;
833 -- Object path of an existing object file
834
835 Object_Path : Path_Name_Type := No_Path;
836 -- Object path of the real object file
837
838 Object_TS : Time_Stamp_Type := Empty_Time_Stamp;
839 -- Object file time stamp
840
841 Dep_Name : File_Name_Type := No_File;
842 -- Dependency file simple name
843
844 Current_Dep_Path : Path_Name_Type := No_Path;
845 -- Path name of an existing dependency file
846
847 Dep_Path : Path_Name_Type := No_Path;
848 -- Path name of the real dependency file
849
850 Dep_TS : aliased Osint.File_Attributes := Osint.Unknown_Attributes;
851 -- Dependency file time stamp
852
853 Switches : File_Name_Type := No_File;
854 -- File name of the switches file. For all languages, this is a file
855 -- that ends with the .cswi extension.
856
857 Switches_Path : Path_Name_Type := No_Path;
858 -- Path name of the switches file
859
860 Switches_TS : Time_Stamp_Type := Empty_Time_Stamp;
861 -- Switches file time stamp
862
863 Naming_Exception : Naming_Exception_Type := No;
864 -- True if the source has an exceptional name
865
866 Duplicate_Unit : Boolean := False;
867 -- True when a duplicate unit has been reported for this source
868
869 Next_In_Lang : Source_Id := No_Source;
870 -- Link to another source of the same language in the same project
871
872 Next_With_File_Name : Source_Id := No_Source;
873 -- Link to another source with the same base file name
874
875 Roots : Roots_Access := null;
876 -- The roots for a main unit
877
878 end record;
879
880 No_Source_Data : constant Source_Data :=
881 (Initialized => False,
882 Project => No_Project,
883 Location => No_Location,
884 Source_Dir_Rank => 0,
885 Language => No_Language_Index,
886 In_Interfaces => True,
887 Declared_In_Interfaces => False,
888 Alternate_Languages => null,
889 Kind => Spec,
890 Unit => No_Unit_Index,
891 Index => 0,
892 Locally_Removed => False,
893 Suppressed => False,
894 Compilable => Unknown,
895 In_The_Queue => False,
896 Replaced_By => No_Source,
897 File => No_File,
898 Display_File => No_File,
899 Path => No_Path_Information,
900 Source_TS => Empty_Time_Stamp,
901 Object_Project => No_Project,
902 Object => No_File,
903 Current_Object_Path => No_Path,
904 Object_Path => No_Path,
905 Object_TS => Empty_Time_Stamp,
906 Dep_Name => No_File,
907 Current_Dep_Path => No_Path,
908 Dep_Path => No_Path,
909 Dep_TS => Osint.Unknown_Attributes,
910 Switches => No_File,
911 Switches_Path => No_Path,
912 Switches_TS => Empty_Time_Stamp,
913 Naming_Exception => No,
914 Duplicate_Unit => False,
915 Next_In_Lang => No_Source,
916 Next_With_File_Name => No_Source,
917 Roots => null);
918
919 package Source_Files_Htable is new Simple_HTable
920 (Header_Num => Header_Num,
921 Element => Source_Id,
922 No_Element => No_Source,
923 Key => File_Name_Type,
924 Hash => Hash,
925 Equal => "=");
926 -- Mapping of source file names to source ids
927
928 package Source_Paths_Htable is new Simple_HTable
929 (Header_Num => Header_Num,
930 Element => Source_Id,
931 No_Element => No_Source,
932 Key => Path_Name_Type,
933 Hash => Hash,
934 Equal => "=");
935 -- Mapping of source paths to source ids
936
937 type Lib_Kind is (Static, Dynamic, Relocatable);
938
939 type Policy is (Autonomous, Compliant, Controlled, Restricted, Direct);
940 -- Type to specify the symbol policy, when symbol control is supported.
941 -- See full explanation about this type in package Symbols.
942 -- Autonomous: Create a symbol file without considering any reference
943 -- Compliant: Try to be as compatible as possible with an existing ref
944 -- Controlled: Fail if symbols are not the same as those in the reference
945 -- Restricted: Restrict the symbols to those in the symbol file
946 -- Direct: The symbol file is used as is
947
948 type Symbol_Record is record
949 Symbol_File : Path_Name_Type := No_Path;
950 Reference : Path_Name_Type := No_Path;
951 Symbol_Policy : Policy := Autonomous;
952 end record;
953 -- Type to keep the symbol data to be used when building a shared library
954
955 No_Symbols : constant Symbol_Record :=
956 (Symbol_File => No_Path,
957 Reference => No_Path,
958 Symbol_Policy => Autonomous);
959 -- The default value of the symbol data
960
961 function Image (The_Casing : Casing_Type) return String;
962 -- Similar to 'Image (but avoid use of this attribute in compiler)
963
964 function Value (Image : String) return Casing_Type;
965 -- Similar to 'Value (but avoid use of this attribute in compiler)
966 -- Raises Constraint_Error if not a Casing_Type image.
967
968 -- The following record contains data for a naming scheme
969
970 function Get_Object_Directory
971 (Project : Project_Id;
972 Including_Libraries : Boolean;
973 Only_If_Ada : Boolean := False) return Path_Name_Type;
974 -- Return the object directory to use for the project. This depends on
975 -- whether we have a library project or a standard project. This function
976 -- might return No_Name when no directory applies.
977 -- If we have a library project file and Including_Libraries is True then
978 -- the library dir is returned instead of the object dir.
979 -- If Only_If_Ada is True, then No_Name will be returned when the project
980 -- doesn't Ada sources.
981
982 procedure Compute_All_Imported_Projects
983 (Root_Project : Project_Id;
984 Tree : Project_Tree_Ref);
985 -- For all projects in the tree, compute the list of the projects imported
986 -- directly or indirectly by project Root_Project. The result is stored in
987 -- Project.All_Imported_Projects for each project
988
989 function Ultimate_Extending_Project_Of
990 (Proj : Project_Id) return Project_Id;
991 -- Returns the ultimate extending project of project Proj. If project Proj
992 -- is not extended, returns Proj.
993
994 type Project_List_Element;
995 type Project_List is access all Project_List_Element;
996 type Project_List_Element is record
997 Project : Project_Id := No_Project;
998 From_Encapsulated_Lib : Boolean := False;
999 Next : Project_List := null;
1000 end record;
1001 -- A list of projects
1002
1003 procedure Free_List
1004 (List : in out Project_List;
1005 Free_Project : Boolean);
1006 -- Free the list of projects, if Free_Project, each project is also freed
1007
1008 type Response_File_Format is
1009 (None,
1010 GNU,
1011 Object_List,
1012 Option_List,
1013 GCC,
1014 GCC_GNU,
1015 GCC_Object_List,
1016 GCC_Option_List);
1017 -- The format of the different response files
1018
1019 type Project_Configuration is record
1020 Target : Name_Id := No_Name;
1021 -- The target of the configuration, when specified
1022
1023 Run_Path_Option : Name_List_Index := No_Name_List;
1024 -- The option to use when linking to specify the path where to look for
1025 -- libraries.
1026
1027 Run_Path_Origin : Name_Id := No_Name;
1028 -- Specify the string (such as "$ORIGIN") to indicate paths relative to
1029 -- the directory of the executable in the run path option.
1030
1031 Library_Install_Name_Option : Name_Id := No_Name;
1032 -- When this is not an empty list, this option, followed by the single
1033 -- name of the shared library file is used when linking a shared
1034 -- library.
1035
1036 Separate_Run_Path_Options : Boolean := False;
1037 -- True if each directory needs to be specified in a separate run path
1038 -- option.
1039
1040 Executable_Suffix : Name_Id := No_Name;
1041 -- The suffix of executables, when specified in the configuration or in
1042 -- package Builder of the main project. When this is not specified, the
1043 -- executable suffix is the default for the platform.
1044
1045 -- Linking
1046
1047 Linker : Path_Name_Type := No_Path;
1048 -- Path name of the linker driver. Specified in the configuration or in
1049 -- the package Builder of the main project.
1050
1051 Map_File_Option : Name_Id := No_Name;
1052 -- Option to use when invoking the linker to build a map file
1053
1054 Trailing_Linker_Required_Switches : Name_List_Index := No_Name_List;
1055 -- The minimum options for the linker driver. Specified in the
1056 -- configuration.
1057
1058 Linker_Executable_Option : Name_List_Index := No_Name_List;
1059 -- The option(s) to indicate the name of the executable in the linker
1060 -- command. Specified in the configuration. When not specified, default
1061 -- to -o <executable name>.
1062
1063 Linker_Lib_Dir_Option : Name_Id := No_Name;
1064 -- The option to specify where to find a library for linking. Specified
1065 -- in the configuration. When not specified, defaults to "-L".
1066
1067 Linker_Lib_Name_Option : Name_Id := No_Name;
1068 -- The option to specify the name of a library for linking. Specified in
1069 -- the configuration. When not specified, defaults to "-l".
1070
1071 Max_Command_Line_Length : Natural := 0;
1072 -- When positive and when Resp_File_Format (see below) is not None,
1073 -- if the command line for the invocation of the linker would be greater
1074 -- than this value, a response file is used to invoke the linker.
1075
1076 Resp_File_Format : Response_File_Format := None;
1077 -- The format of a response file, when linking with a response file is
1078 -- supported.
1079
1080 Resp_File_Options : Name_List_Index := No_Name_List;
1081 -- The switches, if any, that precede the path name of the response
1082 -- file in the invocation of the linker.
1083
1084 -- Libraries
1085
1086 Library_Builder : Path_Name_Type := No_Path;
1087 -- The executable to build library (specified in the configuration)
1088
1089 Lib_Support : Library_Support := None;
1090 -- The level of library support. Specified in the configuration. Support
1091 -- is none, static libraries only or both static and shared libraries.
1092
1093 Lib_Encapsulated_Supported : Boolean := False;
1094 -- True when building fully standalone libraries supported on the target
1095
1096 Archive_Builder : Name_List_Index := No_Name_List;
1097 -- The name of the executable to build archives, with the minimum
1098 -- switches. Specified in the configuration.
1099
1100 Archive_Builder_Append_Option : Name_List_Index := No_Name_List;
1101 -- The options to append object files to an archive
1102
1103 Archive_Indexer : Name_List_Index := No_Name_List;
1104 -- The name of the executable to index archives, with the minimum
1105 -- switches. Specified in the configuration.
1106
1107 Archive_Suffix : File_Name_Type := No_File;
1108 -- The suffix of archives. Specified in the configuration. When not
1109 -- specified, defaults to ".a".
1110
1111 Lib_Partial_Linker : Name_List_Index := No_Name_List;
1112
1113 -- Shared libraries
1114
1115 Shared_Lib_Driver : File_Name_Type := No_File;
1116 -- The driver to link shared libraries. Set with attribute Library_GCC.
1117 -- Default to gcc.
1118
1119 Shared_Lib_Prefix : File_Name_Type := No_File;
1120 -- Part of a shared library file name that precedes the name of the
1121 -- library. Specified in the configuration. When not specified, defaults
1122 -- to "lib".
1123
1124 Shared_Lib_Suffix : File_Name_Type := No_File;
1125 -- Suffix of shared libraries, after the library name in the shared
1126 -- library name. Specified in the configuration. When not specified,
1127 -- default to ".so".
1128
1129 Shared_Lib_Min_Options : Name_List_Index := No_Name_List;
1130 -- The minimum options to use when building a shared library
1131
1132 Lib_Version_Options : Name_List_Index := No_Name_List;
1133 -- The options to use to specify a library version
1134
1135 Symbolic_Link_Supported : Boolean := False;
1136 -- True if the platform supports symbolic link files
1137
1138 Lib_Maj_Min_Id_Supported : Boolean := False;
1139 -- True if platform supports library major and minor options, such as
1140 -- libname.so -> libname.so.2 -> libname.so.2.4
1141
1142 Auto_Init_Supported : Boolean := False;
1143 -- True if automatic initialisation is supported for shared stand-alone
1144 -- libraries.
1145
1146 -- Cleaning
1147
1148 Artifacts_In_Exec_Dir : Name_List_Index := No_Name_List;
1149 -- List of regexp file names to be cleaned in the exec directory of the
1150 -- main project.
1151
1152 Artifacts_In_Object_Dir : Name_List_Index := No_Name_List;
1153 -- List of regexp file names to be cleaned in the object directory of
1154 -- all projects.
1155
1156 end record;
1157
1158 Default_Project_Config : constant Project_Configuration :=
1159 (Target => No_Name,
1160 Run_Path_Option => No_Name_List,
1161 Run_Path_Origin => No_Name,
1162 Library_Install_Name_Option => No_Name,
1163 Separate_Run_Path_Options => False,
1164 Executable_Suffix => No_Name,
1165 Linker => No_Path,
1166 Map_File_Option => No_Name,
1167 Trailing_Linker_Required_Switches =>
1168 No_Name_List,
1169 Linker_Executable_Option => No_Name_List,
1170 Linker_Lib_Dir_Option => No_Name,
1171 Linker_Lib_Name_Option => No_Name,
1172 Library_Builder => No_Path,
1173 Max_Command_Line_Length => 0,
1174 Resp_File_Format => None,
1175 Resp_File_Options => No_Name_List,
1176 Lib_Support => None,
1177 Lib_Encapsulated_Supported => False,
1178 Archive_Builder => No_Name_List,
1179 Archive_Builder_Append_Option => No_Name_List,
1180 Archive_Indexer => No_Name_List,
1181 Archive_Suffix => No_File,
1182 Lib_Partial_Linker => No_Name_List,
1183 Shared_Lib_Driver => No_File,
1184 Shared_Lib_Prefix => No_File,
1185 Shared_Lib_Suffix => No_File,
1186 Shared_Lib_Min_Options => No_Name_List,
1187 Lib_Version_Options => No_Name_List,
1188 Symbolic_Link_Supported => False,
1189 Lib_Maj_Min_Id_Supported => False,
1190 Auto_Init_Supported => False,
1191 Artifacts_In_Exec_Dir => No_Name_List,
1192 Artifacts_In_Object_Dir => No_Name_List);
1193
1194 -------------------------
1195 -- Aggregated projects --
1196 -------------------------
1197
1198 type Aggregated_Project;
1199 type Aggregated_Project_List is access all Aggregated_Project;
1200 type Aggregated_Project is record
1201 Path : Path_Name_Type;
1202 Tree : Project_Tree_Ref;
1203 Project : Project_Id;
1204 Next : Aggregated_Project_List;
1205 end record;
1206
1207 procedure Free (List : in out Aggregated_Project_List);
1208 -- Free the memory used for List
1209
1210 procedure Add_Aggregated_Project
1211 (Project : Project_Id;
1212 Path : Path_Name_Type);
1213 -- Add a new aggregated project in Project.
1214 -- The aggregated project has not been processed yet. This procedure should
1215 -- the called while processing the aggregate project, and as a result
1216 -- Prj.Proc.Process will then automatically process the aggregated projects
1217
1218 ------------------
1219 -- Project_Data --
1220 ------------------
1221
1222 -- The following record describes a project file representation
1223
1224 pragma Warnings (Off);
1225 type Standalone is
1226 (No,
1227
1228 -- The following clash with Standard is OK, and justified by the context
1229 -- which really wants to use the same set of qualifiers.
1230
1231 Standard,
1232
1233 Encapsulated);
1234 pragma Warnings (On);
1235
1236 type Project_Data (Qualifier : Project_Qualifier := Unspecified) is record
1237
1238 -------------
1239 -- General --
1240 -------------
1241
1242 Name : Name_Id := No_Name;
1243 -- The name of the project
1244
1245 Display_Name : Name_Id := No_Name;
1246 -- The name of the project with the spelling of its declaration
1247
1248 Externally_Built : Boolean := False;
1249 -- True if the project is externally built. In such case, the Project
1250 -- Manager will not modify anything in this project.
1251
1252 Config : Project_Configuration;
1253
1254 Path : Path_Information := No_Path_Information;
1255 -- The path name of the project file. This include base name of the
1256 -- project file.
1257
1258 Virtual : Boolean := False;
1259 -- True for virtual extending projects
1260
1261 Location : Source_Ptr := No_Location;
1262 -- The location in the project file source of the project name that
1263 -- immediately follows the reserved word "project".
1264
1265 ---------------
1266 -- Languages --
1267 ---------------
1268
1269 Languages : Language_Ptr := No_Language_Index;
1270 -- First index of the language data in the project.
1271 -- Traversing the list gives access to all the languages supported by
1272 -- the project.
1273
1274 --------------
1275 -- Projects --
1276 --------------
1277
1278 Mains : String_List_Id := Nil_String;
1279 -- List of mains specified by attribute Main
1280
1281 Extends : Project_Id := No_Project;
1282 -- The reference of the project file, if any, that this project file
1283 -- extends.
1284
1285 Extended_By : Project_Id := No_Project;
1286 -- The reference of the project file, if any, that extends this project
1287 -- file.
1288
1289 Decl : Declarations := No_Declarations;
1290 -- The declarations (variables, attributes and packages) of this project
1291 -- file.
1292
1293 Imported_Projects : Project_List := null;
1294 -- The list of all directly imported projects, if any
1295
1296 All_Imported_Projects : Project_List := null;
1297 -- The list of all projects imported directly or indirectly, if any.
1298 -- This does not include the project itself.
1299
1300 -----------------
1301 -- Directories --
1302 -----------------
1303
1304 Directory : Path_Information := No_Path_Information;
1305 -- Path name of the directory where the project file resides
1306
1307 Object_Directory : Path_Information := No_Path_Information;
1308 -- The path name of the object directory of this project file
1309
1310 Exec_Directory : Path_Information := No_Path_Information;
1311 -- The path name of the exec directory of this project file. Default is
1312 -- equal to Object_Directory.
1313
1314 Object_Path_File : Path_Name_Type := No_Path;
1315 -- Store the name of the temporary file that contains the list of object
1316 -- directories, when attribute Object_Path_Switches is declared.
1317
1318 -------------
1319 -- Library --
1320 -------------
1321
1322 Library : Boolean := False;
1323 -- True if this is a library project
1324
1325 Library_Name : Name_Id := No_Name;
1326 -- If a library project, name of the library
1327
1328 Library_Kind : Lib_Kind := Static;
1329 -- If a library project, kind of library
1330
1331 Library_Dir : Path_Information := No_Path_Information;
1332 -- If a library project, path name of the directory where the library
1333 -- resides.
1334
1335 Library_TS : Time_Stamp_Type := Empty_Time_Stamp;
1336 -- The timestamp of a library file in a library project
1337
1338 Library_Src_Dir : Path_Information := No_Path_Information;
1339 -- If a Stand-Alone Library project, path name of the directory where
1340 -- the sources of the interfaces of the library are copied. By default,
1341 -- if attribute Library_Src_Dir is not specified, sources of the
1342 -- interfaces are not copied anywhere.
1343
1344 Library_ALI_Dir : Path_Information := No_Path_Information;
1345 -- In a library project, path name of the directory where the ALI files
1346 -- are copied. If attribute Library_ALI_Dir is not specified, ALI files
1347 -- are copied in the Library_Dir.
1348
1349 Lib_Internal_Name : Name_Id := No_Name;
1350 -- If a library project, internal name store inside the library
1351
1352 Standalone_Library : Standalone := No;
1353 -- Indicate that this is a Standalone Library Project File
1354
1355 Lib_Interface_ALIs : String_List_Id := Nil_String;
1356 -- For Standalone Library Project Files, list of Interface ALI files.
1357
1358 Other_Interfaces : String_List_Id := Nil_String;
1359 -- List of non unit based sources in attribute Interfaces
1360
1361 Lib_Auto_Init : Boolean := False;
1362 -- For non static Stand-Alone Library Project Files, True if the library
1363 -- initialisation should be automatic.
1364
1365 Symbol_Data : Symbol_Record := No_Symbols;
1366 -- Symbol file name, reference symbol file name, symbol policy
1367
1368 Need_To_Build_Lib : Boolean := False;
1369 -- True if the library of a Library Project needs to be built or rebuilt
1370
1371 -------------
1372 -- Sources --
1373 -------------
1374 -- The sources for all languages including Ada are accessible through
1375 -- the Source_Iterator type
1376
1377 Interfaces_Defined : Boolean := False;
1378 -- True if attribute Interfaces is declared for the project or any
1379 -- project it extends.
1380
1381 Include_Path_File : Path_Name_Type := No_Path;
1382 -- The path name of the of the source search directory file.
1383 -- This is only used by gnatmake
1384
1385 Source_Dirs : String_List_Id := Nil_String;
1386 -- The list of all the source directories
1387
1388 Source_Dir_Ranks : Number_List_Index := No_Number_List;
1389
1390 Ada_Include_Path : String_Access := null;
1391 -- The cached value of source search path for this project file. Set by
1392 -- the first call to Prj.Env.Ada_Include_Path for the project. Do not
1393 -- use this field directly outside of the project manager, use
1394 -- Prj.Env.Ada_Include_Path instead.
1395
1396 Has_Multi_Unit_Sources : Boolean := False;
1397 -- Whether there is at least one source file containing multiple units
1398
1399 -------------------
1400 -- Miscellaneous --
1401 -------------------
1402
1403 Ada_Objects_Path : String_Access := null;
1404 -- The cached value of ADA_OBJECTS_PATH for this project file. Do not
1405 -- use this field directly outside of the compiler, use
1406 -- Prj.Env.Ada_Objects_Path instead.
1407
1408 Libgnarl_Needed : Yes_No_Unknown := Unknown;
1409 -- Set to True when libgnarl is needed to link
1410
1411 Objects_Path : String_Access := null;
1412 -- The cached value of the object dir path, used during the binding
1413 -- phase of gprbuild.
1414
1415 Objects_Path_File_With_Libs : Path_Name_Type := No_Path;
1416 -- The cached value of the object path temp file (including library
1417 -- dirs) for this project file.
1418
1419 Objects_Path_File_Without_Libs : Path_Name_Type := No_Path;
1420 -- The cached value of the object path temp file (excluding library
1421 -- dirs) for this project file.
1422
1423 Config_File_Name : Path_Name_Type := No_Path;
1424 -- The path name of the configuration pragmas file, if any
1425
1426 Config_File_Temp : Boolean := False;
1427 -- True if the configuration pragmas file is a temporary file that must
1428 -- be deleted at the end.
1429
1430 Config_Checked : Boolean := False;
1431 -- A flag to avoid checking repetitively the configuration pragmas file
1432
1433 Depth : Natural := 0;
1434 -- The maximum depth of a project in the project graph. Depth of main
1435 -- project is 0.
1436
1437 Unkept_Comments : Boolean := False;
1438 -- True if there are comments in the project sources that cannot be kept
1439 -- in the project tree.
1440
1441 -----------------------------
1442 -- Qualifier-Specific data --
1443 -----------------------------
1444
1445 -- The following fields are only valid for specific types of projects
1446
1447 case Qualifier is
1448 when Aggregate | Aggregate_Library =>
1449 Aggregated_Projects : Aggregated_Project_List := null;
1450 -- List of aggregated projects (which could themselves be
1451 -- aggregate projects).
1452
1453 when others =>
1454 null;
1455 end case;
1456 end record;
1457
1458 function Empty_Project (Qualifier : Project_Qualifier) return Project_Data;
1459 -- Return the representation of an empty project
1460
1461 function Is_Extending
1462 (Extending : Project_Id;
1463 Extended : Project_Id) return Boolean;
1464 -- Return True if Extending is extending the Extended project
1465
1466 function Is_Ext
1467 (Extending : Project_Id;
1468 Extended : Project_Id) return Boolean renames Is_Extending;
1469
1470 function Has_Ada_Sources (Data : Project_Id) return Boolean;
1471 -- Return True if the project has Ada sources
1472
1473 Project_Error : exception;
1474 -- Raised by some subprograms in Prj.Attr
1475
1476 package Units_Htable is new Simple_HTable
1477 (Header_Num => Header_Num,
1478 Element => Unit_Index,
1479 No_Element => No_Unit_Index,
1480 Key => Name_Id,
1481 Hash => Hash,
1482 Equal => "=");
1483 -- Mapping of unit names to indexes in the Units table
1484
1485 ---------------------
1486 -- Source_Iterator --
1487 ---------------------
1488
1489 type Source_Iterator is private;
1490
1491 function For_Each_Source
1492 (In_Tree : Project_Tree_Ref;
1493 Project : Project_Id := No_Project;
1494 Language : Name_Id := No_Name;
1495 Encapsulated_Libs : Boolean := True;
1496 Locally_Removed : Boolean := True) return Source_Iterator;
1497 -- Returns an iterator for all the sources of a project tree, or a specific
1498 -- project, or a specific language. Include sources from aggregated libs if
1499 -- Aggregated_Libs is True. If Locally_Removed is set to False the
1500 -- Locally_Removed files won't be reported.
1501
1502 function Element (Iter : Source_Iterator) return Source_Id;
1503 -- Return the current source (or No_Source if there are no more sources)
1504
1505 procedure Next (Iter : in out Source_Iterator);
1506 -- Move on to the next source
1507
1508 function Find_Source
1509 (In_Tree : Project_Tree_Ref;
1510 Project : Project_Id;
1511 In_Imported_Only : Boolean := False;
1512 In_Extended_Only : Boolean := False;
1513 Base_Name : File_Name_Type;
1514 Index : Int := 0) return Source_Id;
1515 -- Find the first source file with the given name.
1516 -- If In_Extended_Only is True, it will search in project and the project
1517 -- it extends, but not in the imported projects.
1518 -- Elsif In_Imported_Only is True, it will search in project and the
1519 -- projects it imports, but not in the others or in aggregated projects.
1520 -- Else it searches in the whole tree.
1521 -- If Index is specified, this only search for a source with that index.
1522
1523 -----------------------
1524 -- Project_Tree_Data --
1525 -----------------------
1526
1527 package Replaced_Source_HTable is new Simple_HTable
1528 (Header_Num => Header_Num,
1529 Element => File_Name_Type,
1530 No_Element => No_File,
1531 Key => File_Name_Type,
1532 Hash => Hash,
1533 Equal => "=");
1534
1535 type Private_Project_Tree_Data is private;
1536 -- Data for a project tree that is used only by the Project Manager
1537
1538 type Shared_Project_Tree_Data is record
1539 Name_Lists : Name_List_Table.Instance;
1540 Number_Lists : Number_List_Table.Instance;
1541 String_Elements : String_Element_Table.Instance;
1542 Variable_Elements : Variable_Element_Table.Instance;
1543 Array_Elements : Array_Element_Table.Instance;
1544 Arrays : Array_Table.Instance;
1545 Packages : Package_Table.Instance;
1546 Private_Part : Private_Project_Tree_Data;
1547 end record;
1548 type Shared_Project_Tree_Data_Access is access all Shared_Project_Tree_Data;
1549 -- The data that is shared among multiple trees, when these trees are
1550 -- loaded through the same aggregate project.
1551 -- To avoid ambiguities, limit the number of parameters to the
1552 -- subprograms (we would have to parse the "root project tree" since this
1553 -- is where the configuration file was loaded, in addition to the project's
1554 -- own tree) and make the comparison of projects easier, all trees store
1555 -- the lists in the same tables.
1556
1557 type Project_Tree_Appdata is tagged null record;
1558 type Project_Tree_Appdata_Access is access all Project_Tree_Appdata'Class;
1559 -- Application-specific data that can be associated with a project tree.
1560 -- We do not make the Project_Tree_Data itself tagged for several reasons:
1561 -- - it couldn't have a default value for its discriminant
1562 -- - it would require a "factory" to allocate such data, because trees
1563 -- are created automatically when parsing aggregate projects.
1564
1565 procedure Free (Tree : in out Project_Tree_Appdata);
1566 -- Should be overridden if your derive your own data
1567
1568 type Project_Tree_Data (Is_Root_Tree : Boolean := True) is record
1569 -- The root tree is the one loaded by the user from the command line.
1570 -- Is_Root_Tree is only false for projects aggregated within a root
1571 -- aggregate project.
1572
1573 Projects : Project_List;
1574 -- List of projects in this tree
1575
1576 Replaced_Sources : Replaced_Source_HTable.Instance;
1577 -- The list of sources that have been replaced by sources with
1578 -- different file names.
1579
1580 Replaced_Source_Number : Natural := 0;
1581 -- The number of entries in Replaced_Sources
1582
1583 Units_HT : Units_Htable.Instance;
1584 -- Unit name to Unit_Index (and from there to Source_Id)
1585
1586 Source_Files_HT : Source_Files_Htable.Instance;
1587 -- Base source file names to Source_Id list
1588
1589 Source_Paths_HT : Source_Paths_Htable.Instance;
1590 -- Full path to Source_Id
1591 -- ??? What is behavior for multi-unit source files, where there are
1592 -- several source_id per file ?
1593
1594 Source_Info_File_Name : String_Access := null;
1595 -- The name of the source info file, if specified by the builder
1596
1597 Source_Info_File_Exists : Boolean := False;
1598 -- True when a source info file has been successfully read
1599
1600 Shared : Shared_Project_Tree_Data_Access;
1601 -- The shared data for this tree and all aggregated trees
1602
1603 Appdata : Project_Tree_Appdata_Access;
1604 -- Application-specific data for this tree
1605
1606 case Is_Root_Tree is
1607 when True =>
1608 Shared_Data : aliased Shared_Project_Tree_Data;
1609 -- Do not access directly, only through Shared
1610
1611 when False =>
1612 null;
1613 end case;
1614 end record;
1615 -- Data for a project tree
1616
1617 function Debug_Name (Tree : Project_Tree_Ref) return Name_Id;
1618 -- If debug traces are activated, return an identitier for the project
1619 -- tree. This modifies Name_Buffer.
1620
1621 procedure Expect (The_Token : Token_Type; Token_Image : String);
1622 -- Check that the current token is The_Token. If it is not, then output
1623 -- an error message.
1624
1625 procedure Initialize (Tree : Project_Tree_Ref);
1626 -- This procedure must be called before using any services from the Prj
1627 -- hierarchy. Namet.Initialize must be called before Prj.Initialize.
1628
1629 procedure Reset (Tree : Project_Tree_Ref);
1630 -- This procedure resets all the tables that are used when processing a
1631 -- project file tree. Initialize must be called before the call to Reset.
1632
1633 package Project_Boolean_Htable is new Simple_HTable
1634 (Header_Num => Header_Num,
1635 Element => Boolean,
1636 No_Element => False,
1637 Key => Project_Id,
1638 Hash => Hash,
1639 Equal => "=");
1640 -- A table that associates a project to a boolean. This is used to detect
1641 -- whether a project was already processed for instance.
1642
1643 generic
1644 with procedure Action (Project : Project_Id; Tree : Project_Tree_Ref);
1645 procedure For_Project_And_Aggregated
1646 (Root_Project : Project_Id;
1647 Root_Tree : Project_Tree_Ref);
1648 -- Execute Action for Root_Project and all its aggregated projects
1649 -- recursively.
1650
1651 generic
1652 type State is limited private;
1653 with procedure Action
1654 (Project : Project_Id;
1655 Tree : Project_Tree_Ref;
1656 With_State : in out State);
1657 procedure For_Every_Project_Imported
1658 (By : Project_Id;
1659 Tree : Project_Tree_Ref;
1660 With_State : in out State;
1661 Include_Aggregated : Boolean := True;
1662 Imported_First : Boolean := False);
1663 -- Call Action for each project imported directly or indirectly by project
1664 -- By, as well as extended projects.
1665 --
1666 -- The order of processing depends on Imported_First:
1667 --
1668 -- If False, Action is called according to the order of importation: if A
1669 -- imports B, directly or indirectly, Action will be called for A before
1670 -- it is called for B. If two projects import each other directly or
1671 -- indirectly (using at least one "limited with"), it is not specified
1672 -- for which of these two projects Action will be called first.
1673 --
1674 -- The order is reversed if Imported_First is True
1675 --
1676 -- With_State may be used by Action to choose a behavior or to report some
1677 -- global result.
1678 --
1679 -- If Include_Aggregated is True, then an aggregate project will recurse
1680 -- into the projects it aggregates. Otherwise, the latter are never
1681 -- returned.
1682 --
1683 -- In_Aggregate_Lib is True if the project is in an aggregate library
1684 --
1685 -- The Tree argument passed to the callback is required in the case of
1686 -- aggregated projects, since they might not be using the same tree as 'By'
1687
1688 type Project_Context is record
1689 In_Aggregate_Lib : Boolean;
1690 -- True if the project is part of an aggregate library
1691
1692 From_Encapsulated_Lib : Boolean;
1693 -- True if the project is imported from an encapsulated library
1694 end record;
1695
1696 generic
1697 type State is limited private;
1698 with procedure Action
1699 (Project : Project_Id;
1700 Tree : Project_Tree_Ref;
1701 Context : Project_Context;
1702 With_State : in out State);
1703 procedure For_Every_Project_Imported_Context
1704 (By : Project_Id;
1705 Tree : Project_Tree_Ref;
1706 With_State : in out State;
1707 Include_Aggregated : Boolean := True;
1708 Imported_First : Boolean := False);
1709 -- As for For_Every_Project_Imported but with an associated context
1710
1711 generic
1712 with procedure Action
1713 (Project : Project_Id;
1714 Tree : Project_Tree_Ref;
1715 Context : Project_Context);
1716 procedure For_Project_And_Aggregated_Context
1717 (Root_Project : Project_Id;
1718 Root_Tree : Project_Tree_Ref);
1719 -- As for For_Project_And_Aggregated but with an associated context
1720
1721 function Extend_Name
1722 (File : File_Name_Type;
1723 With_Suffix : String) return File_Name_Type;
1724 -- Replace the extension of File with With_Suffix
1725
1726 function Object_Name
1727 (Source_File_Name : File_Name_Type;
1728 Object_File_Suffix : Name_Id := No_Name) return File_Name_Type;
1729 -- Returns the object file name corresponding to a source file name
1730
1731 function Object_Name
1732 (Source_File_Name : File_Name_Type;
1733 Source_Index : Int;
1734 Index_Separator : Character;
1735 Object_File_Suffix : Name_Id := No_Name) return File_Name_Type;
1736 -- Returns the object file name corresponding to a unit in a multi-source
1737 -- file.
1738
1739 function Dependency_Name
1740 (Source_File_Name : File_Name_Type;
1741 Dependency : Dependency_File_Kind) return File_Name_Type;
1742 -- Returns the dependency file name corresponding to a source file name
1743
1744 function Switches_Name
1745 (Source_File_Name : File_Name_Type) return File_Name_Type;
1746 -- Returns the switches file name corresponding to a source file name
1747
1748 procedure Set_Path_File_Var (Name : String; Value : String);
1749 -- Call Setenv, after calling To_Host_File_Spec
1750
1751 function Current_Source_Path_File_Of
1752 (Shared : Shared_Project_Tree_Data_Access) return Path_Name_Type;
1753 -- Get the current include path file name
1754
1755 procedure Set_Current_Source_Path_File_Of
1756 (Shared : Shared_Project_Tree_Data_Access;
1757 To : Path_Name_Type);
1758 -- Record the current include path file name
1759
1760 function Current_Object_Path_File_Of
1761 (Shared : Shared_Project_Tree_Data_Access) return Path_Name_Type;
1762 -- Get the current object path file name
1763
1764 procedure Set_Current_Object_Path_File_Of
1765 (Shared : Shared_Project_Tree_Data_Access;
1766 To : Path_Name_Type);
1767 -- Record the current object path file name
1768
1769 -----------
1770 -- Flags --
1771 -----------
1772
1773 type Processing_Flags is private;
1774 -- Flags used while parsing and processing a project tree to configure the
1775 -- behavior of the parser, and indicate how to report error messages. This
1776 -- structure does not allocate memory and never needs to be freed
1777
1778 type Error_Warning is (Silent, Warning, Error);
1779 -- Severity of some situations, such as: no Ada sources in a project where
1780 -- Ada is one of the language.
1781 --
1782 -- When the situation occurs, the behaviour depends on the setting:
1783 --
1784 -- - Silent: no action
1785 -- - Warning: issue a warning, does not cause the tool to fail
1786 -- - Error: issue an error, causes the tool to fail
1787
1788 type Error_Handler is access procedure
1789 (Project : Project_Id;
1790 Is_Warning : Boolean);
1791 -- This warns when an error was found when parsing a project. The error
1792 -- itself is handled through Prj.Err (and Prj.Err.Finalize should be called
1793 -- to actually print the error). This ensures that duplicate error messages
1794 -- are always correctly removed, that errors msgs are sorted, and that all
1795 -- tools will report the same error to the user.
1796
1797 function Create_Flags
1798 (Report_Error : Error_Handler;
1799 When_No_Sources : Error_Warning;
1800 Require_Sources_Other_Lang : Boolean := True;
1801 Allow_Duplicate_Basenames : Boolean := True;
1802 Compiler_Driver_Mandatory : Boolean := False;
1803 Error_On_Unknown_Language : Boolean := True;
1804 Require_Obj_Dirs : Error_Warning := Error;
1805 Allow_Invalid_External : Error_Warning := Error;
1806 Missing_Source_Files : Error_Warning := Error;
1807 Ignore_Missing_With : Boolean := False)
1808 return Processing_Flags;
1809 -- Function used to create Processing_Flags structure
1810 --
1811 -- If Allow_Duplicate_Basenames, then files with the same base names are
1812 -- authorized within a project for source-based languages (never for unit
1813 -- based languages).
1814 --
1815 -- If Compiler_Driver_Mandatory is true, then a Compiler.Driver attribute
1816 -- for each language must be defined, or we will not look for its source
1817 -- files.
1818 --
1819 -- When_No_Sources indicates what should be done when no sources of a
1820 -- language are found in a project where this language is declared.
1821 -- If Require_Sources_Other_Lang is true, then all languages must have at
1822 -- least one source file, or an error is reported via When_No_Sources. If
1823 -- it is false, this is only required for Ada (and only if it is a language
1824 -- of the project). When this parameter is set to False, we do not check
1825 -- that a proper naming scheme is defined for languages other than Ada.
1826 --
1827 -- If Report_Error is null, use the standard error reporting mechanism
1828 -- (Errout). Otherwise, report errors using Report_Error.
1829 --
1830 -- If Error_On_Unknown_Language is true, an error is displayed if some of
1831 -- the source files listed in the project do not match any naming scheme
1832 --
1833 -- If Require_Obj_Dirs is true, then all object directories must exist
1834 -- (possibly after they have been created automatically if the appropriate
1835 -- switches were specified), or an error is raised.
1836 --
1837 -- If Allow_Invalid_External is Silent, then no error is reported when an
1838 -- invalid value is used for an external variable (and it doesn't match its
1839 -- type). Instead, the first possible value is used.
1840 --
1841 -- Missing_Source_Files indicates whether it is an error or a warning that
1842 -- a source file mentioned in the Source_Files attributes is not actually
1843 -- found in the source directories. This also impacts errors for missing
1844 -- source directories.
1845 --
1846 -- If Ignore_Missing_With is True, then a "with" statement that cannot be
1847 -- resolved will simply be ignored. However, in such a case, the flag
1848 -- Incomplete_With in the project tree will be set to True.
1849 -- This is meant for use by tools so that they can properly set the
1850 -- project path in such a case:
1851 -- * no "gnatls" found (so no default project path)
1852 -- * user project sets Project.IDE'gnatls attribute to a cross gnatls
1853 -- * user project also includes a "with" that can only be resolved
1854 -- once we have found the gnatls
1855
1856 Gprbuild_Flags : constant Processing_Flags;
1857 Gprclean_Flags : constant Processing_Flags;
1858 Gprexec_Flags : constant Processing_Flags;
1859 Gnatmake_Flags : constant Processing_Flags;
1860 -- Flags used by the various tools. They all display the error messages
1861 -- through Prj.Err.
1862
1863 ----------------
1864 -- Temp Files --
1865 ----------------
1866
1867 procedure Record_Temp_File
1868 (Shared : Shared_Project_Tree_Data_Access;
1869 Path : Path_Name_Type);
1870 -- Record the path of a newly created temporary file, so that it can be
1871 -- deleted later.
1872
1873 procedure Delete_All_Temp_Files
1874 (Shared : Shared_Project_Tree_Data_Access);
1875 -- Delete all recorded temporary files.
1876 -- Does nothing if Debug.Debug_Flag_N is set
1877
1878 procedure Delete_Temp_Config_Files (Project_Tree : Project_Tree_Ref);
1879 -- Delete all temporary config files. Does nothing if Debug.Debug_Flag_N is
1880 -- set or if Project_Tree is null. This initially came from gnatmake
1881 -- ??? Should this be combined with Delete_All_Temp_Files above
1882
1883 procedure Delete_Temporary_File
1884 (Shared : Shared_Project_Tree_Data_Access := null;
1885 Path : Path_Name_Type);
1886 -- Delete a temporary file from the disk. The file is also removed from the
1887 -- list of temporary files to delete at the end of the program, in case
1888 -- another program running on the same machine has recreated it. Does
1889 -- nothing if Debug.Debug_Flag_N is set
1890
1891 Virtual_Prefix : constant String := "v$";
1892 -- The prefix for virtual extending projects. Because of the '$', which is
1893 -- normally forbidden for project names, there cannot be any name clash.
1894
1895 -----------
1896 -- Debug --
1897 -----------
1898
1899 type Verbosity is (Default, Medium, High);
1900 pragma Ordered (Verbosity);
1901 -- Verbosity when parsing GNAT Project Files
1902 -- Default is default (very quiet, if no errors).
1903 -- Medium is more verbose.
1904 -- High is extremely verbose.
1905
1906 Current_Verbosity : Verbosity := Default;
1907 -- The current value of the verbosity the project files are parsed with
1908
1909 procedure Debug_Indent;
1910 -- Inserts a series of blanks depending on the current indentation level
1911
1912 procedure Debug_Output (Str : String);
1913 procedure Debug_Output (Str : String; Str2 : Name_Id);
1914 -- If Current_Verbosity is not Default, outputs Str.
1915 -- This indents Str based on the current indentation level for traces
1916 -- Debug_Error is intended to be used to report an error in the traces.
1917
1918 procedure Debug_Increase_Indent
1919 (Str : String := ""; Str2 : Name_Id := No_Name);
1920 procedure Debug_Decrease_Indent (Str : String := "");
1921 -- Increase or decrease the indentation level for debug traces. This
1922 -- indentation level only affects output done through Debug_Output.
1923
1924 private
1925
1926 All_Packages : constant String_List_Access := null;
1927
1928 No_Project_Tree : constant Project_Tree_Ref := null;
1929
1930 Ignored : constant Variable_Kind := Single;
1931
1932 Nil_Variable_Value : constant Variable_Value :=
1933 (Project => No_Project,
1934 Kind => Undefined,
1935 Location => No_Location,
1936 Default => False);
1937
1938 type Source_Iterator is record
1939 In_Tree : Project_Tree_Ref;
1940
1941 Project : Project_List;
1942 All_Projects : Boolean;
1943 -- Current project and whether we should move on to the next
1944
1945 Language : Language_Ptr;
1946 -- Current language processed
1947
1948 Language_Name : Name_Id;
1949 -- Only sources of this language will be returned (or all if No_Name)
1950
1951 Current : Source_Id;
1952
1953 Encapsulated_Libs : Boolean;
1954 -- True if we want to include the sources from encapsulated libs
1955
1956 Locally_Removed : Boolean;
1957 end record;
1958
1959 procedure Add_To_Buffer
1960 (S : String;
1961 To : in out String_Access;
1962 Last : in out Natural);
1963 -- Append a String to the Buffer
1964
1965 package Temp_Files_Table is new GNAT.Dynamic_Tables
1966 (Table_Component_Type => Path_Name_Type,
1967 Table_Index_Type => Integer,
1968 Table_Low_Bound => 1,
1969 Table_Initial => 10,
1970 Table_Increment => 10);
1971 -- Table to store the path name of all the created temporary files, so that
1972 -- they can be deleted at the end, or when the program is interrupted.
1973
1974 type Private_Project_Tree_Data is record
1975 Temp_Files : Temp_Files_Table.Instance;
1976 -- Temporary files created as part of running tools (pragma files,
1977 -- mapping files,...)
1978
1979 Current_Source_Path_File : Path_Name_Type := No_Path;
1980 -- Current value of project source path file env var. Used to avoid
1981 -- setting the env var to the same value. When different from No_Path,
1982 -- this indicates that logical names (VMS) or environment variables were
1983 -- created and should be deassigned to avoid polluting the environment
1984 -- on VMS. This is for gnatmake only.
1985
1986 Current_Object_Path_File : Path_Name_Type := No_Path;
1987 -- Current value of project object path file env var. Used to avoid
1988 -- setting the env var to the same value.
1989 -- gnatmake only
1990
1991 end record;
1992 -- Type to represent the part of a project tree which is private to the
1993 -- Project Manager.
1994
1995 type Processing_Flags is record
1996 Require_Sources_Other_Lang : Boolean;
1997 Report_Error : Error_Handler;
1998 When_No_Sources : Error_Warning;
1999 Allow_Duplicate_Basenames : Boolean;
2000 Compiler_Driver_Mandatory : Boolean;
2001 Error_On_Unknown_Language : Boolean;
2002 Require_Obj_Dirs : Error_Warning;
2003 Allow_Invalid_External : Error_Warning;
2004 Missing_Source_Files : Error_Warning;
2005 Ignore_Missing_With : Boolean;
2006 end record;
2007
2008 Gprbuild_Flags : constant Processing_Flags :=
2009 (Report_Error => null,
2010 When_No_Sources => Warning,
2011 Require_Sources_Other_Lang => True,
2012 Allow_Duplicate_Basenames => False,
2013 Compiler_Driver_Mandatory => True,
2014 Error_On_Unknown_Language => True,
2015 Require_Obj_Dirs => Error,
2016 Allow_Invalid_External => Error,
2017 Missing_Source_Files => Error,
2018 Ignore_Missing_With => False);
2019
2020 Gprclean_Flags : constant Processing_Flags :=
2021 (Report_Error => null,
2022 When_No_Sources => Warning,
2023 Require_Sources_Other_Lang => True,
2024 Allow_Duplicate_Basenames => False,
2025 Compiler_Driver_Mandatory => True,
2026 Error_On_Unknown_Language => True,
2027 Require_Obj_Dirs => Warning,
2028 Allow_Invalid_External => Error,
2029 Missing_Source_Files => Error,
2030 Ignore_Missing_With => False);
2031
2032 Gprexec_Flags : constant Processing_Flags :=
2033 (Report_Error => null,
2034 When_No_Sources => Silent,
2035 Require_Sources_Other_Lang => False,
2036 Allow_Duplicate_Basenames => False,
2037 Compiler_Driver_Mandatory => False,
2038 Error_On_Unknown_Language => True,
2039 Require_Obj_Dirs => Silent,
2040 Allow_Invalid_External => Error,
2041 Missing_Source_Files => Silent,
2042 Ignore_Missing_With => False);
2043
2044 Gnatmake_Flags : constant Processing_Flags :=
2045 (Report_Error => null,
2046 When_No_Sources => Error,
2047 Require_Sources_Other_Lang => False,
2048 Allow_Duplicate_Basenames => False,
2049 Compiler_Driver_Mandatory => False,
2050 Error_On_Unknown_Language => False,
2051 Require_Obj_Dirs => Error,
2052 Allow_Invalid_External => Error,
2053 Missing_Source_Files => Error,
2054 Ignore_Missing_With => False);
2055
2056 end Prj;