PR middle-end/61455
[official-gcc.git] / gcc / ada / prj.ads
blob329cc6d21159bc7135ee4a90b32672a436d06186
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- P R J --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2001-2014, 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 ------------------------------------------------------------------------------
26 -- The following package declares the data types for GNAT project.
27 -- These data types may be used by GNAT Project-aware tools.
29 -- Children of these package implements various services on these data types.
30 -- See in particular Prj.Pars and Prj.Env.
32 with Casing; use Casing;
33 with Namet; use Namet;
34 with Osint;
35 with Scans; use Scans;
36 with Types; use Types;
38 with GNAT.Dynamic_HTables; use GNAT.Dynamic_HTables;
39 with GNAT.Dynamic_Tables;
40 with GNAT.OS_Lib; use GNAT.OS_Lib;
42 package Prj is
44 procedure Add_Restricted_Language (Name : String);
45 -- Call by gprbuild for each language specify by switch
46 -- --restricted-to-languages=.
48 procedure Remove_All_Restricted_Languages;
49 -- Call by gprbuild in CodePeer mode to ignore switches
50 -- --restricted-to-languages=.
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.
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.
60 Subdirs : String_Ptr := null;
61 -- The value after the equal sign in switch --subdirs=...
62 -- Contains the relative subdirectory.
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.
72 type Yes_No_Unknown is (Yes, No, Unknown);
73 -- Tri-state to decide if -lgnarl is needed when linking
75 pragma Warnings (Off);
76 type Project_Qualifier is
77 (Unspecified,
79 -- The following clash with Standard is OK, and justified by the context
80 -- which really wants to use the same set of qualifiers.
82 Standard,
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 ...
99 subtype Aggregate_Project is
100 Project_Qualifier range Aggregate .. Aggregate_Library;
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.
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.
111 No_Project_Tree : constant Project_Tree_Ref;
113 procedure Free (Tree : in out Project_Tree_Ref);
114 -- Free memory associated with the tree
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.
122 function Empty_File return File_Name_Type;
123 function Empty_String return Name_Id;
124 -- Return the id for an empty string ""
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
132 No_Path_Information : constant Path_Information := (No_Path, No_Path);
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
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).
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
161 type Variable_Kind is (Undefined, List, Single);
162 -- Different kinds of variables
164 subtype Defined_Variable_Kind is Variable_Kind range List .. Single;
165 -- The defined kinds of variables
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).
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.
188 Nil_Variable_Value : constant Variable_Value;
189 -- Value of a non existing variable or array element
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
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
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.
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
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.
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
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.
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
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)
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
283 type Language_Data;
284 type Language_Ptr is access all Language_Data;
285 -- Index of language data
287 No_Language_Index : constant Language_Ptr := null;
288 -- Constant indicating that there is no language data
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
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.
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
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.
312 -- Type of dependency to be checked
314 type Dependency_File_Kind is
315 (None,
316 -- There is no dependency file, the source must always be recompiled
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.
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.
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.
333 Makefile_Dependency_Suffix : constant String := ".d";
334 ALI_Dependency_Suffix : constant String := ".ali";
335 Switches_Dependency_Suffix : constant String := ".cswi";
337 Binder_Exchange_Suffix : constant String := ".bexch";
338 -- Suffix for binder exchange files
340 Library_Exchange_Suffix : constant String := ".lexch";
341 -- Suffix for library exchange files
343 type Name_List_Index is new Nat;
344 No_Name_List : constant Name_List_Index := 0;
346 type Name_Node is record
347 Name : Name_Id := No_Name;
348 Next : Name_List_Index := No_Name_List;
349 end record;
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
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
364 type Number_List_Index is new Nat;
365 No_Number_List : constant Number_List_Index := 0;
367 type Number_Node is record
368 Number : Natural := 0;
369 Next : Number_List_Index := No_Number_List;
370 end record;
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
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
389 -- The following record ???
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)
395 Casing : Casing_Type := All_Lower_Case;
396 -- The casing of the source file name (for Ada)
398 Separate_Suffix : File_Name_Type := No_File;
399 -- String to append to unit name for source file name of an Ada subunit
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.
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;
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);
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.
422 type Source_Data;
423 type Source_Id is access all Source_Data;
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.
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.
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.
441 No_Source : constant Source_Id := null;
443 type Path_Syntax_Kind is
444 (Canonical, -- Unix style
445 Host); -- Host specific syntax
447 -- The following record describes the configuration of a language
449 type Language_Config is record
450 Kind : Language_Kind := File_Based;
451 -- Kind of language. Most languages are file based. A few, such as Ada,
452 -- are unit based.
454 Naming_Data : Lang_Naming_Data;
455 -- The naming data for the languages (prefixes, etc.)
457 Include_Compatible_Languages : Name_List_Index := No_Name_List;
458 -- List of languages that are "include compatible" with this language. A
459 -- language B (for example "C") is "include compatible" with a language
460 -- A (for example "C++") if it is expected that sources of language A
461 -- may "include" header files from language B.
463 Compiler_Driver : File_Name_Type := No_File;
464 -- The name of the executable for the compiler of the language
466 Compiler_Driver_Path : String_Access := null;
467 -- The path name of the executable for the compiler of the language
469 Compiler_Leading_Required_Switches : Name_List_Index := No_Name_List;
470 -- The list of initial switches that are required as a minimum to invoke
471 -- the compiler driver.
473 Compiler_Trailing_Required_Switches : Name_List_Index := No_Name_List;
474 -- The list of final switches that are required as a minimum to invoke
475 -- the compiler driver.
477 Multi_Unit_Switches : Name_List_Index := No_Name_List;
478 -- The switch(es) to indicate the index of a unit in a multi-source file
480 Multi_Unit_Object_Separator : Character := ' ';
481 -- The string separating the base name of a source from the index of the
482 -- unit in a multi-source file, in the object file name.
484 Path_Syntax : Path_Syntax_Kind := Host;
485 -- Value may be Canonical (Unix style) or Host (host syntax)
487 Source_File_Switches : Name_List_Index := No_Name_List;
488 -- Optional switches to be put before the source file. The source file
489 -- path name is appended to the last switch in the list.
490 -- Example: ("-i", "");
492 Object_File_Suffix : Name_Id := No_Name;
493 -- Optional alternate object file suffix
495 Object_File_Switches : Name_List_Index := No_Name_List;
496 -- Optional object file switches. When this is defined, the switches
497 -- are used to specify the object file. The object file name is appended
498 -- to the last switch in the list. Example: ("-o", "").
500 Object_Path_Switches : Name_List_Index := No_Name_List;
501 -- List of switches to specify to the compiler the path name of a
502 -- temporary file containing the list of object directories in the
503 -- correct order.
505 Compilation_PIC_Option : Name_List_Index := No_Name_List;
506 -- The option(s) to compile a source in Position Independent Code for
507 -- shared libraries. Specified in the configuration. When not specified,
508 -- there is no need for such switch.
510 Object_Generated : Boolean := True;
511 -- False if no object file is generated
513 Objects_Linked : Boolean := True;
514 -- False if object files are not use to link executables and build
515 -- libraries.
517 Runtime_Library_Dir : Name_Id := No_Name;
518 -- Path name of the runtime library directory, if any
520 Runtime_Source_Dir : Name_Id := No_Name;
521 -- Path name of the runtime source directory, if any
523 Mapping_File_Switches : Name_List_Index := No_Name_List;
524 -- The option(s) to provide a mapping file to the compiler. Specified in
525 -- the configuration. When value is No_Name_List, there is no mapping
526 -- file.
528 Mapping_Spec_Suffix : File_Name_Type := No_File;
529 -- Placeholder representing the spec suffix in a mapping file
531 Mapping_Body_Suffix : File_Name_Type := No_File;
532 -- Placeholder representing the body suffix in a mapping file
534 Config_File_Switches : Name_List_Index := No_Name_List;
535 -- The option(s) to provide a config file to the compiler. Specified in
536 -- the configuration. If value is No_Name_List there is no config file.
538 Dependency_Kind : Dependency_File_Kind := None;
539 -- The kind of dependency to be checked: none, Makefile fragment or
540 -- ALI file (for Ada).
542 Dependency_Option : Name_List_Index := No_Name_List;
543 -- The option(s) to be used to create the dependency file. When value is
544 -- No_Name_List, there is not such option(s).
546 Compute_Dependency : Name_List_Index := No_Name_List;
547 -- Hold the value of attribute Dependency_Driver, if declared for the
548 -- language.
550 Include_Option : Name_List_Index := No_Name_List;
551 -- Hold the value of attribute Include_Switches, if declared for the
552 -- language.
554 Include_Path : Name_Id := No_Name;
555 -- Name of environment variable declared by attribute Include_Path for
556 -- the language.
558 Include_Path_File : Name_Id := No_Name;
559 -- Name of environment variable declared by attribute Include_Path_File
560 -- for the language.
562 Objects_Path : Name_Id := No_Name;
563 -- Name of environment variable declared by attribute Objects_Path for
564 -- the language.
566 Objects_Path_File : Name_Id := No_Name;
567 -- Name of environment variable declared by attribute Objects_Path_File
568 -- for the language.
570 Config_Body : Name_Id := No_Name;
571 -- The template for a pragma Source_File_Name(_Project) for a specific
572 -- file name of a body.
574 Config_Body_Index : Name_Id := No_Name;
575 -- The template for a pragma Source_File_Name(_Project) for a specific
576 -- file name of a body in a multi-source file.
578 Config_Body_Pattern : Name_Id := No_Name;
579 -- The template for a pragma Source_File_Name(_Project) for a naming
580 -- body pattern.
582 Config_Spec : Name_Id := No_Name;
583 -- The template for a pragma Source_File_Name(_Project) for a specific
584 -- file name of a spec.
586 Config_Spec_Index : Name_Id := No_Name;
587 -- The template for a pragma Source_File_Name(_Project) for a specific
588 -- file name of a spec in a multi-source file.
590 Config_Spec_Pattern : Name_Id := No_Name;
591 -- The template for a pragma Source_File_Name(_Project) for a naming
592 -- spec pattern.
594 Config_File_Unique : Boolean := False;
595 -- True if the config file specified to the compiler needs to be unique.
596 -- If it is unique, then all config files are concatenated into a temp
597 -- config file.
599 Binder_Driver : File_Name_Type := No_File;
600 -- The name of the binder driver for the language, if any
602 Binder_Driver_Path : Path_Name_Type := No_Path;
603 -- The path name of the binder driver
605 Binder_Required_Switches : Name_List_Index := No_Name_List;
606 -- Hold the value of attribute Binder'Required_Switches for the language
608 Binder_Prefix : Name_Id := No_Name;
609 -- Hold the value of attribute Binder'Prefix for the language
611 Toolchain_Version : Name_Id := No_Name;
612 -- Hold the value of attribute Toolchain_Version for the language
614 Toolchain_Description : Name_Id := No_Name;
615 -- Hold the value of attribute Toolchain_Description for the language
617 Clean_Object_Artifacts : Name_List_Index := No_Name_List;
618 -- List of object artifact extensions to be deleted by gprclean
620 Clean_Source_Artifacts : Name_List_Index := No_Name_List;
621 -- List of source artifact extensions to be deleted by gprclean
623 end record;
625 No_Language_Config : constant Language_Config :=
626 (Kind => File_Based,
627 Naming_Data => No_Lang_Naming_Data,
628 Include_Compatible_Languages => No_Name_List,
629 Compiler_Driver => No_File,
630 Compiler_Driver_Path => null,
631 Compiler_Leading_Required_Switches
632 => No_Name_List,
633 Compiler_Trailing_Required_Switches
634 => No_Name_List,
635 Multi_Unit_Switches => No_Name_List,
636 Multi_Unit_Object_Separator => ' ',
637 Path_Syntax => Canonical,
638 Source_File_Switches => No_Name_List,
639 Object_File_Suffix => No_Name,
640 Object_File_Switches => No_Name_List,
641 Object_Path_Switches => No_Name_List,
642 Compilation_PIC_Option => No_Name_List,
643 Object_Generated => True,
644 Objects_Linked => True,
645 Runtime_Library_Dir => No_Name,
646 Runtime_Source_Dir => No_Name,
647 Mapping_File_Switches => No_Name_List,
648 Mapping_Spec_Suffix => No_File,
649 Mapping_Body_Suffix => No_File,
650 Config_File_Switches => No_Name_List,
651 Dependency_Kind => None,
652 Dependency_Option => No_Name_List,
653 Compute_Dependency => No_Name_List,
654 Include_Option => No_Name_List,
655 Include_Path => No_Name,
656 Include_Path_File => No_Name,
657 Objects_Path => No_Name,
658 Objects_Path_File => No_Name,
659 Config_Body => No_Name,
660 Config_Body_Index => No_Name,
661 Config_Body_Pattern => No_Name,
662 Config_Spec => No_Name,
663 Config_Spec_Index => No_Name,
664 Config_Spec_Pattern => No_Name,
665 Config_File_Unique => False,
666 Binder_Driver => No_File,
667 Binder_Driver_Path => No_Path,
668 Binder_Required_Switches => No_Name_List,
669 Binder_Prefix => No_Name,
670 Toolchain_Version => No_Name,
671 Toolchain_Description => No_Name,
672 Clean_Object_Artifacts => No_Name_List,
673 Clean_Source_Artifacts => No_Name_List);
675 type Language_Data is record
676 Name : Name_Id := No_Name;
677 -- The name of the language in lower case
679 Display_Name : Name_Id := No_Name;
680 -- The name of the language, as found in attribute Languages
682 Config : Language_Config := No_Language_Config;
683 -- Configuration of the language
685 First_Source : Source_Id := No_Source;
686 -- Head of the list of sources of the language in the project
688 Mapping_Files : Mapping_Files_Htable.Instance :=
689 Mapping_Files_Htable.Nil;
690 -- Hash table containing the mapping of the sources to their path names
692 Next : Language_Ptr := No_Language_Index;
693 -- Next language of the project
695 end record;
697 No_Language_Data : constant Language_Data :=
698 (Name => No_Name,
699 Display_Name => No_Name,
700 Config => No_Language_Config,
701 First_Source => No_Source,
702 Mapping_Files => Mapping_Files_Htable.Nil,
703 Next => No_Language_Index);
705 type Language_List_Element;
706 type Language_List is access all Language_List_Element;
707 type Language_List_Element is record
708 Language : Language_Ptr := No_Language_Index;
709 Next : Language_List;
710 end record;
712 type Source_Kind is (Spec, Impl, Sep);
713 subtype Spec_Or_Body is Source_Kind range Spec .. Impl;
715 -- The following declarations declare a structure used to store the Name
716 -- and File and Path names of a unit, with a reference to its GNAT Project
717 -- File(s). Some units might have neither Spec nor Impl when they were
718 -- created for a "separate".
720 type File_Names_Data is array (Spec_Or_Body) of Source_Id;
722 type Unit_Data is record
723 Name : Name_Id := No_Name;
724 File_Names : File_Names_Data;
725 end record;
727 type Unit_Index is access all Unit_Data;
729 No_Unit_Index : constant Unit_Index := null;
730 -- Used to indicate a null entry for no unit
732 type Source_Roots;
733 type Roots_Access is access Source_Roots;
734 type Source_Roots is record
735 Root : Source_Id;
736 Next : Roots_Access;
737 end record;
738 -- A list to store the roots associated with a main unit. These are the
739 -- files that need to linked along with the main (for instance a C file
740 -- corresponding to an Ada file). In general, these are dependencies that
741 -- cannot be computed automatically by the builder.
743 type Naming_Exception_Type is (No, Yes, Inherited);
745 -- Structure to define source data
747 type Source_Data is record
748 Initialized : Boolean := False;
749 -- Set to True when Source_Data is completely initialized
751 Project : Project_Id := No_Project;
752 -- Project of the source
754 Location : Source_Ptr := No_Location;
755 -- Location in the project file of the declaration of the source in
756 -- package Naming.
758 Source_Dir_Rank : Natural := 0;
759 -- The rank of the source directory in list declared with attribute
760 -- Source_Dirs. Two source files with the same name cannot appears in
761 -- different directory with the same rank. That can happen when the
762 -- recursive notation <dir>/** is used in attribute Source_Dirs.
764 Language : Language_Ptr := No_Language_Index;
765 -- Language of the source
767 In_Interfaces : Boolean := True;
768 -- False when the source is not included in interfaces, when attribute
769 -- Interfaces is declared.
771 Declared_In_Interfaces : Boolean := False;
772 -- True when source is declared in attribute Interfaces
774 Alternate_Languages : Language_List := null;
775 -- List of languages a header file may also be, in addition of language
776 -- Language_Name.
778 Kind : Source_Kind := Spec;
779 -- Kind of the source: spec, body or subunit
781 Unit : Unit_Index := No_Unit_Index;
782 -- Name of the unit, if language is unit based. This is only set for
783 -- those files that are part of the compilation set (for instance a
784 -- file in an extended project that is overridden will not have this
785 -- field set).
787 Index : Int := 0;
788 -- Index of the source in a multi unit source file (the same Source_Data
789 -- is duplicated several times when there are several units in the same
790 -- file). Index is 0 if there is either no unit or a single one, and
791 -- starts at 1 when there are multiple units
793 Compilable : Yes_No_Unknown := Unknown;
794 -- Updated at the first call to Is_Compilable. Yes if source file is
795 -- compilable.
797 In_The_Queue : Boolean := False;
798 -- True if the source has been put in the queue
800 Locally_Removed : Boolean := False;
801 -- True if the source has been "excluded"
803 Suppressed : Boolean := False;
804 -- True if the source is a locally removed direct source of the project.
805 -- These sources should not be put in the mapping file.
807 Replaced_By : Source_Id := No_Source;
808 -- Source in an extending project that replaces the current source
810 File : File_Name_Type := No_File;
811 -- Canonical file name of the source
813 Display_File : File_Name_Type := No_File;
814 -- File name of the source, for display purposes
816 Path : Path_Information := No_Path_Information;
817 -- Path name of the source
819 Source_TS : Time_Stamp_Type := Empty_Time_Stamp;
820 -- Time stamp of the source file
822 Object_Project : Project_Id := No_Project;
823 -- Project where the object file is. This might be different from
824 -- Project when using extending project files.
826 Object : File_Name_Type := No_File;
827 -- File name of the object file
829 Current_Object_Path : Path_Name_Type := No_Path;
830 -- Object path of an existing object file
832 Object_Path : Path_Name_Type := No_Path;
833 -- Object path of the real object file
835 Object_TS : Time_Stamp_Type := Empty_Time_Stamp;
836 -- Object file time stamp
838 Dep_Name : File_Name_Type := No_File;
839 -- Dependency file simple name
841 Current_Dep_Path : Path_Name_Type := No_Path;
842 -- Path name of an existing dependency file
844 Dep_Path : Path_Name_Type := No_Path;
845 -- Path name of the real dependency file
847 Dep_TS : aliased Osint.File_Attributes := Osint.Unknown_Attributes;
848 -- Dependency file time stamp
850 Switches : File_Name_Type := No_File;
851 -- File name of the switches file. For all languages, this is a file
852 -- that ends with the .cswi extension.
854 Switches_Path : Path_Name_Type := No_Path;
855 -- Path name of the switches file
857 Switches_TS : Time_Stamp_Type := Empty_Time_Stamp;
858 -- Switches file time stamp
860 Naming_Exception : Naming_Exception_Type := No;
861 -- True if the source has an exceptional name
863 Duplicate_Unit : Boolean := False;
864 -- True when a duplicate unit has been reported for this source
866 Next_In_Lang : Source_Id := No_Source;
867 -- Link to another source of the same language in the same project
869 Next_With_File_Name : Source_Id := No_Source;
870 -- Link to another source with the same base file name
872 Roots : Roots_Access := null;
873 -- The roots for a main unit
875 end record;
877 No_Source_Data : constant Source_Data :=
878 (Initialized => False,
879 Project => No_Project,
880 Location => No_Location,
881 Source_Dir_Rank => 0,
882 Language => No_Language_Index,
883 In_Interfaces => True,
884 Declared_In_Interfaces => False,
885 Alternate_Languages => null,
886 Kind => Spec,
887 Unit => No_Unit_Index,
888 Index => 0,
889 Locally_Removed => False,
890 Suppressed => False,
891 Compilable => Unknown,
892 In_The_Queue => False,
893 Replaced_By => No_Source,
894 File => No_File,
895 Display_File => No_File,
896 Path => No_Path_Information,
897 Source_TS => Empty_Time_Stamp,
898 Object_Project => No_Project,
899 Object => No_File,
900 Current_Object_Path => No_Path,
901 Object_Path => No_Path,
902 Object_TS => Empty_Time_Stamp,
903 Dep_Name => No_File,
904 Current_Dep_Path => No_Path,
905 Dep_Path => No_Path,
906 Dep_TS => Osint.Unknown_Attributes,
907 Switches => No_File,
908 Switches_Path => No_Path,
909 Switches_TS => Empty_Time_Stamp,
910 Naming_Exception => No,
911 Duplicate_Unit => False,
912 Next_In_Lang => No_Source,
913 Next_With_File_Name => No_Source,
914 Roots => null);
916 package Source_Files_Htable is new Simple_HTable
917 (Header_Num => Header_Num,
918 Element => Source_Id,
919 No_Element => No_Source,
920 Key => File_Name_Type,
921 Hash => Hash,
922 Equal => "=");
923 -- Mapping of source file names to source ids
925 package Source_Paths_Htable is new Simple_HTable
926 (Header_Num => Header_Num,
927 Element => Source_Id,
928 No_Element => No_Source,
929 Key => Path_Name_Type,
930 Hash => Hash,
931 Equal => "=");
932 -- Mapping of source paths to source ids
934 type Lib_Kind is (Static, Dynamic, Relocatable);
936 type Policy is (Autonomous, Compliant, Controlled, Restricted, Direct);
937 -- Type to specify the symbol policy, when symbol control is supported.
938 -- See full explanation about this type in package Symbols.
939 -- Autonomous: Create a symbol file without considering any reference
940 -- Compliant: Try to be as compatible as possible with an existing ref
941 -- Controlled: Fail if symbols are not the same as those in the reference
942 -- Restricted: Restrict the symbols to those in the symbol file
943 -- Direct: The symbol file is used as is
945 type Symbol_Record is record
946 Symbol_File : Path_Name_Type := No_Path;
947 Reference : Path_Name_Type := No_Path;
948 Symbol_Policy : Policy := Autonomous;
949 end record;
950 -- Type to keep the symbol data to be used when building a shared library
952 No_Symbols : constant Symbol_Record :=
953 (Symbol_File => No_Path,
954 Reference => No_Path,
955 Symbol_Policy => Autonomous);
956 -- The default value of the symbol data
958 function Image (The_Casing : Casing_Type) return String;
959 -- Similar to 'Image (but avoid use of this attribute in compiler)
961 function Value (Image : String) return Casing_Type;
962 -- Similar to 'Value (but avoid use of this attribute in compiler)
963 -- Raises Constraint_Error if not a Casing_Type image.
965 -- The following record contains data for a naming scheme
967 function Get_Object_Directory
968 (Project : Project_Id;
969 Including_Libraries : Boolean;
970 Only_If_Ada : Boolean := False) return Path_Name_Type;
971 -- Return the object directory to use for the project. This depends on
972 -- whether we have a library project or a standard project. This function
973 -- might return No_Name when no directory applies. If the project is a
974 -- library project file and Including_Libraries is True then the library
975 -- ALI dir is returned instead of the object dir, except when there is no
976 -- ALI files in the Library ALI dir and the object directory exists. If
977 -- Only_If_Ada is True, then No_Name is returned when the project doesn't
978 -- include any Ada source.
980 procedure Compute_All_Imported_Projects
981 (Root_Project : Project_Id;
982 Tree : Project_Tree_Ref);
983 -- For all projects in the tree, compute the list of the projects imported
984 -- directly or indirectly by project Root_Project. The result is stored in
985 -- Project.All_Imported_Projects for each project
987 function Ultimate_Extending_Project_Of
988 (Proj : Project_Id) return Project_Id;
989 -- Returns the ultimate extending project of project Proj. If project Proj
990 -- is not extended, returns Proj.
992 type Project_List_Element;
993 type Project_List is access all Project_List_Element;
994 type Project_List_Element is record
995 Project : Project_Id := No_Project;
996 From_Encapsulated_Lib : Boolean := False;
997 Next : Project_List := null;
998 end record;
999 -- A list of projects
1001 procedure Free_List
1002 (List : in out Project_List;
1003 Free_Project : Boolean);
1004 -- Free the list of projects, if Free_Project, each project is also freed
1006 type Response_File_Format is
1007 (None,
1008 GNU,
1009 Object_List,
1010 Option_List,
1011 GCC,
1012 GCC_GNU,
1013 GCC_Object_List,
1014 GCC_Option_List);
1015 -- The format of the different response files
1017 type Project_Configuration is record
1018 Target : Name_Id := No_Name;
1019 -- The target of the configuration, when specified
1021 Run_Path_Option : Name_List_Index := No_Name_List;
1022 -- The option to use when linking to specify the path where to look for
1023 -- libraries.
1025 Run_Path_Origin : Name_Id := No_Name;
1026 -- Specify the string (such as "$ORIGIN") to indicate paths relative to
1027 -- the directory of the executable in the run path option.
1029 Library_Install_Name_Option : Name_Id := No_Name;
1030 -- When this is not an empty list, this option, followed by the single
1031 -- name of the shared library file is used when linking a shared
1032 -- library.
1034 Separate_Run_Path_Options : Boolean := False;
1035 -- True if each directory needs to be specified in a separate run path
1036 -- option.
1038 Executable_Suffix : Name_Id := No_Name;
1039 -- The suffix of executables, when specified in the configuration or in
1040 -- package Builder of the main project. When this is not specified, the
1041 -- executable suffix is the default for the platform.
1043 -- Linking
1045 Linker : Path_Name_Type := No_Path;
1046 -- Path name of the linker driver. Specified in the configuration or in
1047 -- the package Builder of the main project.
1049 Map_File_Option : Name_Id := No_Name;
1050 -- Option to use when invoking the linker to build a map file
1052 Trailing_Linker_Required_Switches : Name_List_Index := No_Name_List;
1053 -- The minimum options for the linker driver. Specified in the
1054 -- configuration.
1056 Linker_Executable_Option : Name_List_Index := No_Name_List;
1057 -- The option(s) to indicate the name of the executable in the linker
1058 -- command. Specified in the configuration. When not specified, default
1059 -- to -o <executable name>.
1061 Linker_Lib_Dir_Option : Name_Id := No_Name;
1062 -- The option to specify where to find a library for linking. Specified
1063 -- in the configuration. When not specified, defaults to "-L".
1065 Linker_Lib_Name_Option : Name_Id := No_Name;
1066 -- The option to specify the name of a library for linking. Specified in
1067 -- the configuration. When not specified, defaults to "-l".
1069 Max_Command_Line_Length : Natural := 0;
1070 -- When positive and when Resp_File_Format (see below) is not None,
1071 -- if the command line for the invocation of the linker would be greater
1072 -- than this value, a response file is used to invoke the linker.
1074 Resp_File_Format : Response_File_Format := None;
1075 -- The format of a response file, when linking with a response file is
1076 -- supported.
1078 Resp_File_Options : Name_List_Index := No_Name_List;
1079 -- The switches, if any, that precede the path name of the response
1080 -- file in the invocation of the linker.
1082 -- Libraries
1084 Library_Builder : Path_Name_Type := No_Path;
1085 -- The executable to build library (specified in the configuration)
1087 Lib_Support : Library_Support := None;
1088 -- The level of library support. Specified in the configuration. Support
1089 -- is none, static libraries only or both static and shared libraries.
1091 Lib_Encapsulated_Supported : Boolean := False;
1092 -- True when building fully standalone libraries supported on the target
1094 Archive_Builder : Name_List_Index := No_Name_List;
1095 -- The name of the executable to build archives, with the minimum
1096 -- switches. Specified in the configuration.
1098 Archive_Builder_Append_Option : Name_List_Index := No_Name_List;
1099 -- The options to append object files to an archive
1101 Archive_Indexer : Name_List_Index := No_Name_List;
1102 -- The name of the executable to index archives, with the minimum
1103 -- switches. Specified in the configuration.
1105 Archive_Suffix : File_Name_Type := No_File;
1106 -- The suffix of archives. Specified in the configuration. When not
1107 -- specified, defaults to ".a".
1109 Lib_Partial_Linker : Name_List_Index := No_Name_List;
1111 -- Shared libraries
1113 Shared_Lib_Driver : File_Name_Type := No_File;
1114 -- The driver to link shared libraries. Set with attribute Library_GCC.
1115 -- Default to gcc.
1117 Shared_Lib_Prefix : File_Name_Type := No_File;
1118 -- Part of a shared library file name that precedes the name of the
1119 -- library. Specified in the configuration. When not specified, defaults
1120 -- to "lib".
1122 Shared_Lib_Suffix : File_Name_Type := No_File;
1123 -- Suffix of shared libraries, after the library name in the shared
1124 -- library name. Specified in the configuration. When not specified,
1125 -- default to ".so".
1127 Shared_Lib_Min_Options : Name_List_Index := No_Name_List;
1128 -- The minimum options to use when building a shared library
1130 Lib_Version_Options : Name_List_Index := No_Name_List;
1131 -- The options to use to specify a library version
1133 Symbolic_Link_Supported : Boolean := False;
1134 -- True if the platform supports symbolic link files
1136 Lib_Maj_Min_Id_Supported : Boolean := False;
1137 -- True if platform supports library major and minor options, such as
1138 -- libname.so -> libname.so.2 -> libname.so.2.4
1140 Auto_Init_Supported : Boolean := False;
1141 -- True if automatic initialisation is supported for shared stand-alone
1142 -- libraries.
1144 -- Cleaning
1146 Artifacts_In_Exec_Dir : Name_List_Index := No_Name_List;
1147 -- List of regexp file names to be cleaned in the exec directory of the
1148 -- main project.
1150 Artifacts_In_Object_Dir : Name_List_Index := No_Name_List;
1151 -- List of regexp file names to be cleaned in the object directory of
1152 -- all projects.
1154 end record;
1156 Default_Project_Config : constant Project_Configuration :=
1157 (Target => No_Name,
1158 Run_Path_Option => No_Name_List,
1159 Run_Path_Origin => No_Name,
1160 Library_Install_Name_Option => No_Name,
1161 Separate_Run_Path_Options => False,
1162 Executable_Suffix => No_Name,
1163 Linker => No_Path,
1164 Map_File_Option => No_Name,
1165 Trailing_Linker_Required_Switches =>
1166 No_Name_List,
1167 Linker_Executable_Option => No_Name_List,
1168 Linker_Lib_Dir_Option => No_Name,
1169 Linker_Lib_Name_Option => No_Name,
1170 Library_Builder => No_Path,
1171 Max_Command_Line_Length => 0,
1172 Resp_File_Format => None,
1173 Resp_File_Options => No_Name_List,
1174 Lib_Support => None,
1175 Lib_Encapsulated_Supported => False,
1176 Archive_Builder => No_Name_List,
1177 Archive_Builder_Append_Option => No_Name_List,
1178 Archive_Indexer => No_Name_List,
1179 Archive_Suffix => No_File,
1180 Lib_Partial_Linker => No_Name_List,
1181 Shared_Lib_Driver => No_File,
1182 Shared_Lib_Prefix => No_File,
1183 Shared_Lib_Suffix => No_File,
1184 Shared_Lib_Min_Options => No_Name_List,
1185 Lib_Version_Options => No_Name_List,
1186 Symbolic_Link_Supported => False,
1187 Lib_Maj_Min_Id_Supported => False,
1188 Auto_Init_Supported => False,
1189 Artifacts_In_Exec_Dir => No_Name_List,
1190 Artifacts_In_Object_Dir => No_Name_List);
1192 -------------------------
1193 -- Aggregated projects --
1194 -------------------------
1196 type Aggregated_Project;
1197 type Aggregated_Project_List is access all Aggregated_Project;
1198 type Aggregated_Project is record
1199 Path : Path_Name_Type;
1200 Tree : Project_Tree_Ref;
1201 Project : Project_Id;
1202 Next : Aggregated_Project_List;
1203 end record;
1205 procedure Free (List : in out Aggregated_Project_List);
1206 -- Free the memory used for List
1208 procedure Add_Aggregated_Project
1209 (Project : Project_Id;
1210 Path : Path_Name_Type);
1211 -- Add a new aggregated project in Project.
1212 -- The aggregated project has not been processed yet. This procedure should
1213 -- the called while processing the aggregate project, and as a result
1214 -- Prj.Proc.Process will then automatically process the aggregated projects
1216 ------------------
1217 -- Project_Data --
1218 ------------------
1220 -- The following record describes a project file representation
1222 pragma Warnings (Off);
1223 type Standalone is
1224 (No,
1226 -- The following clash with Standard is OK, and justified by the context
1227 -- which really wants to use the same set of qualifiers.
1229 Standard,
1231 Encapsulated);
1232 pragma Warnings (On);
1234 type Project_Data (Qualifier : Project_Qualifier := Unspecified) is record
1236 -------------
1237 -- General --
1238 -------------
1240 Name : Name_Id := No_Name;
1241 -- The name of the project
1243 Display_Name : Name_Id := No_Name;
1244 -- The name of the project with the spelling of its declaration
1246 Externally_Built : Boolean := False;
1247 -- True if the project is externally built. In such case, the Project
1248 -- Manager will not modify anything in this project.
1250 Config : Project_Configuration;
1252 Path : Path_Information := No_Path_Information;
1253 -- The path name of the project file. This include base name of the
1254 -- project file.
1256 Virtual : Boolean := False;
1257 -- True for virtual extending projects
1259 Location : Source_Ptr := No_Location;
1260 -- The location in the project file source of the project name that
1261 -- immediately follows the reserved word "project".
1263 ---------------
1264 -- Languages --
1265 ---------------
1267 Languages : Language_Ptr := No_Language_Index;
1268 -- First index of the language data in the project. Traversing the list
1269 -- gives access to all the languages supported by the project.
1271 --------------
1272 -- Projects --
1273 --------------
1275 Mains : String_List_Id := Nil_String;
1276 -- List of mains specified by attribute Main
1278 Extends : Project_Id := No_Project;
1279 -- The reference of the project file, if any, that this project file
1280 -- extends.
1282 Extended_By : Project_Id := No_Project;
1283 -- The reference of the project file, if any, that extends this project
1284 -- file.
1286 Decl : Declarations := No_Declarations;
1287 -- The declarations (variables, attributes and packages) of this project
1288 -- file.
1290 Imported_Projects : Project_List := null;
1291 -- The list of all directly imported projects, if any
1293 All_Imported_Projects : Project_List := null;
1294 -- The list of all projects imported directly or indirectly, if any.
1295 -- This does not include the project itself.
1297 -----------------
1298 -- Directories --
1299 -----------------
1301 Directory : Path_Information := No_Path_Information;
1302 -- Path name of the directory where the project file resides
1304 Object_Directory : Path_Information := No_Path_Information;
1305 -- The path name of the object directory of this project file
1307 Exec_Directory : Path_Information := No_Path_Information;
1308 -- The path name of the exec directory of this project file. Default is
1309 -- equal to Object_Directory.
1311 Object_Path_File : Path_Name_Type := No_Path;
1312 -- Store the name of the temporary file that contains the list of object
1313 -- directories, when attribute Object_Path_Switches is declared.
1315 -------------
1316 -- Library --
1317 -------------
1319 Library : Boolean := False;
1320 -- True if this is a library project
1322 Library_Name : Name_Id := No_Name;
1323 -- If a library project, name of the library
1325 Library_Kind : Lib_Kind := Static;
1326 -- If a library project, kind of library
1328 Library_Dir : Path_Information := No_Path_Information;
1329 -- If a library project, path name of the directory where the library
1330 -- resides.
1332 Library_TS : Time_Stamp_Type := Empty_Time_Stamp;
1333 -- The timestamp of a library file in a library project
1335 Library_Src_Dir : Path_Information := No_Path_Information;
1336 -- If a Stand-Alone Library project, path name of the directory where
1337 -- the sources of the interfaces of the library are copied. By default,
1338 -- if attribute Library_Src_Dir is not specified, sources of the
1339 -- interfaces are not copied anywhere.
1341 Library_ALI_Dir : Path_Information := No_Path_Information;
1342 -- In a library project, path name of the directory where the ALI files
1343 -- are copied. If attribute Library_ALI_Dir is not specified, ALI files
1344 -- are copied in the Library_Dir.
1346 Lib_Internal_Name : Name_Id := No_Name;
1347 -- If a library project, internal name store inside the library
1349 Standalone_Library : Standalone := No;
1350 -- Indicate that this is a Standalone Library Project File
1352 Lib_Interface_ALIs : String_List_Id := Nil_String;
1353 -- For Standalone Library Project Files, list of Interface ALI files
1355 Other_Interfaces : String_List_Id := Nil_String;
1356 -- List of non unit based sources in attribute Interfaces
1358 Lib_Auto_Init : Boolean := False;
1359 -- For non static Stand-Alone Library Project Files, True if the library
1360 -- initialisation should be automatic.
1362 Symbol_Data : Symbol_Record := No_Symbols;
1363 -- Symbol file name, reference symbol file name, symbol policy
1365 Need_To_Build_Lib : Boolean := False;
1366 -- True if the library of a Library Project needs to be built or rebuilt
1368 -------------
1369 -- Sources --
1370 -------------
1371 -- The sources for all languages including Ada are accessible through
1372 -- the Source_Iterator type
1374 Interfaces_Defined : Boolean := False;
1375 -- True if attribute Interfaces is declared for the project or any
1376 -- project it extends.
1378 Include_Path_File : Path_Name_Type := No_Path;
1379 -- The path name of the of the source search directory file.
1380 -- This is only used by gnatmake
1382 Source_Dirs : String_List_Id := Nil_String;
1383 -- The list of all the source directories
1385 Source_Dir_Ranks : Number_List_Index := No_Number_List;
1387 Ada_Include_Path : String_Access := null;
1388 -- The cached value of source search path for this project file. Set by
1389 -- the first call to Prj.Env.Ada_Include_Path for the project. Do not
1390 -- use this field directly outside of the project manager, use
1391 -- Prj.Env.Ada_Include_Path instead.
1393 Has_Multi_Unit_Sources : Boolean := False;
1394 -- Whether there is at least one source file containing multiple units
1396 -------------------
1397 -- Miscellaneous --
1398 -------------------
1400 Ada_Objects_Path : String_Access := null;
1401 -- The cached value of ADA_OBJECTS_PATH for this project file, with
1402 -- library ALI directories for library projects instead of object
1403 -- directories. Do not use this field directly outside of the
1404 -- compiler, use Prj.Env.Ada_Objects_Path instead.
1406 Ada_Objects_Path_No_Libs : String_Access := null;
1407 -- The cached value of ADA_OBJECTS_PATH for this project file with all
1408 -- object directories (no library ALI dir for library projects).
1410 Libgnarl_Needed : Yes_No_Unknown := Unknown;
1411 -- Set to True when libgnarl is needed to link
1413 Objects_Path : String_Access := null;
1414 -- The cached value of the object dir path, used during the binding
1415 -- phase of gprbuild.
1417 Objects_Path_File_With_Libs : Path_Name_Type := No_Path;
1418 -- The cached value of the object path temp file (including library
1419 -- dirs) for this project file.
1421 Objects_Path_File_Without_Libs : Path_Name_Type := No_Path;
1422 -- The cached value of the object path temp file (excluding library
1423 -- dirs) for this project file.
1425 Config_File_Name : Path_Name_Type := No_Path;
1426 -- The path name of the configuration pragmas file, if any
1428 Config_File_Temp : Boolean := False;
1429 -- True if the configuration pragmas file is a temporary file that must
1430 -- be deleted at the end.
1432 Config_Checked : Boolean := False;
1433 -- A flag to avoid checking repetitively the configuration pragmas file
1435 Depth : Natural := 0;
1436 -- The maximum depth of a project in the project graph. Depth of main
1437 -- project is 0.
1439 Unkept_Comments : Boolean := False;
1440 -- True if there are comments in the project sources that cannot be kept
1441 -- in the project tree.
1443 -----------------------------
1444 -- Qualifier-Specific data --
1445 -----------------------------
1447 -- The following fields are only valid for specific types of projects
1449 case Qualifier is
1450 when Aggregate | Aggregate_Library =>
1451 Aggregated_Projects : Aggregated_Project_List := null;
1452 -- List of aggregated projects (which could themselves be
1453 -- aggregate projects).
1455 when others =>
1456 null;
1457 end case;
1458 end record;
1460 function Empty_Project (Qualifier : Project_Qualifier) return Project_Data;
1461 -- Return the representation of an empty project
1463 function Is_Extending
1464 (Extending : Project_Id;
1465 Extended : Project_Id) return Boolean;
1466 -- Return True if Extending is extending the Extended project
1468 function Is_Ext
1469 (Extending : Project_Id;
1470 Extended : Project_Id) return Boolean renames Is_Extending;
1472 function Has_Ada_Sources (Data : Project_Id) return Boolean;
1473 -- Return True if the project has Ada sources
1475 Project_Error : exception;
1476 -- Raised by some subprograms in Prj.Attr
1478 package Units_Htable is new Simple_HTable
1479 (Header_Num => Header_Num,
1480 Element => Unit_Index,
1481 No_Element => No_Unit_Index,
1482 Key => Name_Id,
1483 Hash => Hash,
1484 Equal => "=");
1485 -- Mapping of unit names to indexes in the Units table
1487 ---------------------
1488 -- Source_Iterator --
1489 ---------------------
1491 type Source_Iterator is private;
1493 function For_Each_Source
1494 (In_Tree : Project_Tree_Ref;
1495 Project : Project_Id := No_Project;
1496 Language : Name_Id := No_Name;
1497 Encapsulated_Libs : Boolean := True;
1498 Locally_Removed : Boolean := True) return Source_Iterator;
1499 -- Returns an iterator for all the sources of a project tree, or a specific
1500 -- project, or a specific language. Include sources from aggregated libs if
1501 -- Aggregated_Libs is True. If Locally_Removed is set to False the
1502 -- Locally_Removed files won't be reported.
1504 function Element (Iter : Source_Iterator) return Source_Id;
1505 -- Return the current source (or No_Source if there are no more sources)
1507 procedure Next (Iter : in out Source_Iterator);
1508 -- Move on to the next source
1510 function Find_Source
1511 (In_Tree : Project_Tree_Ref;
1512 Project : Project_Id;
1513 In_Imported_Only : Boolean := False;
1514 In_Extended_Only : Boolean := False;
1515 Base_Name : File_Name_Type;
1516 Index : Int := 0) return Source_Id;
1517 -- Find the first source file with the given name.
1518 -- If In_Extended_Only is True, it will search in project and the project
1519 -- it extends, but not in the imported projects.
1520 -- Elsif In_Imported_Only is True, it will search in project and the
1521 -- projects it imports, but not in the others or in aggregated projects.
1522 -- Else it searches in the whole tree.
1523 -- If Index is specified, this only search for a source with that index.
1525 type Source_Ids is array (Positive range <>) of Source_Id;
1526 No_Sources : constant Source_Ids := (1 .. 0 => No_Source);
1528 function Find_All_Sources
1529 (In_Tree : Project_Tree_Ref;
1530 Project : Project_Id;
1531 In_Imported_Only : Boolean := False;
1532 In_Extended_Only : Boolean := False;
1533 Base_Name : File_Name_Type;
1534 Index : Int := 0) return Source_Ids;
1535 -- Find all source files with the given name:
1537 -- If In_Extended_Only is True, it will search in project and the project
1538 -- it extends, but not in the imported projects.
1540 -- If Extended_Only is False, and In_Imported_Only is True, it will
1541 -- search in project and the projects it imports, but not in the others
1542 -- or in aggregated projects.
1544 -- If both Extended_Only and In_Imported_Only are False (the default)
1545 -- then it searches the whole tree.
1547 -- If Index is specified, this only search for sources with that index.
1549 -----------------------
1550 -- Project_Tree_Data --
1551 -----------------------
1553 package Replaced_Source_HTable is new Simple_HTable
1554 (Header_Num => Header_Num,
1555 Element => File_Name_Type,
1556 No_Element => No_File,
1557 Key => File_Name_Type,
1558 Hash => Hash,
1559 Equal => "=");
1561 type Private_Project_Tree_Data is private;
1562 -- Data for a project tree that is used only by the Project Manager
1564 type Shared_Project_Tree_Data is record
1565 Name_Lists : Name_List_Table.Instance;
1566 Number_Lists : Number_List_Table.Instance;
1567 String_Elements : String_Element_Table.Instance;
1568 Variable_Elements : Variable_Element_Table.Instance;
1569 Array_Elements : Array_Element_Table.Instance;
1570 Arrays : Array_Table.Instance;
1571 Packages : Package_Table.Instance;
1572 Private_Part : Private_Project_Tree_Data;
1573 end record;
1574 type Shared_Project_Tree_Data_Access is access all Shared_Project_Tree_Data;
1575 -- The data that is shared among multiple trees, when these trees are
1576 -- loaded through the same aggregate project.
1577 -- To avoid ambiguities, limit the number of parameters to the
1578 -- subprograms (we would have to parse the "root project tree" since this
1579 -- is where the configuration file was loaded, in addition to the project's
1580 -- own tree) and make the comparison of projects easier, all trees store
1581 -- the lists in the same tables.
1583 type Project_Tree_Appdata is tagged null record;
1584 type Project_Tree_Appdata_Access is access all Project_Tree_Appdata'Class;
1585 -- Application-specific data that can be associated with a project tree.
1586 -- We do not make the Project_Tree_Data itself tagged for several reasons:
1587 -- - it couldn't have a default value for its discriminant
1588 -- - it would require a "factory" to allocate such data, because trees
1589 -- are created automatically when parsing aggregate projects.
1591 procedure Free (Tree : in out Project_Tree_Appdata);
1592 -- Should be overridden if your derive your own data
1594 type Project_Tree_Data (Is_Root_Tree : Boolean := True) is record
1595 -- The root tree is the one loaded by the user from the command line.
1596 -- Is_Root_Tree is only false for projects aggregated within a root
1597 -- aggregate project.
1599 Projects : Project_List;
1600 -- List of projects in this tree
1602 Replaced_Sources : Replaced_Source_HTable.Instance;
1603 -- The list of sources that have been replaced by sources with
1604 -- different file names.
1606 Replaced_Source_Number : Natural := 0;
1607 -- The number of entries in Replaced_Sources
1609 Units_HT : Units_Htable.Instance;
1610 -- Unit name to Unit_Index (and from there to Source_Id)
1612 Source_Files_HT : Source_Files_Htable.Instance;
1613 -- Base source file names to Source_Id list
1615 Source_Paths_HT : Source_Paths_Htable.Instance;
1616 -- Full path to Source_Id
1617 -- ??? What is behavior for multi-unit source files, where there are
1618 -- several source_id per file ?
1620 Source_Info_File_Name : String_Access := null;
1621 -- The name of the source info file, if specified by the builder
1623 Source_Info_File_Exists : Boolean := False;
1624 -- True when a source info file has been successfully read
1626 Shared : Shared_Project_Tree_Data_Access;
1627 -- The shared data for this tree and all aggregated trees
1629 Appdata : Project_Tree_Appdata_Access;
1630 -- Application-specific data for this tree
1632 case Is_Root_Tree is
1633 when True =>
1634 Shared_Data : aliased Shared_Project_Tree_Data;
1635 -- Do not access directly, only through Shared
1637 when False =>
1638 null;
1639 end case;
1640 end record;
1641 -- Data for a project tree
1643 function Debug_Name (Tree : Project_Tree_Ref) return Name_Id;
1644 -- If debug traces are activated, return an identitier for the project
1645 -- tree. This modifies Name_Buffer.
1647 procedure Expect (The_Token : Token_Type; Token_Image : String);
1648 -- Check that the current token is The_Token. If it is not, then output
1649 -- an error message.
1651 procedure Initialize (Tree : Project_Tree_Ref);
1652 -- This procedure must be called before using any services from the Prj
1653 -- hierarchy. Namet.Initialize must be called before Prj.Initialize.
1655 procedure Reset (Tree : Project_Tree_Ref);
1656 -- This procedure resets all the tables that are used when processing a
1657 -- project file tree. Initialize must be called before the call to Reset.
1659 package Project_Boolean_Htable is new Simple_HTable
1660 (Header_Num => Header_Num,
1661 Element => Boolean,
1662 No_Element => False,
1663 Key => Project_Id,
1664 Hash => Hash,
1665 Equal => "=");
1666 -- A table that associates a project to a boolean. This is used to detect
1667 -- whether a project was already processed for instance.
1669 generic
1670 with procedure Action (Project : Project_Id; Tree : Project_Tree_Ref);
1671 procedure For_Project_And_Aggregated
1672 (Root_Project : Project_Id;
1673 Root_Tree : Project_Tree_Ref);
1674 -- Execute Action for Root_Project and all its aggregated projects
1675 -- recursively.
1677 generic
1678 type State is limited private;
1679 with procedure Action
1680 (Project : Project_Id;
1681 Tree : Project_Tree_Ref;
1682 With_State : in out State);
1683 procedure For_Every_Project_Imported
1684 (By : Project_Id;
1685 Tree : Project_Tree_Ref;
1686 With_State : in out State;
1687 Include_Aggregated : Boolean := True;
1688 Imported_First : Boolean := False);
1689 -- Call Action for each project imported directly or indirectly by project
1690 -- By, as well as extended projects.
1692 -- The order of processing depends on Imported_First:
1694 -- If False, Action is called according to the order of importation: if A
1695 -- imports B, directly or indirectly, Action will be called for A before
1696 -- it is called for B. If two projects import each other directly or
1697 -- indirectly (using at least one "limited with"), it is not specified
1698 -- for which of these two projects Action will be called first.
1700 -- The order is reversed if Imported_First is True
1702 -- With_State may be used by Action to choose a behavior or to report some
1703 -- global result.
1705 -- If Include_Aggregated is True, then an aggregate project will recurse
1706 -- into the projects it aggregates. Otherwise, the latter are never
1707 -- returned.
1709 -- In_Aggregate_Lib is True if the project is in an aggregate library
1711 -- The Tree argument passed to the callback is required in the case of
1712 -- aggregated projects, since they might not be using the same tree as 'By'
1714 type Project_Context is record
1715 In_Aggregate_Lib : Boolean;
1716 -- True if the project is part of an aggregate library
1718 From_Encapsulated_Lib : Boolean;
1719 -- True if the project is imported from an encapsulated library
1720 end record;
1722 generic
1723 type State is limited private;
1724 with procedure Action
1725 (Project : Project_Id;
1726 Tree : Project_Tree_Ref;
1727 Context : Project_Context;
1728 With_State : in out State);
1729 procedure For_Every_Project_Imported_Context
1730 (By : Project_Id;
1731 Tree : Project_Tree_Ref;
1732 With_State : in out State;
1733 Include_Aggregated : Boolean := True;
1734 Imported_First : Boolean := False);
1735 -- As for For_Every_Project_Imported but with an associated context
1737 generic
1738 with procedure Action
1739 (Project : Project_Id;
1740 Tree : Project_Tree_Ref;
1741 Context : Project_Context);
1742 procedure For_Project_And_Aggregated_Context
1743 (Root_Project : Project_Id;
1744 Root_Tree : Project_Tree_Ref);
1745 -- As for For_Project_And_Aggregated but with an associated context
1747 function Extend_Name
1748 (File : File_Name_Type;
1749 With_Suffix : String) return File_Name_Type;
1750 -- Replace the extension of File with With_Suffix
1752 function Object_Name
1753 (Source_File_Name : File_Name_Type;
1754 Object_File_Suffix : Name_Id := No_Name) return File_Name_Type;
1755 -- Returns the object file name corresponding to a source file name
1757 function Object_Name
1758 (Source_File_Name : File_Name_Type;
1759 Source_Index : Int;
1760 Index_Separator : Character;
1761 Object_File_Suffix : Name_Id := No_Name) return File_Name_Type;
1762 -- Returns the object file name corresponding to a unit in a multi-source
1763 -- file.
1765 function Dependency_Name
1766 (Source_File_Name : File_Name_Type;
1767 Dependency : Dependency_File_Kind) return File_Name_Type;
1768 -- Returns the dependency file name corresponding to a source file name
1770 function Switches_Name
1771 (Source_File_Name : File_Name_Type) return File_Name_Type;
1772 -- Returns the switches file name corresponding to a source file name
1774 procedure Set_Path_File_Var (Name : String; Value : String);
1775 -- Call Setenv, after calling To_Host_File_Spec
1777 function Current_Source_Path_File_Of
1778 (Shared : Shared_Project_Tree_Data_Access) return Path_Name_Type;
1779 -- Get the current include path file name
1781 procedure Set_Current_Source_Path_File_Of
1782 (Shared : Shared_Project_Tree_Data_Access;
1783 To : Path_Name_Type);
1784 -- Record the current include path file name
1786 function Current_Object_Path_File_Of
1787 (Shared : Shared_Project_Tree_Data_Access) return Path_Name_Type;
1788 -- Get the current object path file name
1790 procedure Set_Current_Object_Path_File_Of
1791 (Shared : Shared_Project_Tree_Data_Access;
1792 To : Path_Name_Type);
1793 -- Record the current object path file name
1795 -----------
1796 -- Flags --
1797 -----------
1799 type Processing_Flags is private;
1800 -- Flags used while parsing and processing a project tree to configure the
1801 -- behavior of the parser, and indicate how to report error messages. This
1802 -- structure does not allocate memory and never needs to be freed
1804 type Error_Warning is (Silent, Warning, Error);
1805 -- Severity of some situations, such as: no Ada sources in a project where
1806 -- Ada is one of the language.
1808 -- When the situation occurs, the behaviour depends on the setting:
1810 -- - Silent: no action
1811 -- - Warning: issue a warning, does not cause the tool to fail
1812 -- - Error: issue an error, causes the tool to fail
1814 type Error_Handler is access procedure
1815 (Project : Project_Id;
1816 Is_Warning : Boolean);
1817 -- This warns when an error was found when parsing a project. The error
1818 -- itself is handled through Prj.Err (and Prj.Err.Finalize should be called
1819 -- to actually print the error). This ensures that duplicate error messages
1820 -- are always correctly removed, that errors msgs are sorted, and that all
1821 -- tools will report the same error to the user.
1823 function Create_Flags
1824 (Report_Error : Error_Handler;
1825 When_No_Sources : Error_Warning;
1826 Require_Sources_Other_Lang : Boolean := True;
1827 Allow_Duplicate_Basenames : Boolean := True;
1828 Compiler_Driver_Mandatory : Boolean := False;
1829 Error_On_Unknown_Language : Boolean := True;
1830 Require_Obj_Dirs : Error_Warning := Error;
1831 Allow_Invalid_External : Error_Warning := Error;
1832 Missing_Source_Files : Error_Warning := Error;
1833 Ignore_Missing_With : Boolean := False)
1834 return Processing_Flags;
1835 -- Function used to create Processing_Flags structure
1837 -- If Allow_Duplicate_Basenames, then files with the same base names are
1838 -- authorized within a project for source-based languages (never for unit
1839 -- based languages).
1841 -- If Compiler_Driver_Mandatory is true, then a Compiler.Driver attribute
1842 -- for each language must be defined, or we will not look for its source
1843 -- files.
1845 -- When_No_Sources indicates what should be done when no sources of a
1846 -- language are found in a project where this language is declared.
1847 -- If Require_Sources_Other_Lang is true, then all languages must have at
1848 -- least one source file, or an error is reported via When_No_Sources. If
1849 -- it is false, this is only required for Ada (and only if it is a language
1850 -- of the project). When this parameter is set to False, we do not check
1851 -- that a proper naming scheme is defined for languages other than Ada.
1853 -- If Report_Error is null, use the standard error reporting mechanism
1854 -- (Errout). Otherwise, report errors using Report_Error.
1856 -- If Error_On_Unknown_Language is true, an error is displayed if some of
1857 -- the source files listed in the project do not match any naming scheme
1859 -- If Require_Obj_Dirs is true, then all object directories must exist
1860 -- (possibly after they have been created automatically if the appropriate
1861 -- switches were specified), or an error is raised.
1863 -- If Allow_Invalid_External is Silent, then no error is reported when an
1864 -- invalid value is used for an external variable (and it doesn't match its
1865 -- type). Instead, the first possible value is used.
1867 -- Missing_Source_Files indicates whether it is an error or a warning that
1868 -- a source file mentioned in the Source_Files attributes is not actually
1869 -- found in the source directories. This also impacts errors for missing
1870 -- source directories.
1872 -- If Ignore_Missing_With is True, then a "with" statement that cannot be
1873 -- resolved will simply be ignored. However, in such a case, the flag
1874 -- Incomplete_With in the project tree will be set to True.
1875 -- This is meant for use by tools so that they can properly set the
1876 -- project path in such a case:
1877 -- * no "gnatls" found (so no default project path)
1878 -- * user project sets Project.IDE'gnatls attribute to a cross gnatls
1879 -- * user project also includes a "with" that can only be resolved
1880 -- once we have found the gnatls
1882 Gprbuild_Flags : constant Processing_Flags;
1883 Gprinstall_Flags : constant Processing_Flags;
1884 Gprclean_Flags : constant Processing_Flags;
1885 Gprexec_Flags : constant Processing_Flags;
1886 Gnatmake_Flags : constant Processing_Flags;
1887 -- Flags used by the various tools. They all display the error messages
1888 -- through Prj.Err.
1890 ----------------
1891 -- Temp Files --
1892 ----------------
1894 procedure Record_Temp_File
1895 (Shared : Shared_Project_Tree_Data_Access;
1896 Path : Path_Name_Type);
1897 -- Record the path of a newly created temporary file, so that it can be
1898 -- deleted later.
1900 procedure Delete_All_Temp_Files
1901 (Shared : Shared_Project_Tree_Data_Access);
1902 -- Delete all recorded temporary files.
1903 -- Does nothing if Debug.Debug_Flag_N is set
1905 procedure Delete_Temp_Config_Files (Project_Tree : Project_Tree_Ref);
1906 -- Delete all temporary config files. Does nothing if Debug.Debug_Flag_N is
1907 -- set or if Project_Tree is null. This initially came from gnatmake
1908 -- ??? Should this be combined with Delete_All_Temp_Files above
1910 procedure Delete_Temporary_File
1911 (Shared : Shared_Project_Tree_Data_Access := null;
1912 Path : Path_Name_Type);
1913 -- Delete a temporary file from the disk. The file is also removed from the
1914 -- list of temporary files to delete at the end of the program, in case
1915 -- another program running on the same machine has recreated it. Does
1916 -- nothing if Debug.Debug_Flag_N is set
1918 Virtual_Prefix : constant String := "v$";
1919 -- The prefix for virtual extending projects. Because of the '$', which is
1920 -- normally forbidden for project names, there cannot be any name clash.
1922 -----------
1923 -- Debug --
1924 -----------
1926 type Verbosity is (Default, Medium, High);
1927 pragma Ordered (Verbosity);
1928 -- Verbosity when parsing GNAT Project Files
1929 -- Default is default (very quiet, if no errors).
1930 -- Medium is more verbose.
1931 -- High is extremely verbose.
1933 Current_Verbosity : Verbosity := Default;
1934 -- The current value of the verbosity the project files are parsed with
1936 procedure Debug_Indent;
1937 -- Inserts a series of blanks depending on the current indentation level
1939 procedure Debug_Output (Str : String);
1940 procedure Debug_Output (Str : String; Str2 : Name_Id);
1941 -- If Current_Verbosity is not Default, outputs Str.
1942 -- This indents Str based on the current indentation level for traces
1943 -- Debug_Error is intended to be used to report an error in the traces.
1945 procedure Debug_Increase_Indent
1946 (Str : String := ""; Str2 : Name_Id := No_Name);
1947 procedure Debug_Decrease_Indent (Str : String := "");
1948 -- Increase or decrease the indentation level for debug traces. This
1949 -- indentation level only affects output done through Debug_Output.
1951 private
1952 All_Packages : constant String_List_Access := null;
1954 No_Project_Tree : constant Project_Tree_Ref := null;
1956 Ignored : constant Variable_Kind := Single;
1958 Nil_Variable_Value : constant Variable_Value :=
1959 (Project => No_Project,
1960 Kind => Undefined,
1961 Location => No_Location,
1962 Default => False);
1964 type Source_Iterator is record
1965 In_Tree : Project_Tree_Ref;
1967 Project : Project_List;
1968 All_Projects : Boolean;
1969 -- Current project and whether we should move on to the next
1971 Language : Language_Ptr;
1972 -- Current language processed
1974 Language_Name : Name_Id;
1975 -- Only sources of this language will be returned (or all if No_Name)
1977 Current : Source_Id;
1979 Encapsulated_Libs : Boolean;
1980 -- True if we want to include the sources from encapsulated libs
1982 Locally_Removed : Boolean;
1983 end record;
1985 procedure Add_To_Buffer
1986 (S : String;
1987 To : in out String_Access;
1988 Last : in out Natural);
1989 -- Append a String to the Buffer
1991 -- Table used to store the path name of all the created temporary files, so
1992 -- that they can be deleted at the end, or when the program is interrupted.
1994 package Temp_Files_Table is new GNAT.Dynamic_Tables
1995 (Table_Component_Type => Path_Name_Type,
1996 Table_Index_Type => Integer,
1997 Table_Low_Bound => 1,
1998 Table_Initial => 10,
1999 Table_Increment => 10);
2001 -- The following type is used to represent the part of a project tree which
2002 -- is private to the Project Manager.
2004 type Private_Project_Tree_Data is record
2005 Temp_Files : Temp_Files_Table.Instance;
2006 -- Temporary files created as part of running tools (pragma files,
2007 -- mapping files,...)
2009 Current_Source_Path_File : Path_Name_Type := No_Path;
2010 -- Current value of project source path file env var. Used to avoid
2011 -- setting the env var to the same value. When different from No_Path,
2012 -- this indicates that environment variables were created and should be
2013 -- deassigned to avoid polluting the environment. For gnatmake only.
2015 Current_Object_Path_File : Path_Name_Type := No_Path;
2016 -- Current value of project object path file env var. Used to avoid
2017 -- setting the env var to the same value.
2018 -- gnatmake only
2019 end record;
2021 -- The following type is used to hold processing flags which show what
2022 -- functions are required for the various tools that are handled.
2024 type Processing_Flags is record
2025 Require_Sources_Other_Lang : Boolean;
2026 Report_Error : Error_Handler;
2027 When_No_Sources : Error_Warning;
2028 Allow_Duplicate_Basenames : Boolean;
2029 Compiler_Driver_Mandatory : Boolean;
2030 Error_On_Unknown_Language : Boolean;
2031 Require_Obj_Dirs : Error_Warning;
2032 Allow_Invalid_External : Error_Warning;
2033 Missing_Source_Files : Error_Warning;
2034 Ignore_Missing_With : Boolean;
2035 end record;
2037 Gprbuild_Flags : constant Processing_Flags :=
2038 (Report_Error => null,
2039 When_No_Sources => Warning,
2040 Require_Sources_Other_Lang => True,
2041 Allow_Duplicate_Basenames => False,
2042 Compiler_Driver_Mandatory => True,
2043 Error_On_Unknown_Language => True,
2044 Require_Obj_Dirs => Error,
2045 Allow_Invalid_External => Error,
2046 Missing_Source_Files => Error,
2047 Ignore_Missing_With => False);
2049 Gprinstall_Flags : constant Processing_Flags :=
2050 (Report_Error => null,
2051 When_No_Sources => Warning,
2052 Require_Sources_Other_Lang => True,
2053 Allow_Duplicate_Basenames => False,
2054 Compiler_Driver_Mandatory => True,
2055 Error_On_Unknown_Language => True,
2056 Require_Obj_Dirs => Silent,
2057 Allow_Invalid_External => Error,
2058 Missing_Source_Files => Error,
2059 Ignore_Missing_With => False);
2061 Gprclean_Flags : constant Processing_Flags :=
2062 (Report_Error => null,
2063 When_No_Sources => Warning,
2064 Require_Sources_Other_Lang => True,
2065 Allow_Duplicate_Basenames => False,
2066 Compiler_Driver_Mandatory => True,
2067 Error_On_Unknown_Language => True,
2068 Require_Obj_Dirs => Warning,
2069 Allow_Invalid_External => Error,
2070 Missing_Source_Files => Error,
2071 Ignore_Missing_With => False);
2073 Gprexec_Flags : constant Processing_Flags :=
2074 (Report_Error => null,
2075 When_No_Sources => Silent,
2076 Require_Sources_Other_Lang => False,
2077 Allow_Duplicate_Basenames => False,
2078 Compiler_Driver_Mandatory => False,
2079 Error_On_Unknown_Language => True,
2080 Require_Obj_Dirs => Silent,
2081 Allow_Invalid_External => Error,
2082 Missing_Source_Files => Silent,
2083 Ignore_Missing_With => False);
2085 Gnatmake_Flags : constant Processing_Flags :=
2086 (Report_Error => null,
2087 When_No_Sources => Error,
2088 Require_Sources_Other_Lang => False,
2089 Allow_Duplicate_Basenames => False,
2090 Compiler_Driver_Mandatory => False,
2091 Error_On_Unknown_Language => False,
2092 Require_Obj_Dirs => Error,
2093 Allow_Invalid_External => Error,
2094 Missing_Source_Files => Error,
2095 Ignore_Missing_With => False);
2097 end Prj;