PR tree-optimization/60902
[official-gcc.git] / gcc / ada / prj.ads
blob519e874016171684b6dbf56a2fa75d46b524ab08
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 ------------------------------------------------------------------------------
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,
445 -- Unix style
446 Host);
447 -- Host specific syntax, for example on VMS (the default)
449 -- The following record describes the configuration of a language
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.
456 Naming_Data : Lang_Naming_Data;
457 -- The naming data for the languages (prefixes, etc.)
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.
465 Compiler_Driver : File_Name_Type := No_File;
466 -- The name of the executable for the compiler of the language
468 Compiler_Driver_Path : String_Access := null;
469 -- The path name of the executable for the compiler of the language
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.
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.
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
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.
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).
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", "");
495 Object_File_Suffix : Name_Id := No_Name;
496 -- Optional alternate object file suffix
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", "").
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.
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.
513 Object_Generated : Boolean := True;
514 -- False if no object file is generated
516 Objects_Linked : Boolean := True;
517 -- False if object files are not use to link executables and build
518 -- libraries.
520 Runtime_Library_Dir : Name_Id := No_Name;
521 -- Path name of the runtime library directory, if any
523 Runtime_Source_Dir : Name_Id := No_Name;
524 -- Path name of the runtime source directory, if any
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.
531 Mapping_Spec_Suffix : File_Name_Type := No_File;
532 -- Placeholder representing the spec suffix in a mapping file
534 Mapping_Body_Suffix : File_Name_Type := No_File;
535 -- Placeholder representing the body suffix in a mapping file
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.
541 Dependency_Kind : Dependency_File_Kind := None;
542 -- The kind of dependency to be checked: none, Makefile fragment or
543 -- ALI file (for Ada).
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).
549 Compute_Dependency : Name_List_Index := No_Name_List;
550 -- Hold the value of attribute Dependency_Driver, if declared for the
551 -- language.
553 Include_Option : Name_List_Index := No_Name_List;
554 -- Hold the value of attribute Include_Switches, if declared for the
555 -- language.
557 Include_Path : Name_Id := No_Name;
558 -- Name of environment variable declared by attribute Include_Path for
559 -- the language.
561 Include_Path_File : Name_Id := No_Name;
562 -- Name of environment variable declared by attribute Include_Path_File
563 -- for the language.
565 Objects_Path : Name_Id := No_Name;
566 -- Name of environment variable declared by attribute Objects_Path for
567 -- the language.
569 Objects_Path_File : Name_Id := No_Name;
570 -- Name of environment variable declared by attribute Objects_Path_File
571 -- for the language.
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.
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.
581 Config_Body_Pattern : Name_Id := No_Name;
582 -- The template for a pragma Source_File_Name(_Project) for a naming
583 -- body pattern.
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.
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.
593 Config_Spec_Pattern : Name_Id := No_Name;
594 -- The template for a pragma Source_File_Name(_Project) for a naming
595 -- spec pattern.
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.
602 Binder_Driver : File_Name_Type := No_File;
603 -- The name of the binder driver for the language, if any
605 Binder_Driver_Path : Path_Name_Type := No_Path;
606 -- The path name of the binder driver
608 Binder_Required_Switches : Name_List_Index := No_Name_List;
609 -- Hold the value of attribute Binder'Required_Switches for the language
611 Binder_Prefix : Name_Id := No_Name;
612 -- Hold the value of attribute Binder'Prefix for the language
614 Toolchain_Version : Name_Id := No_Name;
615 -- Hold the value of attribute Toolchain_Version for the language
617 Toolchain_Description : Name_Id := No_Name;
618 -- Hold the value of attribute Toolchain_Description for the language
620 Clean_Object_Artifacts : Name_List_Index := No_Name_List;
621 -- List of object artifact extensions to be deleted by gprclean
623 Clean_Source_Artifacts : Name_List_Index := No_Name_List;
624 -- List of source artifact extensions to be deleted by gprclean
626 end record;
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);
678 type Language_Data is record
679 Name : Name_Id := No_Name;
680 -- The name of the language in lower case
682 Display_Name : Name_Id := No_Name;
683 -- The name of the language, as found in attribute Languages
685 Config : Language_Config := No_Language_Config;
686 -- Configuration of the language
688 First_Source : Source_Id := No_Source;
689 -- Head of the list of sources of the language in the project
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
695 Next : Language_Ptr := No_Language_Index;
696 -- Next language of the project
698 end record;
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);
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;
715 type Source_Kind is (Spec, Impl, Sep);
716 subtype Spec_Or_Body is Source_Kind range Spec .. Impl;
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".
723 type File_Names_Data is array (Spec_Or_Body) of Source_Id;
725 type Unit_Data is record
726 Name : Name_Id := No_Name;
727 File_Names : File_Names_Data;
728 end record;
730 type Unit_Index is access all Unit_Data;
732 No_Unit_Index : constant Unit_Index := null;
733 -- Used to indicate a null entry for no unit
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.
746 type Naming_Exception_Type is (No, Yes, Inherited);
748 -- Structure to define source data
750 type Source_Data is record
751 Initialized : Boolean := False;
752 -- Set to True when Source_Data is completely initialized
754 Project : Project_Id := No_Project;
755 -- Project of the source
757 Location : Source_Ptr := No_Location;
758 -- Location in the project file of the declaration of the source in
759 -- package Naming.
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.
767 Language : Language_Ptr := No_Language_Index;
768 -- Language of the source
770 In_Interfaces : Boolean := True;
771 -- False when the source is not included in interfaces, when attribute
772 -- Interfaces is declared.
774 Declared_In_Interfaces : Boolean := False;
775 -- True when source is declared in attribute Interfaces
777 Alternate_Languages : Language_List := null;
778 -- List of languages a header file may also be, in addition of language
779 -- Language_Name.
781 Kind : Source_Kind := Spec;
782 -- Kind of the source: spec, body or subunit
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).
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
796 Compilable : Yes_No_Unknown := Unknown;
797 -- Updated at the first call to Is_Compilable. Yes if source file is
798 -- compilable.
800 In_The_Queue : Boolean := False;
801 -- True if the source has been put in the queue
803 Locally_Removed : Boolean := False;
804 -- True if the source has been "excluded"
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.
810 Replaced_By : Source_Id := No_Source;
811 -- Source in an extending project that replaces the current source
813 File : File_Name_Type := No_File;
814 -- Canonical file name of the source
816 Display_File : File_Name_Type := No_File;
817 -- File name of the source, for display purposes
819 Path : Path_Information := No_Path_Information;
820 -- Path name of the source
822 Source_TS : Time_Stamp_Type := Empty_Time_Stamp;
823 -- Time stamp of the source file
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.
829 Object : File_Name_Type := No_File;
830 -- File name of the object file
832 Current_Object_Path : Path_Name_Type := No_Path;
833 -- Object path of an existing object file
835 Object_Path : Path_Name_Type := No_Path;
836 -- Object path of the real object file
838 Object_TS : Time_Stamp_Type := Empty_Time_Stamp;
839 -- Object file time stamp
841 Dep_Name : File_Name_Type := No_File;
842 -- Dependency file simple name
844 Current_Dep_Path : Path_Name_Type := No_Path;
845 -- Path name of an existing dependency file
847 Dep_Path : Path_Name_Type := No_Path;
848 -- Path name of the real dependency file
850 Dep_TS : aliased Osint.File_Attributes := Osint.Unknown_Attributes;
851 -- Dependency file time stamp
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.
857 Switches_Path : Path_Name_Type := No_Path;
858 -- Path name of the switches file
860 Switches_TS : Time_Stamp_Type := Empty_Time_Stamp;
861 -- Switches file time stamp
863 Naming_Exception : Naming_Exception_Type := No;
864 -- True if the source has an exceptional name
866 Duplicate_Unit : Boolean := False;
867 -- True when a duplicate unit has been reported for this source
869 Next_In_Lang : Source_Id := No_Source;
870 -- Link to another source of the same language in the same project
872 Next_With_File_Name : Source_Id := No_Source;
873 -- Link to another source with the same base file name
875 Roots : Roots_Access := null;
876 -- The roots for a main unit
878 end record;
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);
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
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
937 type Lib_Kind is (Static, Dynamic, Relocatable);
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
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
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
961 function Image (The_Casing : Casing_Type) return String;
962 -- Similar to 'Image (but avoid use of this attribute in compiler)
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.
968 -- The following record contains data for a naming scheme
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. If the project is a
977 -- library project file and Including_Libraries is True then the library
978 -- ALI dir is returned instead of the object dir, except when there is no
979 -- ALI files in the Library ALI dir and the object directory exists. If
980 -- Only_If_Ada is True, then No_Name is returned when the project doesn't
981 -- include any Ada source.
983 procedure Compute_All_Imported_Projects
984 (Root_Project : Project_Id;
985 Tree : Project_Tree_Ref);
986 -- For all projects in the tree, compute the list of the projects imported
987 -- directly or indirectly by project Root_Project. The result is stored in
988 -- Project.All_Imported_Projects for each project
990 function Ultimate_Extending_Project_Of
991 (Proj : Project_Id) return Project_Id;
992 -- Returns the ultimate extending project of project Proj. If project Proj
993 -- is not extended, returns Proj.
995 type Project_List_Element;
996 type Project_List is access all Project_List_Element;
997 type Project_List_Element is record
998 Project : Project_Id := No_Project;
999 From_Encapsulated_Lib : Boolean := False;
1000 Next : Project_List := null;
1001 end record;
1002 -- A list of projects
1004 procedure Free_List
1005 (List : in out Project_List;
1006 Free_Project : Boolean);
1007 -- Free the list of projects, if Free_Project, each project is also freed
1009 type Response_File_Format is
1010 (None,
1011 GNU,
1012 Object_List,
1013 Option_List,
1014 GCC,
1015 GCC_GNU,
1016 GCC_Object_List,
1017 GCC_Option_List);
1018 -- The format of the different response files
1020 type Project_Configuration is record
1021 Target : Name_Id := No_Name;
1022 -- The target of the configuration, when specified
1024 Run_Path_Option : Name_List_Index := No_Name_List;
1025 -- The option to use when linking to specify the path where to look for
1026 -- libraries.
1028 Run_Path_Origin : Name_Id := No_Name;
1029 -- Specify the string (such as "$ORIGIN") to indicate paths relative to
1030 -- the directory of the executable in the run path option.
1032 Library_Install_Name_Option : Name_Id := No_Name;
1033 -- When this is not an empty list, this option, followed by the single
1034 -- name of the shared library file is used when linking a shared
1035 -- library.
1037 Separate_Run_Path_Options : Boolean := False;
1038 -- True if each directory needs to be specified in a separate run path
1039 -- option.
1041 Executable_Suffix : Name_Id := No_Name;
1042 -- The suffix of executables, when specified in the configuration or in
1043 -- package Builder of the main project. When this is not specified, the
1044 -- executable suffix is the default for the platform.
1046 -- Linking
1048 Linker : Path_Name_Type := No_Path;
1049 -- Path name of the linker driver. Specified in the configuration or in
1050 -- the package Builder of the main project.
1052 Map_File_Option : Name_Id := No_Name;
1053 -- Option to use when invoking the linker to build a map file
1055 Trailing_Linker_Required_Switches : Name_List_Index := No_Name_List;
1056 -- The minimum options for the linker driver. Specified in the
1057 -- configuration.
1059 Linker_Executable_Option : Name_List_Index := No_Name_List;
1060 -- The option(s) to indicate the name of the executable in the linker
1061 -- command. Specified in the configuration. When not specified, default
1062 -- to -o <executable name>.
1064 Linker_Lib_Dir_Option : Name_Id := No_Name;
1065 -- The option to specify where to find a library for linking. Specified
1066 -- in the configuration. When not specified, defaults to "-L".
1068 Linker_Lib_Name_Option : Name_Id := No_Name;
1069 -- The option to specify the name of a library for linking. Specified in
1070 -- the configuration. When not specified, defaults to "-l".
1072 Max_Command_Line_Length : Natural := 0;
1073 -- When positive and when Resp_File_Format (see below) is not None,
1074 -- if the command line for the invocation of the linker would be greater
1075 -- than this value, a response file is used to invoke the linker.
1077 Resp_File_Format : Response_File_Format := None;
1078 -- The format of a response file, when linking with a response file is
1079 -- supported.
1081 Resp_File_Options : Name_List_Index := No_Name_List;
1082 -- The switches, if any, that precede the path name of the response
1083 -- file in the invocation of the linker.
1085 -- Libraries
1087 Library_Builder : Path_Name_Type := No_Path;
1088 -- The executable to build library (specified in the configuration)
1090 Lib_Support : Library_Support := None;
1091 -- The level of library support. Specified in the configuration. Support
1092 -- is none, static libraries only or both static and shared libraries.
1094 Lib_Encapsulated_Supported : Boolean := False;
1095 -- True when building fully standalone libraries supported on the target
1097 Archive_Builder : Name_List_Index := No_Name_List;
1098 -- The name of the executable to build archives, with the minimum
1099 -- switches. Specified in the configuration.
1101 Archive_Builder_Append_Option : Name_List_Index := No_Name_List;
1102 -- The options to append object files to an archive
1104 Archive_Indexer : Name_List_Index := No_Name_List;
1105 -- The name of the executable to index archives, with the minimum
1106 -- switches. Specified in the configuration.
1108 Archive_Suffix : File_Name_Type := No_File;
1109 -- The suffix of archives. Specified in the configuration. When not
1110 -- specified, defaults to ".a".
1112 Lib_Partial_Linker : Name_List_Index := No_Name_List;
1114 -- Shared libraries
1116 Shared_Lib_Driver : File_Name_Type := No_File;
1117 -- The driver to link shared libraries. Set with attribute Library_GCC.
1118 -- Default to gcc.
1120 Shared_Lib_Prefix : File_Name_Type := No_File;
1121 -- Part of a shared library file name that precedes the name of the
1122 -- library. Specified in the configuration. When not specified, defaults
1123 -- to "lib".
1125 Shared_Lib_Suffix : File_Name_Type := No_File;
1126 -- Suffix of shared libraries, after the library name in the shared
1127 -- library name. Specified in the configuration. When not specified,
1128 -- default to ".so".
1130 Shared_Lib_Min_Options : Name_List_Index := No_Name_List;
1131 -- The minimum options to use when building a shared library
1133 Lib_Version_Options : Name_List_Index := No_Name_List;
1134 -- The options to use to specify a library version
1136 Symbolic_Link_Supported : Boolean := False;
1137 -- True if the platform supports symbolic link files
1139 Lib_Maj_Min_Id_Supported : Boolean := False;
1140 -- True if platform supports library major and minor options, such as
1141 -- libname.so -> libname.so.2 -> libname.so.2.4
1143 Auto_Init_Supported : Boolean := False;
1144 -- True if automatic initialisation is supported for shared stand-alone
1145 -- libraries.
1147 -- Cleaning
1149 Artifacts_In_Exec_Dir : Name_List_Index := No_Name_List;
1150 -- List of regexp file names to be cleaned in the exec directory of the
1151 -- main project.
1153 Artifacts_In_Object_Dir : Name_List_Index := No_Name_List;
1154 -- List of regexp file names to be cleaned in the object directory of
1155 -- all projects.
1157 end record;
1159 Default_Project_Config : constant Project_Configuration :=
1160 (Target => No_Name,
1161 Run_Path_Option => No_Name_List,
1162 Run_Path_Origin => No_Name,
1163 Library_Install_Name_Option => No_Name,
1164 Separate_Run_Path_Options => False,
1165 Executable_Suffix => No_Name,
1166 Linker => No_Path,
1167 Map_File_Option => No_Name,
1168 Trailing_Linker_Required_Switches =>
1169 No_Name_List,
1170 Linker_Executable_Option => No_Name_List,
1171 Linker_Lib_Dir_Option => No_Name,
1172 Linker_Lib_Name_Option => No_Name,
1173 Library_Builder => No_Path,
1174 Max_Command_Line_Length => 0,
1175 Resp_File_Format => None,
1176 Resp_File_Options => No_Name_List,
1177 Lib_Support => None,
1178 Lib_Encapsulated_Supported => False,
1179 Archive_Builder => No_Name_List,
1180 Archive_Builder_Append_Option => No_Name_List,
1181 Archive_Indexer => No_Name_List,
1182 Archive_Suffix => No_File,
1183 Lib_Partial_Linker => No_Name_List,
1184 Shared_Lib_Driver => No_File,
1185 Shared_Lib_Prefix => No_File,
1186 Shared_Lib_Suffix => No_File,
1187 Shared_Lib_Min_Options => No_Name_List,
1188 Lib_Version_Options => No_Name_List,
1189 Symbolic_Link_Supported => False,
1190 Lib_Maj_Min_Id_Supported => False,
1191 Auto_Init_Supported => False,
1192 Artifacts_In_Exec_Dir => No_Name_List,
1193 Artifacts_In_Object_Dir => No_Name_List);
1195 -------------------------
1196 -- Aggregated projects --
1197 -------------------------
1199 type Aggregated_Project;
1200 type Aggregated_Project_List is access all Aggregated_Project;
1201 type Aggregated_Project is record
1202 Path : Path_Name_Type;
1203 Tree : Project_Tree_Ref;
1204 Project : Project_Id;
1205 Next : Aggregated_Project_List;
1206 end record;
1208 procedure Free (List : in out Aggregated_Project_List);
1209 -- Free the memory used for List
1211 procedure Add_Aggregated_Project
1212 (Project : Project_Id;
1213 Path : Path_Name_Type);
1214 -- Add a new aggregated project in Project.
1215 -- The aggregated project has not been processed yet. This procedure should
1216 -- the called while processing the aggregate project, and as a result
1217 -- Prj.Proc.Process will then automatically process the aggregated projects
1219 ------------------
1220 -- Project_Data --
1221 ------------------
1223 -- The following record describes a project file representation
1225 pragma Warnings (Off);
1226 type Standalone is
1227 (No,
1229 -- The following clash with Standard is OK, and justified by the context
1230 -- which really wants to use the same set of qualifiers.
1232 Standard,
1234 Encapsulated);
1235 pragma Warnings (On);
1237 type Project_Data (Qualifier : Project_Qualifier := Unspecified) is record
1239 -------------
1240 -- General --
1241 -------------
1243 Name : Name_Id := No_Name;
1244 -- The name of the project
1246 Display_Name : Name_Id := No_Name;
1247 -- The name of the project with the spelling of its declaration
1249 Externally_Built : Boolean := False;
1250 -- True if the project is externally built. In such case, the Project
1251 -- Manager will not modify anything in this project.
1253 Config : Project_Configuration;
1255 Path : Path_Information := No_Path_Information;
1256 -- The path name of the project file. This include base name of the
1257 -- project file.
1259 Virtual : Boolean := False;
1260 -- True for virtual extending projects
1262 Location : Source_Ptr := No_Location;
1263 -- The location in the project file source of the project name that
1264 -- immediately follows the reserved word "project".
1266 ---------------
1267 -- Languages --
1268 ---------------
1270 Languages : Language_Ptr := No_Language_Index;
1271 -- First index of the language data in the project. Traversing the list
1272 -- gives access to all the languages supported by the project.
1274 --------------
1275 -- Projects --
1276 --------------
1278 Mains : String_List_Id := Nil_String;
1279 -- List of mains specified by attribute Main
1281 Extends : Project_Id := No_Project;
1282 -- The reference of the project file, if any, that this project file
1283 -- extends.
1285 Extended_By : Project_Id := No_Project;
1286 -- The reference of the project file, if any, that extends this project
1287 -- file.
1289 Decl : Declarations := No_Declarations;
1290 -- The declarations (variables, attributes and packages) of this project
1291 -- file.
1293 Imported_Projects : Project_List := null;
1294 -- The list of all directly imported projects, if any
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.
1300 -----------------
1301 -- Directories --
1302 -----------------
1304 Directory : Path_Information := No_Path_Information;
1305 -- Path name of the directory where the project file resides
1307 Object_Directory : Path_Information := No_Path_Information;
1308 -- The path name of the object directory of this project file
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.
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.
1318 -------------
1319 -- Library --
1320 -------------
1322 Library : Boolean := False;
1323 -- True if this is a library project
1325 Library_Name : Name_Id := No_Name;
1326 -- If a library project, name of the library
1328 Library_Kind : Lib_Kind := Static;
1329 -- If a library project, kind of library
1331 Library_Dir : Path_Information := No_Path_Information;
1332 -- If a library project, path name of the directory where the library
1333 -- resides.
1335 Library_TS : Time_Stamp_Type := Empty_Time_Stamp;
1336 -- The timestamp of a library file in a library project
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.
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.
1349 Lib_Internal_Name : Name_Id := No_Name;
1350 -- If a library project, internal name store inside the library
1352 Standalone_Library : Standalone := No;
1353 -- Indicate that this is a Standalone Library Project File
1355 Lib_Interface_ALIs : String_List_Id := Nil_String;
1356 -- For Standalone Library Project Files, list of Interface ALI files
1358 Other_Interfaces : String_List_Id := Nil_String;
1359 -- List of non unit based sources in attribute Interfaces
1361 Lib_Auto_Init : Boolean := False;
1362 -- For non static Stand-Alone Library Project Files, True if the library
1363 -- initialisation should be automatic.
1365 Symbol_Data : Symbol_Record := No_Symbols;
1366 -- Symbol file name, reference symbol file name, symbol policy
1368 Need_To_Build_Lib : Boolean := False;
1369 -- True if the library of a Library Project needs to be built or rebuilt
1371 -------------
1372 -- Sources --
1373 -------------
1374 -- The sources for all languages including Ada are accessible through
1375 -- the Source_Iterator type
1377 Interfaces_Defined : Boolean := False;
1378 -- True if attribute Interfaces is declared for the project or any
1379 -- project it extends.
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
1385 Source_Dirs : String_List_Id := Nil_String;
1386 -- The list of all the source directories
1388 Source_Dir_Ranks : Number_List_Index := No_Number_List;
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.
1396 Has_Multi_Unit_Sources : Boolean := False;
1397 -- Whether there is at least one source file containing multiple units
1399 -------------------
1400 -- Miscellaneous --
1401 -------------------
1403 Ada_Objects_Path : String_Access := null;
1404 -- The cached value of ADA_OBJECTS_PATH for this project file, with
1405 -- library ALI directories for library projects instead of object
1406 -- directories. Do not use this field directly outside of the
1407 -- compiler, use Prj.Env.Ada_Objects_Path instead.
1409 Ada_Objects_Path_No_Libs : String_Access := null;
1410 -- The cached value of ADA_OBJECTS_PATH for this project file with all
1411 -- object directories (no library ALI dir for library projects).
1413 Libgnarl_Needed : Yes_No_Unknown := Unknown;
1414 -- Set to True when libgnarl is needed to link
1416 Objects_Path : String_Access := null;
1417 -- The cached value of the object dir path, used during the binding
1418 -- phase of gprbuild.
1420 Objects_Path_File_With_Libs : Path_Name_Type := No_Path;
1421 -- The cached value of the object path temp file (including library
1422 -- dirs) for this project file.
1424 Objects_Path_File_Without_Libs : Path_Name_Type := No_Path;
1425 -- The cached value of the object path temp file (excluding library
1426 -- dirs) for this project file.
1428 Config_File_Name : Path_Name_Type := No_Path;
1429 -- The path name of the configuration pragmas file, if any
1431 Config_File_Temp : Boolean := False;
1432 -- True if the configuration pragmas file is a temporary file that must
1433 -- be deleted at the end.
1435 Config_Checked : Boolean := False;
1436 -- A flag to avoid checking repetitively the configuration pragmas file
1438 Depth : Natural := 0;
1439 -- The maximum depth of a project in the project graph. Depth of main
1440 -- project is 0.
1442 Unkept_Comments : Boolean := False;
1443 -- True if there are comments in the project sources that cannot be kept
1444 -- in the project tree.
1446 -----------------------------
1447 -- Qualifier-Specific data --
1448 -----------------------------
1450 -- The following fields are only valid for specific types of projects
1452 case Qualifier is
1453 when Aggregate | Aggregate_Library =>
1454 Aggregated_Projects : Aggregated_Project_List := null;
1455 -- List of aggregated projects (which could themselves be
1456 -- aggregate projects).
1458 when others =>
1459 null;
1460 end case;
1461 end record;
1463 function Empty_Project (Qualifier : Project_Qualifier) return Project_Data;
1464 -- Return the representation of an empty project
1466 function Is_Extending
1467 (Extending : Project_Id;
1468 Extended : Project_Id) return Boolean;
1469 -- Return True if Extending is extending the Extended project
1471 function Is_Ext
1472 (Extending : Project_Id;
1473 Extended : Project_Id) return Boolean renames Is_Extending;
1475 function Has_Ada_Sources (Data : Project_Id) return Boolean;
1476 -- Return True if the project has Ada sources
1478 Project_Error : exception;
1479 -- Raised by some subprograms in Prj.Attr
1481 package Units_Htable is new Simple_HTable
1482 (Header_Num => Header_Num,
1483 Element => Unit_Index,
1484 No_Element => No_Unit_Index,
1485 Key => Name_Id,
1486 Hash => Hash,
1487 Equal => "=");
1488 -- Mapping of unit names to indexes in the Units table
1490 ---------------------
1491 -- Source_Iterator --
1492 ---------------------
1494 type Source_Iterator is private;
1496 function For_Each_Source
1497 (In_Tree : Project_Tree_Ref;
1498 Project : Project_Id := No_Project;
1499 Language : Name_Id := No_Name;
1500 Encapsulated_Libs : Boolean := True;
1501 Locally_Removed : Boolean := True) return Source_Iterator;
1502 -- Returns an iterator for all the sources of a project tree, or a specific
1503 -- project, or a specific language. Include sources from aggregated libs if
1504 -- Aggregated_Libs is True. If Locally_Removed is set to False the
1505 -- Locally_Removed files won't be reported.
1507 function Element (Iter : Source_Iterator) return Source_Id;
1508 -- Return the current source (or No_Source if there are no more sources)
1510 procedure Next (Iter : in out Source_Iterator);
1511 -- Move on to the next source
1513 function Find_Source
1514 (In_Tree : Project_Tree_Ref;
1515 Project : Project_Id;
1516 In_Imported_Only : Boolean := False;
1517 In_Extended_Only : Boolean := False;
1518 Base_Name : File_Name_Type;
1519 Index : Int := 0) return Source_Id;
1520 -- Find the first source file with the given name.
1521 -- If In_Extended_Only is True, it will search in project and the project
1522 -- it extends, but not in the imported projects.
1523 -- Elsif In_Imported_Only is True, it will search in project and the
1524 -- projects it imports, but not in the others or in aggregated projects.
1525 -- Else it searches in the whole tree.
1526 -- If Index is specified, this only search for a source with that index.
1528 -----------------------
1529 -- Project_Tree_Data --
1530 -----------------------
1532 package Replaced_Source_HTable is new Simple_HTable
1533 (Header_Num => Header_Num,
1534 Element => File_Name_Type,
1535 No_Element => No_File,
1536 Key => File_Name_Type,
1537 Hash => Hash,
1538 Equal => "=");
1540 type Private_Project_Tree_Data is private;
1541 -- Data for a project tree that is used only by the Project Manager
1543 type Shared_Project_Tree_Data is record
1544 Name_Lists : Name_List_Table.Instance;
1545 Number_Lists : Number_List_Table.Instance;
1546 String_Elements : String_Element_Table.Instance;
1547 Variable_Elements : Variable_Element_Table.Instance;
1548 Array_Elements : Array_Element_Table.Instance;
1549 Arrays : Array_Table.Instance;
1550 Packages : Package_Table.Instance;
1551 Private_Part : Private_Project_Tree_Data;
1552 end record;
1553 type Shared_Project_Tree_Data_Access is access all Shared_Project_Tree_Data;
1554 -- The data that is shared among multiple trees, when these trees are
1555 -- loaded through the same aggregate project.
1556 -- To avoid ambiguities, limit the number of parameters to the
1557 -- subprograms (we would have to parse the "root project tree" since this
1558 -- is where the configuration file was loaded, in addition to the project's
1559 -- own tree) and make the comparison of projects easier, all trees store
1560 -- the lists in the same tables.
1562 type Project_Tree_Appdata is tagged null record;
1563 type Project_Tree_Appdata_Access is access all Project_Tree_Appdata'Class;
1564 -- Application-specific data that can be associated with a project tree.
1565 -- We do not make the Project_Tree_Data itself tagged for several reasons:
1566 -- - it couldn't have a default value for its discriminant
1567 -- - it would require a "factory" to allocate such data, because trees
1568 -- are created automatically when parsing aggregate projects.
1570 procedure Free (Tree : in out Project_Tree_Appdata);
1571 -- Should be overridden if your derive your own data
1573 type Project_Tree_Data (Is_Root_Tree : Boolean := True) is record
1574 -- The root tree is the one loaded by the user from the command line.
1575 -- Is_Root_Tree is only false for projects aggregated within a root
1576 -- aggregate project.
1578 Projects : Project_List;
1579 -- List of projects in this tree
1581 Replaced_Sources : Replaced_Source_HTable.Instance;
1582 -- The list of sources that have been replaced by sources with
1583 -- different file names.
1585 Replaced_Source_Number : Natural := 0;
1586 -- The number of entries in Replaced_Sources
1588 Units_HT : Units_Htable.Instance;
1589 -- Unit name to Unit_Index (and from there to Source_Id)
1591 Source_Files_HT : Source_Files_Htable.Instance;
1592 -- Base source file names to Source_Id list
1594 Source_Paths_HT : Source_Paths_Htable.Instance;
1595 -- Full path to Source_Id
1596 -- ??? What is behavior for multi-unit source files, where there are
1597 -- several source_id per file ?
1599 Source_Info_File_Name : String_Access := null;
1600 -- The name of the source info file, if specified by the builder
1602 Source_Info_File_Exists : Boolean := False;
1603 -- True when a source info file has been successfully read
1605 Shared : Shared_Project_Tree_Data_Access;
1606 -- The shared data for this tree and all aggregated trees
1608 Appdata : Project_Tree_Appdata_Access;
1609 -- Application-specific data for this tree
1611 case Is_Root_Tree is
1612 when True =>
1613 Shared_Data : aliased Shared_Project_Tree_Data;
1614 -- Do not access directly, only through Shared
1616 when False =>
1617 null;
1618 end case;
1619 end record;
1620 -- Data for a project tree
1622 function Debug_Name (Tree : Project_Tree_Ref) return Name_Id;
1623 -- If debug traces are activated, return an identitier for the project
1624 -- tree. This modifies Name_Buffer.
1626 procedure Expect (The_Token : Token_Type; Token_Image : String);
1627 -- Check that the current token is The_Token. If it is not, then output
1628 -- an error message.
1630 procedure Initialize (Tree : Project_Tree_Ref);
1631 -- This procedure must be called before using any services from the Prj
1632 -- hierarchy. Namet.Initialize must be called before Prj.Initialize.
1634 procedure Reset (Tree : Project_Tree_Ref);
1635 -- This procedure resets all the tables that are used when processing a
1636 -- project file tree. Initialize must be called before the call to Reset.
1638 package Project_Boolean_Htable is new Simple_HTable
1639 (Header_Num => Header_Num,
1640 Element => Boolean,
1641 No_Element => False,
1642 Key => Project_Id,
1643 Hash => Hash,
1644 Equal => "=");
1645 -- A table that associates a project to a boolean. This is used to detect
1646 -- whether a project was already processed for instance.
1648 generic
1649 with procedure Action (Project : Project_Id; Tree : Project_Tree_Ref);
1650 procedure For_Project_And_Aggregated
1651 (Root_Project : Project_Id;
1652 Root_Tree : Project_Tree_Ref);
1653 -- Execute Action for Root_Project and all its aggregated projects
1654 -- recursively.
1656 generic
1657 type State is limited private;
1658 with procedure Action
1659 (Project : Project_Id;
1660 Tree : Project_Tree_Ref;
1661 With_State : in out State);
1662 procedure For_Every_Project_Imported
1663 (By : Project_Id;
1664 Tree : Project_Tree_Ref;
1665 With_State : in out State;
1666 Include_Aggregated : Boolean := True;
1667 Imported_First : Boolean := False);
1668 -- Call Action for each project imported directly or indirectly by project
1669 -- By, as well as extended projects.
1671 -- The order of processing depends on Imported_First:
1673 -- If False, Action is called according to the order of importation: if A
1674 -- imports B, directly or indirectly, Action will be called for A before
1675 -- it is called for B. If two projects import each other directly or
1676 -- indirectly (using at least one "limited with"), it is not specified
1677 -- for which of these two projects Action will be called first.
1679 -- The order is reversed if Imported_First is True
1681 -- With_State may be used by Action to choose a behavior or to report some
1682 -- global result.
1684 -- If Include_Aggregated is True, then an aggregate project will recurse
1685 -- into the projects it aggregates. Otherwise, the latter are never
1686 -- returned.
1688 -- In_Aggregate_Lib is True if the project is in an aggregate library
1690 -- The Tree argument passed to the callback is required in the case of
1691 -- aggregated projects, since they might not be using the same tree as 'By'
1693 type Project_Context is record
1694 In_Aggregate_Lib : Boolean;
1695 -- True if the project is part of an aggregate library
1697 From_Encapsulated_Lib : Boolean;
1698 -- True if the project is imported from an encapsulated library
1699 end record;
1701 generic
1702 type State is limited private;
1703 with procedure Action
1704 (Project : Project_Id;
1705 Tree : Project_Tree_Ref;
1706 Context : Project_Context;
1707 With_State : in out State);
1708 procedure For_Every_Project_Imported_Context
1709 (By : Project_Id;
1710 Tree : Project_Tree_Ref;
1711 With_State : in out State;
1712 Include_Aggregated : Boolean := True;
1713 Imported_First : Boolean := False);
1714 -- As for For_Every_Project_Imported but with an associated context
1716 generic
1717 with procedure Action
1718 (Project : Project_Id;
1719 Tree : Project_Tree_Ref;
1720 Context : Project_Context);
1721 procedure For_Project_And_Aggregated_Context
1722 (Root_Project : Project_Id;
1723 Root_Tree : Project_Tree_Ref);
1724 -- As for For_Project_And_Aggregated but with an associated context
1726 function Extend_Name
1727 (File : File_Name_Type;
1728 With_Suffix : String) return File_Name_Type;
1729 -- Replace the extension of File with With_Suffix
1731 function Object_Name
1732 (Source_File_Name : File_Name_Type;
1733 Object_File_Suffix : Name_Id := No_Name) return File_Name_Type;
1734 -- Returns the object file name corresponding to a source file name
1736 function Object_Name
1737 (Source_File_Name : File_Name_Type;
1738 Source_Index : Int;
1739 Index_Separator : Character;
1740 Object_File_Suffix : Name_Id := No_Name) return File_Name_Type;
1741 -- Returns the object file name corresponding to a unit in a multi-source
1742 -- file.
1744 function Dependency_Name
1745 (Source_File_Name : File_Name_Type;
1746 Dependency : Dependency_File_Kind) return File_Name_Type;
1747 -- Returns the dependency file name corresponding to a source file name
1749 function Switches_Name
1750 (Source_File_Name : File_Name_Type) return File_Name_Type;
1751 -- Returns the switches file name corresponding to a source file name
1753 procedure Set_Path_File_Var (Name : String; Value : String);
1754 -- Call Setenv, after calling To_Host_File_Spec
1756 function Current_Source_Path_File_Of
1757 (Shared : Shared_Project_Tree_Data_Access) return Path_Name_Type;
1758 -- Get the current include path file name
1760 procedure Set_Current_Source_Path_File_Of
1761 (Shared : Shared_Project_Tree_Data_Access;
1762 To : Path_Name_Type);
1763 -- Record the current include path file name
1765 function Current_Object_Path_File_Of
1766 (Shared : Shared_Project_Tree_Data_Access) return Path_Name_Type;
1767 -- Get the current object path file name
1769 procedure Set_Current_Object_Path_File_Of
1770 (Shared : Shared_Project_Tree_Data_Access;
1771 To : Path_Name_Type);
1772 -- Record the current object path file name
1774 -----------
1775 -- Flags --
1776 -----------
1778 type Processing_Flags is private;
1779 -- Flags used while parsing and processing a project tree to configure the
1780 -- behavior of the parser, and indicate how to report error messages. This
1781 -- structure does not allocate memory and never needs to be freed
1783 type Error_Warning is (Silent, Warning, Error);
1784 -- Severity of some situations, such as: no Ada sources in a project where
1785 -- Ada is one of the language.
1787 -- When the situation occurs, the behaviour depends on the setting:
1789 -- - Silent: no action
1790 -- - Warning: issue a warning, does not cause the tool to fail
1791 -- - Error: issue an error, causes the tool to fail
1793 type Error_Handler is access procedure
1794 (Project : Project_Id;
1795 Is_Warning : Boolean);
1796 -- This warns when an error was found when parsing a project. The error
1797 -- itself is handled through Prj.Err (and Prj.Err.Finalize should be called
1798 -- to actually print the error). This ensures that duplicate error messages
1799 -- are always correctly removed, that errors msgs are sorted, and that all
1800 -- tools will report the same error to the user.
1802 function Create_Flags
1803 (Report_Error : Error_Handler;
1804 When_No_Sources : Error_Warning;
1805 Require_Sources_Other_Lang : Boolean := True;
1806 Allow_Duplicate_Basenames : Boolean := True;
1807 Compiler_Driver_Mandatory : Boolean := False;
1808 Error_On_Unknown_Language : Boolean := True;
1809 Require_Obj_Dirs : Error_Warning := Error;
1810 Allow_Invalid_External : Error_Warning := Error;
1811 Missing_Source_Files : Error_Warning := Error;
1812 Ignore_Missing_With : Boolean := False)
1813 return Processing_Flags;
1814 -- Function used to create Processing_Flags structure
1816 -- If Allow_Duplicate_Basenames, then files with the same base names are
1817 -- authorized within a project for source-based languages (never for unit
1818 -- based languages).
1820 -- If Compiler_Driver_Mandatory is true, then a Compiler.Driver attribute
1821 -- for each language must be defined, or we will not look for its source
1822 -- files.
1824 -- When_No_Sources indicates what should be done when no sources of a
1825 -- language are found in a project where this language is declared.
1826 -- If Require_Sources_Other_Lang is true, then all languages must have at
1827 -- least one source file, or an error is reported via When_No_Sources. If
1828 -- it is false, this is only required for Ada (and only if it is a language
1829 -- of the project). When this parameter is set to False, we do not check
1830 -- that a proper naming scheme is defined for languages other than Ada.
1832 -- If Report_Error is null, use the standard error reporting mechanism
1833 -- (Errout). Otherwise, report errors using Report_Error.
1835 -- If Error_On_Unknown_Language is true, an error is displayed if some of
1836 -- the source files listed in the project do not match any naming scheme
1838 -- If Require_Obj_Dirs is true, then all object directories must exist
1839 -- (possibly after they have been created automatically if the appropriate
1840 -- switches were specified), or an error is raised.
1842 -- If Allow_Invalid_External is Silent, then no error is reported when an
1843 -- invalid value is used for an external variable (and it doesn't match its
1844 -- type). Instead, the first possible value is used.
1846 -- Missing_Source_Files indicates whether it is an error or a warning that
1847 -- a source file mentioned in the Source_Files attributes is not actually
1848 -- found in the source directories. This also impacts errors for missing
1849 -- source directories.
1851 -- If Ignore_Missing_With is True, then a "with" statement that cannot be
1852 -- resolved will simply be ignored. However, in such a case, the flag
1853 -- Incomplete_With in the project tree will be set to True.
1854 -- This is meant for use by tools so that they can properly set the
1855 -- project path in such a case:
1856 -- * no "gnatls" found (so no default project path)
1857 -- * user project sets Project.IDE'gnatls attribute to a cross gnatls
1858 -- * user project also includes a "with" that can only be resolved
1859 -- once we have found the gnatls
1861 Gprbuild_Flags : constant Processing_Flags;
1862 Gprclean_Flags : constant Processing_Flags;
1863 Gprexec_Flags : constant Processing_Flags;
1864 Gnatmake_Flags : constant Processing_Flags;
1865 -- Flags used by the various tools. They all display the error messages
1866 -- through Prj.Err.
1868 ----------------
1869 -- Temp Files --
1870 ----------------
1872 procedure Record_Temp_File
1873 (Shared : Shared_Project_Tree_Data_Access;
1874 Path : Path_Name_Type);
1875 -- Record the path of a newly created temporary file, so that it can be
1876 -- deleted later.
1878 procedure Delete_All_Temp_Files
1879 (Shared : Shared_Project_Tree_Data_Access);
1880 -- Delete all recorded temporary files.
1881 -- Does nothing if Debug.Debug_Flag_N is set
1883 procedure Delete_Temp_Config_Files (Project_Tree : Project_Tree_Ref);
1884 -- Delete all temporary config files. Does nothing if Debug.Debug_Flag_N is
1885 -- set or if Project_Tree is null. This initially came from gnatmake
1886 -- ??? Should this be combined with Delete_All_Temp_Files above
1888 procedure Delete_Temporary_File
1889 (Shared : Shared_Project_Tree_Data_Access := null;
1890 Path : Path_Name_Type);
1891 -- Delete a temporary file from the disk. The file is also removed from the
1892 -- list of temporary files to delete at the end of the program, in case
1893 -- another program running on the same machine has recreated it. Does
1894 -- nothing if Debug.Debug_Flag_N is set
1896 Virtual_Prefix : constant String := "v$";
1897 -- The prefix for virtual extending projects. Because of the '$', which is
1898 -- normally forbidden for project names, there cannot be any name clash.
1900 -----------
1901 -- Debug --
1902 -----------
1904 type Verbosity is (Default, Medium, High);
1905 pragma Ordered (Verbosity);
1906 -- Verbosity when parsing GNAT Project Files
1907 -- Default is default (very quiet, if no errors).
1908 -- Medium is more verbose.
1909 -- High is extremely verbose.
1911 Current_Verbosity : Verbosity := Default;
1912 -- The current value of the verbosity the project files are parsed with
1914 procedure Debug_Indent;
1915 -- Inserts a series of blanks depending on the current indentation level
1917 procedure Debug_Output (Str : String);
1918 procedure Debug_Output (Str : String; Str2 : Name_Id);
1919 -- If Current_Verbosity is not Default, outputs Str.
1920 -- This indents Str based on the current indentation level for traces
1921 -- Debug_Error is intended to be used to report an error in the traces.
1923 procedure Debug_Increase_Indent
1924 (Str : String := ""; Str2 : Name_Id := No_Name);
1925 procedure Debug_Decrease_Indent (Str : String := "");
1926 -- Increase or decrease the indentation level for debug traces. This
1927 -- indentation level only affects output done through Debug_Output.
1929 private
1931 All_Packages : constant String_List_Access := null;
1933 No_Project_Tree : constant Project_Tree_Ref := null;
1935 Ignored : constant Variable_Kind := Single;
1937 Nil_Variable_Value : constant Variable_Value :=
1938 (Project => No_Project,
1939 Kind => Undefined,
1940 Location => No_Location,
1941 Default => False);
1943 type Source_Iterator is record
1944 In_Tree : Project_Tree_Ref;
1946 Project : Project_List;
1947 All_Projects : Boolean;
1948 -- Current project and whether we should move on to the next
1950 Language : Language_Ptr;
1951 -- Current language processed
1953 Language_Name : Name_Id;
1954 -- Only sources of this language will be returned (or all if No_Name)
1956 Current : Source_Id;
1958 Encapsulated_Libs : Boolean;
1959 -- True if we want to include the sources from encapsulated libs
1961 Locally_Removed : Boolean;
1962 end record;
1964 procedure Add_To_Buffer
1965 (S : String;
1966 To : in out String_Access;
1967 Last : in out Natural);
1968 -- Append a String to the Buffer
1970 package Temp_Files_Table is new GNAT.Dynamic_Tables
1971 (Table_Component_Type => Path_Name_Type,
1972 Table_Index_Type => Integer,
1973 Table_Low_Bound => 1,
1974 Table_Initial => 10,
1975 Table_Increment => 10);
1976 -- Table to store the path name of all the created temporary files, so that
1977 -- they can be deleted at the end, or when the program is interrupted.
1979 type Private_Project_Tree_Data is record
1980 Temp_Files : Temp_Files_Table.Instance;
1981 -- Temporary files created as part of running tools (pragma files,
1982 -- mapping files,...)
1984 Current_Source_Path_File : Path_Name_Type := No_Path;
1985 -- Current value of project source path file env var. Used to avoid
1986 -- setting the env var to the same value. When different from No_Path,
1987 -- this indicates that logical names (VMS) or environment variables were
1988 -- created and should be deassigned to avoid polluting the environment
1989 -- on VMS. This is for gnatmake only.
1991 Current_Object_Path_File : Path_Name_Type := No_Path;
1992 -- Current value of project object path file env var. Used to avoid
1993 -- setting the env var to the same value.
1994 -- gnatmake only
1996 end record;
1997 -- Type to represent the part of a project tree which is private to the
1998 -- Project Manager.
2000 type Processing_Flags is record
2001 Require_Sources_Other_Lang : Boolean;
2002 Report_Error : Error_Handler;
2003 When_No_Sources : Error_Warning;
2004 Allow_Duplicate_Basenames : Boolean;
2005 Compiler_Driver_Mandatory : Boolean;
2006 Error_On_Unknown_Language : Boolean;
2007 Require_Obj_Dirs : Error_Warning;
2008 Allow_Invalid_External : Error_Warning;
2009 Missing_Source_Files : Error_Warning;
2010 Ignore_Missing_With : Boolean;
2011 end record;
2013 Gprbuild_Flags : constant Processing_Flags :=
2014 (Report_Error => null,
2015 When_No_Sources => Warning,
2016 Require_Sources_Other_Lang => True,
2017 Allow_Duplicate_Basenames => False,
2018 Compiler_Driver_Mandatory => True,
2019 Error_On_Unknown_Language => True,
2020 Require_Obj_Dirs => Error,
2021 Allow_Invalid_External => Error,
2022 Missing_Source_Files => Error,
2023 Ignore_Missing_With => False);
2025 Gprclean_Flags : constant Processing_Flags :=
2026 (Report_Error => null,
2027 When_No_Sources => Warning,
2028 Require_Sources_Other_Lang => True,
2029 Allow_Duplicate_Basenames => False,
2030 Compiler_Driver_Mandatory => True,
2031 Error_On_Unknown_Language => True,
2032 Require_Obj_Dirs => Warning,
2033 Allow_Invalid_External => Error,
2034 Missing_Source_Files => Error,
2035 Ignore_Missing_With => False);
2037 Gprexec_Flags : constant Processing_Flags :=
2038 (Report_Error => null,
2039 When_No_Sources => Silent,
2040 Require_Sources_Other_Lang => False,
2041 Allow_Duplicate_Basenames => False,
2042 Compiler_Driver_Mandatory => False,
2043 Error_On_Unknown_Language => True,
2044 Require_Obj_Dirs => Silent,
2045 Allow_Invalid_External => Error,
2046 Missing_Source_Files => Silent,
2047 Ignore_Missing_With => False);
2049 Gnatmake_Flags : constant Processing_Flags :=
2050 (Report_Error => null,
2051 When_No_Sources => Error,
2052 Require_Sources_Other_Lang => False,
2053 Allow_Duplicate_Basenames => False,
2054 Compiler_Driver_Mandatory => False,
2055 Error_On_Unknown_Language => False,
2056 Require_Obj_Dirs => Error,
2057 Allow_Invalid_External => Error,
2058 Missing_Source_Files => Error,
2059 Ignore_Missing_With => False);
2061 end Prj;