1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 2001-2014, Free Software Foundation, Inc. --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 ------------------------------------------------------------------------------
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
;
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
;
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
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 type Attribute_Default_Value
is
76 (Read_Only_Value
, -- For read only attributes (Name, Project_Dir)
77 Empty_Value
, -- Empty string or empty string list
78 Dot_Value
, -- "." or (".")
79 Object_Dir_Value
, -- 'Object_Dir
80 Target_Value
, -- 'Target (special rules)
81 Runtime_Value
); -- 'Runtime (special rules)
82 -- Describe the default values of attributes that are referenced but not
85 pragma Warnings
(Off
);
86 type Project_Qualifier
is
89 -- The following clash with Standard is OK, and justified by the context
90 -- which really wants to use the same set of qualifiers.
100 -- Qualifiers that can prefix the reserved word "project" in a project
102 -- Standard: standard project ...
103 -- Library: library project is ...
104 -- Abstract_Project: abstract project is
105 -- Aggregate: aggregate project is
106 -- Aggregate_Library: aggregate library project is ...
107 -- Configuration: configuration project is ...
109 subtype Aggregate_Project
is
110 Project_Qualifier
range Aggregate
.. Aggregate_Library
;
112 All_Packages
: constant String_List_Access
;
113 -- Default value of parameter Packages of procedures Parse, in Prj.Pars and
114 -- Prj.Part, indicating that all packages should be checked.
116 type Project_Tree_Data
;
117 type Project_Tree_Ref
is access all Project_Tree_Data
;
118 -- Reference to a project tree. Several project trees may exist in memory
121 No_Project_Tree
: constant Project_Tree_Ref
;
123 procedure Free
(Tree
: in out Project_Tree_Ref
);
124 -- Free memory associated with the tree
126 Config_Project_File_Extension
: String := ".cgpr";
127 Project_File_Extension
: String := ".gpr";
128 -- The standard config and user project file name extensions. They are not
129 -- constants, because Canonical_Case_File_Name is called on these variables
130 -- in the body of Prj.
132 function Empty_File
return File_Name_Type
;
133 function Empty_String
return Name_Id
;
134 -- Return the id for an empty string ""
136 function Dot_String
return Name_Id
;
137 -- Return the id for "."
139 type Path_Information
is record
140 Name
: Path_Name_Type
:= No_Path
;
141 Display_Name
: Path_Name_Type
:= No_Path
;
143 -- Directory names always end with a directory separator
145 No_Path_Information
: constant Path_Information
:= (No_Path
, No_Path
);
148 type Project_Id
is access all Project_Data
;
149 No_Project
: constant Project_Id
:= null;
150 -- Id of a Project File
152 type String_List_Id
is new Nat
;
153 Nil_String
: constant String_List_Id
:= 0;
154 type String_Element
is record
155 Value
: Name_Id
:= No_Name
;
157 Display_Value
: Name_Id
:= No_Name
;
158 Location
: Source_Ptr
:= No_Location
;
159 Flag
: Boolean := False;
160 Next
: String_List_Id
:= Nil_String
;
162 -- To hold values for string list variables and array elements.
163 -- Component Flag may be used for various purposes. For source
164 -- directories, it indicates if the directory contains Ada source(s).
166 package String_Element_Table
is new GNAT
.Dynamic_Tables
167 (Table_Component_Type
=> String_Element
,
168 Table_Index_Type
=> String_List_Id
,
169 Table_Low_Bound
=> 1,
170 Table_Initial
=> 200,
171 Table_Increment
=> 100);
172 -- The table for string elements in string lists
174 type Variable_Kind
is (Undefined
, List
, Single
);
175 -- Different kinds of variables
177 subtype Defined_Variable_Kind
is Variable_Kind
range List
.. Single
;
178 -- The defined kinds of variables
180 Ignored
: constant Variable_Kind
;
181 -- Used to indicate that a package declaration must be ignored while
182 -- processing the project tree (unknown package name).
184 type Variable_Value
(Kind
: Variable_Kind
:= Undefined
) is record
185 Project
: Project_Id
:= No_Project
;
186 Location
: Source_Ptr
:= No_Location
;
187 Default
: Boolean := False;
192 Values
: String_List_Id
:= Nil_String
;
194 Value
: Name_Id
:= No_Name
;
198 -- Values for variables and array elements. Default is True if the
199 -- current value is the default one for the variable.
201 Nil_Variable_Value
: constant Variable_Value
;
202 -- Value of a non existing variable or array element
204 type Variable_Id
is new Nat
;
205 No_Variable
: constant Variable_Id
:= 0;
206 type Variable
is record
207 Next
: Variable_Id
:= No_Variable
;
209 Value
: Variable_Value
;
211 -- To hold the list of variables in a project file and in packages
213 package Variable_Element_Table
is new GNAT
.Dynamic_Tables
214 (Table_Component_Type
=> Variable
,
215 Table_Index_Type
=> Variable_Id
,
216 Table_Low_Bound
=> 1,
217 Table_Initial
=> 200,
218 Table_Increment
=> 100);
219 -- The table of variable in list of variables
221 type Array_Element_Id
is new Nat
;
222 No_Array_Element
: constant Array_Element_Id
:= 0;
223 type Array_Element
is record
225 Restricted
: Boolean := False;
226 Src_Index
: Int
:= 0;
227 Index_Case_Sensitive
: Boolean := True;
228 Value
: Variable_Value
;
229 Next
: Array_Element_Id
:= No_Array_Element
;
231 -- Each Array_Element represents an array element and is linked (Next)
232 -- to the next array element, if any, in the array.
234 package Array_Element_Table
is new GNAT
.Dynamic_Tables
235 (Table_Component_Type
=> Array_Element
,
236 Table_Index_Type
=> Array_Element_Id
,
237 Table_Low_Bound
=> 1,
238 Table_Initial
=> 200,
239 Table_Increment
=> 100);
240 -- The table that contains all array elements
242 type Array_Id
is new Nat
;
243 No_Array
: constant Array_Id
:= 0;
244 type Array_Data
is record
245 Name
: Name_Id
:= No_Name
;
246 Location
: Source_Ptr
:= No_Location
;
247 Value
: Array_Element_Id
:= No_Array_Element
;
248 Next
: Array_Id
:= No_Array
;
250 -- Each Array_Data value represents an array.
251 -- Value is the id of the first element.
252 -- Next is the id of the next array in the project file or package.
254 package Array_Table
is new GNAT
.Dynamic_Tables
255 (Table_Component_Type
=> Array_Data
,
256 Table_Index_Type
=> Array_Id
,
257 Table_Low_Bound
=> 1,
258 Table_Initial
=> 200,
259 Table_Increment
=> 100);
260 -- The table that contains all arrays
262 type Package_Id
is new Nat
;
263 No_Package
: constant Package_Id
:= 0;
264 type Declarations
is record
265 Variables
: Variable_Id
:= No_Variable
;
266 Attributes
: Variable_Id
:= No_Variable
;
267 Arrays
: Array_Id
:= No_Array
;
268 Packages
: Package_Id
:= No_Package
;
270 -- Contains the declarations (variables, single and array attributes,
271 -- packages) for a project or a package in a project.
273 No_Declarations
: constant Declarations
:=
274 (Variables
=> No_Variable
,
275 Attributes
=> No_Variable
,
277 Packages
=> No_Package
);
278 -- Default value of Declarations: used if there are no declarations
280 type Package_Element
is record
281 Name
: Name_Id
:= No_Name
;
282 Decl
: Declarations
:= No_Declarations
;
283 Parent
: Package_Id
:= No_Package
;
284 Next
: Package_Id
:= No_Package
;
286 -- A package (includes declarations that may include other packages)
288 package Package_Table
is new GNAT
.Dynamic_Tables
289 (Table_Component_Type
=> Package_Element
,
290 Table_Index_Type
=> Package_Id
,
291 Table_Low_Bound
=> 1,
292 Table_Initial
=> 100,
293 Table_Increment
=> 100);
294 -- The table that contains all packages
297 type Language_Ptr
is access all Language_Data
;
298 -- Index of language data
300 No_Language_Index
: constant Language_Ptr
:= null;
301 -- Constant indicating that there is no language data
303 function Get_Language_From_Name
304 (Project
: Project_Id
;
305 Name
: String) return Language_Ptr
;
306 -- Get a language from a project. This might return null if no such
307 -- language exists in the project
309 Max_Header_Num
: constant := 6150;
310 type Header_Num
is range 0 .. Max_Header_Num
;
311 -- Size for hash table below. The upper bound is an arbitrary value, the
312 -- value here was chosen after testing to determine a good compromise
313 -- between speed of access and memory usage.
315 function Hash
(Name
: Name_Id
) return Header_Num
;
316 function Hash
(Name
: File_Name_Type
) return Header_Num
;
317 function Hash
(Name
: Path_Name_Type
) return Header_Num
;
318 function Hash
(Project
: Project_Id
) return Header_Num
;
319 -- Used for computing hash values for names put into hash tables
321 type Language_Kind
is (File_Based
, Unit_Based
);
322 -- Type for the kind of language. All languages are file based, except Ada
323 -- which is unit based.
325 -- Type of dependency to be checked
327 type Dependency_File_Kind
is
329 -- There is no dependency file, the source must always be recompiled
332 -- The dependency file is a Makefile fragment indicating all the files
333 -- the source depends on. If the object file or the dependency file is
334 -- more recent than any of these files, the source must be recompiled.
337 -- The dependency file is an ALI file and the source must be recompiled
338 -- if the object or ALI file is more recent than any of the sources
339 -- listed in the D lines.
342 -- The dependency file is an ALI file and the source must be recompiled
343 -- if the object or ALI file is more recent than any source in the full
346 Makefile_Dependency_Suffix
: constant String := ".d";
347 ALI_Dependency_Suffix
: constant String := ".ali";
348 Switches_Dependency_Suffix
: constant String := ".cswi";
350 Binder_Exchange_Suffix
: constant String := ".bexch";
351 -- Suffix for binder exchange files
353 Library_Exchange_Suffix
: constant String := ".lexch";
354 -- Suffix for library exchange files
356 type Name_List_Index
is new Nat
;
357 No_Name_List
: constant Name_List_Index
:= 0;
359 type Name_Node
is record
360 Name
: Name_Id
:= No_Name
;
361 Next
: Name_List_Index
:= No_Name_List
;
364 package Name_List_Table
is new GNAT
.Dynamic_Tables
365 (Table_Component_Type
=> Name_Node
,
366 Table_Index_Type
=> Name_List_Index
,
367 Table_Low_Bound
=> 1,
369 Table_Increment
=> 100);
370 -- The table for lists of names
373 (Table
: Name_List_Table
.Instance
;
374 List
: Name_List_Index
) return Natural;
375 -- Return the number of elements in specified list
377 type Number_List_Index
is new Nat
;
378 No_Number_List
: constant Number_List_Index
:= 0;
380 type Number_Node
is record
381 Number
: Natural := 0;
382 Next
: Number_List_Index
:= No_Number_List
;
385 package Number_List_Table
is new GNAT
.Dynamic_Tables
386 (Table_Component_Type
=> Number_Node
,
387 Table_Index_Type
=> Number_List_Index
,
388 Table_Low_Bound
=> 1,
390 Table_Increment
=> 100);
391 -- The table for lists of numbers
393 package Mapping_Files_Htable
is new Simple_HTable
394 (Header_Num
=> Header_Num
,
395 Element
=> Path_Name_Type
,
396 No_Element
=> No_Path
,
397 Key
=> Path_Name_Type
,
400 -- A hash table to store the mapping files that are not used
402 -- The following record ???
404 type Lang_Naming_Data
is record
405 Dot_Replacement
: File_Name_Type
:= No_File
;
406 -- The string to replace '.' in the source file name (for Ada)
408 Casing
: Casing_Type
:= All_Lower_Case
;
409 -- The casing of the source file name (for Ada)
411 Separate_Suffix
: File_Name_Type
:= No_File
;
412 -- String to append to unit name for source file name of an Ada subunit
414 Spec_Suffix
: File_Name_Type
:= No_File
;
415 -- The string to append to the unit name for the
416 -- source file name of a spec.
418 Body_Suffix
: File_Name_Type
:= No_File
;
419 -- The string to append to the unit name for the
420 -- source file name of a body.
423 No_Lang_Naming_Data
: constant Lang_Naming_Data
:=
424 (Dot_Replacement
=> No_File
,
425 Casing
=> All_Lower_Case
,
426 Separate_Suffix
=> No_File
,
427 Spec_Suffix
=> No_File
,
428 Body_Suffix
=> No_File
);
430 function Is_Standard_GNAT_Naming
(Naming
: Lang_Naming_Data
) return Boolean;
431 -- True if the naming scheme is GNAT's default naming scheme. This
432 -- is to take into account shortened names like "Ada." (a-), "System." (s-)
436 type Source_Id
is access all Source_Data
;
438 function Is_Compilable
(Source
: Source_Id
) return Boolean;
439 pragma Inline
(Is_Compilable
);
440 -- Return True if we know how to compile Source (i.e. if a compiler is
441 -- defined). This doesn't indicate whether the source should be compiled.
443 function Object_To_Global_Archive
(Source
: Source_Id
) return Boolean;
444 pragma Inline
(Object_To_Global_Archive
);
445 -- Return True if the object file should be put in the global archive.
446 -- This is for Ada, when only the closure of a main needs to be
449 function Other_Part
(Source
: Source_Id
) return Source_Id
;
450 pragma Inline
(Other_Part
);
451 -- Source ID for the other part, if any: for a spec, returns its body;
452 -- for a body, returns its spec.
454 No_Source
: constant Source_Id
:= null;
456 type Path_Syntax_Kind
is
457 (Canonical
, -- Unix style
458 Host
); -- Host specific syntax
460 -- The following record describes the configuration of a language
462 type Language_Config
is record
463 Kind
: Language_Kind
:= File_Based
;
464 -- Kind of language. Most languages are file based. A few, such as Ada,
467 Naming_Data
: Lang_Naming_Data
;
468 -- The naming data for the languages (prefixes, etc.)
470 Include_Compatible_Languages
: Name_List_Index
:= No_Name_List
;
471 -- List of languages that are "include compatible" with this language. A
472 -- language B (for example "C") is "include compatible" with a language
473 -- A (for example "C++") if it is expected that sources of language A
474 -- may "include" header files from language B.
476 Compiler_Driver
: File_Name_Type
:= No_File
;
477 -- The name of the executable for the compiler of the language
479 Compiler_Driver_Path
: String_Access
:= null;
480 -- The path name of the executable for the compiler of the language
482 Compiler_Leading_Required_Switches
: Name_List_Index
:= No_Name_List
;
483 -- The list of initial switches that are required as a minimum to invoke
484 -- the compiler driver.
486 Compiler_Trailing_Required_Switches
: Name_List_Index
:= No_Name_List
;
487 -- The list of final switches that are required as a minimum to invoke
488 -- the compiler driver.
490 Multi_Unit_Switches
: Name_List_Index
:= No_Name_List
;
491 -- The switch(es) to indicate the index of a unit in a multi-source file
493 Multi_Unit_Object_Separator
: Character := ' ';
494 -- The string separating the base name of a source from the index of the
495 -- unit in a multi-source file, in the object file name.
497 Path_Syntax
: Path_Syntax_Kind
:= Host
;
498 -- Value may be Canonical (Unix style) or Host (host syntax)
500 Source_File_Switches
: Name_List_Index
:= No_Name_List
;
501 -- Optional switches to be put before the source file. The source file
502 -- path name is appended to the last switch in the list.
503 -- Example: ("-i", "");
505 Object_File_Suffix
: Name_Id
:= No_Name
;
506 -- Optional alternate object file suffix
508 Object_File_Switches
: Name_List_Index
:= No_Name_List
;
509 -- Optional object file switches. When this is defined, the switches
510 -- are used to specify the object file. The object file name is appended
511 -- to the last switch in the list. Example: ("-o", "").
513 Object_Path_Switches
: Name_List_Index
:= No_Name_List
;
514 -- List of switches to specify to the compiler the path name of a
515 -- temporary file containing the list of object directories in the
518 Compilation_PIC_Option
: Name_List_Index
:= No_Name_List
;
519 -- The option(s) to compile a source in Position Independent Code for
520 -- shared libraries. Specified in the configuration. When not specified,
521 -- there is no need for such switch.
523 Object_Generated
: Boolean := True;
524 -- False if no object file is generated
526 Objects_Linked
: Boolean := True;
527 -- False if object files are not use to link executables and build
530 Runtime_Library_Dir
: Name_Id
:= No_Name
;
531 -- Path name of the runtime library directory, if any
533 Runtime_Source_Dir
: Name_Id
:= No_Name
;
534 -- Path name of the runtime source directory, if any
536 Mapping_File_Switches
: Name_List_Index
:= No_Name_List
;
537 -- The option(s) to provide a mapping file to the compiler. Specified in
538 -- the configuration. When value is No_Name_List, there is no mapping
541 Mapping_Spec_Suffix
: File_Name_Type
:= No_File
;
542 -- Placeholder representing the spec suffix in a mapping file
544 Mapping_Body_Suffix
: File_Name_Type
:= No_File
;
545 -- Placeholder representing the body suffix in a mapping file
547 Config_File_Switches
: Name_List_Index
:= No_Name_List
;
548 -- The option(s) to provide a config file to the compiler. Specified in
549 -- the configuration. If value is No_Name_List there is no config file.
551 Dependency_Kind
: Dependency_File_Kind
:= None
;
552 -- The kind of dependency to be checked: none, Makefile fragment or
553 -- ALI file (for Ada).
555 Dependency_Option
: Name_List_Index
:= No_Name_List
;
556 -- The option(s) to be used to create the dependency file. When value is
557 -- No_Name_List, there is not such option(s).
559 Compute_Dependency
: Name_List_Index
:= No_Name_List
;
560 -- Hold the value of attribute Dependency_Driver, if declared for the
563 Include_Option
: Name_List_Index
:= No_Name_List
;
564 -- Hold the value of attribute Include_Switches, if declared for the
567 Include_Path
: Name_Id
:= No_Name
;
568 -- Name of environment variable declared by attribute Include_Path for
571 Include_Path_File
: Name_Id
:= No_Name
;
572 -- Name of environment variable declared by attribute Include_Path_File
575 Objects_Path
: Name_Id
:= No_Name
;
576 -- Name of environment variable declared by attribute Objects_Path for
579 Objects_Path_File
: Name_Id
:= No_Name
;
580 -- Name of environment variable declared by attribute Objects_Path_File
583 Config_Body
: Name_Id
:= No_Name
;
584 -- The template for a pragma Source_File_Name(_Project) for a specific
585 -- file name of a body.
587 Config_Body_Index
: Name_Id
:= No_Name
;
588 -- The template for a pragma Source_File_Name(_Project) for a specific
589 -- file name of a body in a multi-source file.
591 Config_Body_Pattern
: Name_Id
:= No_Name
;
592 -- The template for a pragma Source_File_Name(_Project) for a naming
595 Config_Spec
: Name_Id
:= No_Name
;
596 -- The template for a pragma Source_File_Name(_Project) for a specific
597 -- file name of a spec.
599 Config_Spec_Index
: Name_Id
:= No_Name
;
600 -- The template for a pragma Source_File_Name(_Project) for a specific
601 -- file name of a spec in a multi-source file.
603 Config_Spec_Pattern
: Name_Id
:= No_Name
;
604 -- The template for a pragma Source_File_Name(_Project) for a naming
607 Config_File_Unique
: Boolean := False;
608 -- True if the config file specified to the compiler needs to be unique.
609 -- If it is unique, then all config files are concatenated into a temp
612 Binder_Driver
: File_Name_Type
:= No_File
;
613 -- The name of the binder driver for the language, if any
615 Binder_Driver_Path
: Path_Name_Type
:= No_Path
;
616 -- The path name of the binder driver
618 Binder_Required_Switches
: Name_List_Index
:= No_Name_List
;
619 -- Hold the value of attribute Binder'Required_Switches for the language
621 Binder_Prefix
: Name_Id
:= No_Name
;
622 -- Hold the value of attribute Binder'Prefix for the language
624 Toolchain_Version
: Name_Id
:= No_Name
;
625 -- Hold the value of attribute Toolchain_Version for the language
627 Toolchain_Description
: Name_Id
:= No_Name
;
628 -- Hold the value of attribute Toolchain_Description for the language
630 Clean_Object_Artifacts
: Name_List_Index
:= No_Name_List
;
631 -- List of object artifact extensions to be deleted by gprclean
633 Clean_Source_Artifacts
: Name_List_Index
:= No_Name_List
;
634 -- List of source artifact extensions to be deleted by gprclean
638 No_Language_Config
: constant Language_Config
:=
640 Naming_Data
=> No_Lang_Naming_Data
,
641 Include_Compatible_Languages
=> No_Name_List
,
642 Compiler_Driver
=> No_File
,
643 Compiler_Driver_Path
=> null,
644 Compiler_Leading_Required_Switches
646 Compiler_Trailing_Required_Switches
648 Multi_Unit_Switches
=> No_Name_List
,
649 Multi_Unit_Object_Separator
=> ' ',
650 Path_Syntax
=> Canonical
,
651 Source_File_Switches
=> No_Name_List
,
652 Object_File_Suffix
=> No_Name
,
653 Object_File_Switches
=> No_Name_List
,
654 Object_Path_Switches
=> No_Name_List
,
655 Compilation_PIC_Option
=> No_Name_List
,
656 Object_Generated
=> True,
657 Objects_Linked
=> True,
658 Runtime_Library_Dir
=> No_Name
,
659 Runtime_Source_Dir
=> No_Name
,
660 Mapping_File_Switches
=> No_Name_List
,
661 Mapping_Spec_Suffix
=> No_File
,
662 Mapping_Body_Suffix
=> No_File
,
663 Config_File_Switches
=> No_Name_List
,
664 Dependency_Kind
=> None
,
665 Dependency_Option
=> No_Name_List
,
666 Compute_Dependency
=> No_Name_List
,
667 Include_Option
=> No_Name_List
,
668 Include_Path
=> No_Name
,
669 Include_Path_File
=> No_Name
,
670 Objects_Path
=> No_Name
,
671 Objects_Path_File
=> No_Name
,
672 Config_Body
=> No_Name
,
673 Config_Body_Index
=> No_Name
,
674 Config_Body_Pattern
=> No_Name
,
675 Config_Spec
=> No_Name
,
676 Config_Spec_Index
=> No_Name
,
677 Config_Spec_Pattern
=> No_Name
,
678 Config_File_Unique
=> False,
679 Binder_Driver
=> No_File
,
680 Binder_Driver_Path
=> No_Path
,
681 Binder_Required_Switches
=> No_Name_List
,
682 Binder_Prefix
=> No_Name
,
683 Toolchain_Version
=> No_Name
,
684 Toolchain_Description
=> No_Name
,
685 Clean_Object_Artifacts
=> No_Name_List
,
686 Clean_Source_Artifacts
=> No_Name_List
);
688 type Language_Data
is record
689 Name
: Name_Id
:= No_Name
;
690 -- The name of the language in lower case
692 Display_Name
: Name_Id
:= No_Name
;
693 -- The name of the language, as found in attribute Languages
695 Config
: Language_Config
:= No_Language_Config
;
696 -- Configuration of the language
698 First_Source
: Source_Id
:= No_Source
;
699 -- Head of the list of sources of the language in the project
701 Mapping_Files
: Mapping_Files_Htable
.Instance
:=
702 Mapping_Files_Htable
.Nil
;
703 -- Hash table containing the mapping of the sources to their path names
705 Next
: Language_Ptr
:= No_Language_Index
;
706 -- Next language of the project
710 No_Language_Data
: constant Language_Data
:=
712 Display_Name
=> No_Name
,
713 Config
=> No_Language_Config
,
714 First_Source
=> No_Source
,
715 Mapping_Files
=> Mapping_Files_Htable
.Nil
,
716 Next
=> No_Language_Index
);
718 type Language_List_Element
;
719 type Language_List
is access all Language_List_Element
;
720 type Language_List_Element
is record
721 Language
: Language_Ptr
:= No_Language_Index
;
722 Next
: Language_List
;
725 type Source_Kind
is (Spec
, Impl
, Sep
);
726 subtype Spec_Or_Body
is Source_Kind
range Spec
.. Impl
;
728 -- The following declarations declare a structure used to store the Name
729 -- and File and Path names of a unit, with a reference to its GNAT Project
730 -- File(s). Some units might have neither Spec nor Impl when they were
731 -- created for a "separate".
733 type File_Names_Data
is array (Spec_Or_Body
) of Source_Id
;
735 type Unit_Data
is record
736 Name
: Name_Id
:= No_Name
;
737 File_Names
: File_Names_Data
;
740 type Unit_Index
is access all Unit_Data
;
742 No_Unit_Index
: constant Unit_Index
:= null;
743 -- Used to indicate a null entry for no unit
746 type Roots_Access
is access Source_Roots
;
747 type Source_Roots
is record
751 -- A list to store the roots associated with a main unit. These are the
752 -- files that need to linked along with the main (for instance a C file
753 -- corresponding to an Ada file). In general, these are dependencies that
754 -- cannot be computed automatically by the builder.
756 type Naming_Exception_Type
is (No
, Yes
, Inherited
);
758 -- Structure to define source data
760 type Source_Data
is record
761 Initialized
: Boolean := False;
762 -- Set to True when Source_Data is completely initialized
764 Project
: Project_Id
:= No_Project
;
765 -- Project of the source
767 Location
: Source_Ptr
:= No_Location
;
768 -- Location in the project file of the declaration of the source in
771 Source_Dir_Rank
: Natural := 0;
772 -- The rank of the source directory in list declared with attribute
773 -- Source_Dirs. Two source files with the same name cannot appears in
774 -- different directory with the same rank. That can happen when the
775 -- recursive notation <dir>/** is used in attribute Source_Dirs.
777 Language
: Language_Ptr
:= No_Language_Index
;
778 -- Language of the source
780 In_Interfaces
: Boolean := True;
781 -- False when the source is not included in interfaces, when attribute
782 -- Interfaces is declared.
784 Declared_In_Interfaces
: Boolean := False;
785 -- True when source is declared in attribute Interfaces
787 Alternate_Languages
: Language_List
:= null;
788 -- List of languages a header file may also be, in addition of language
791 Kind
: Source_Kind
:= Spec
;
792 -- Kind of the source: spec, body or subunit
794 Unit
: Unit_Index
:= No_Unit_Index
;
795 -- Name of the unit, if language is unit based. This is only set for
796 -- those files that are part of the compilation set (for instance a
797 -- file in an extended project that is overridden will not have this
801 -- Index of the source in a multi unit source file (the same Source_Data
802 -- is duplicated several times when there are several units in the same
803 -- file). Index is 0 if there is either no unit or a single one, and
804 -- starts at 1 when there are multiple units
806 Compilable
: Yes_No_Unknown
:= Unknown
;
807 -- Updated at the first call to Is_Compilable. Yes if source file is
810 In_The_Queue
: Boolean := False;
811 -- True if the source has been put in the queue
813 Locally_Removed
: Boolean := False;
814 -- True if the source has been "excluded"
816 Suppressed
: Boolean := False;
817 -- True if the source is a locally removed direct source of the project.
818 -- These sources should not be put in the mapping file.
820 Replaced_By
: Source_Id
:= No_Source
;
821 -- Source in an extending project that replaces the current source
823 File
: File_Name_Type
:= No_File
;
824 -- Canonical file name of the source
826 Display_File
: File_Name_Type
:= No_File
;
827 -- File name of the source, for display purposes
829 Path
: Path_Information
:= No_Path_Information
;
830 -- Path name of the source
832 Source_TS
: Time_Stamp_Type
:= Empty_Time_Stamp
;
833 -- Time stamp of the source file
835 Object_Project
: Project_Id
:= No_Project
;
836 -- Project where the object file is. This might be different from
837 -- Project when using extending project files.
839 Object
: File_Name_Type
:= No_File
;
840 -- File name of the object file
842 Current_Object_Path
: Path_Name_Type
:= No_Path
;
843 -- Object path of an existing object file
845 Object_Path
: Path_Name_Type
:= No_Path
;
846 -- Object path of the real object file
848 Object_TS
: Time_Stamp_Type
:= Empty_Time_Stamp
;
849 -- Object file time stamp
851 Dep_Name
: File_Name_Type
:= No_File
;
852 -- Dependency file simple name
854 Current_Dep_Path
: Path_Name_Type
:= No_Path
;
855 -- Path name of an existing dependency file
857 Dep_Path
: Path_Name_Type
:= No_Path
;
858 -- Path name of the real dependency file
860 Dep_TS
: aliased Osint
.File_Attributes
:= Osint
.Unknown_Attributes
;
861 -- Dependency file time stamp
863 Switches
: File_Name_Type
:= No_File
;
864 -- File name of the switches file. For all languages, this is a file
865 -- that ends with the .cswi extension.
867 Switches_Path
: Path_Name_Type
:= No_Path
;
868 -- Path name of the switches file
870 Switches_TS
: Time_Stamp_Type
:= Empty_Time_Stamp
;
871 -- Switches file time stamp
873 Naming_Exception
: Naming_Exception_Type
:= No
;
874 -- True if the source has an exceptional name
876 Duplicate_Unit
: Boolean := False;
877 -- True when a duplicate unit has been reported for this source
879 Next_In_Lang
: Source_Id
:= No_Source
;
880 -- Link to another source of the same language in the same project
882 Next_With_File_Name
: Source_Id
:= No_Source
;
883 -- Link to another source with the same base file name
885 Roots
: Roots_Access
:= null;
886 -- The roots for a main unit
890 No_Source_Data
: constant Source_Data
:=
891 (Initialized
=> False,
892 Project
=> No_Project
,
893 Location
=> No_Location
,
894 Source_Dir_Rank
=> 0,
895 Language
=> No_Language_Index
,
896 In_Interfaces
=> True,
897 Declared_In_Interfaces
=> False,
898 Alternate_Languages
=> null,
900 Unit
=> No_Unit_Index
,
902 Locally_Removed
=> False,
904 Compilable
=> Unknown
,
905 In_The_Queue
=> False,
906 Replaced_By
=> No_Source
,
908 Display_File
=> No_File
,
909 Path
=> No_Path_Information
,
910 Source_TS
=> Empty_Time_Stamp
,
911 Object_Project
=> No_Project
,
913 Current_Object_Path
=> No_Path
,
914 Object_Path
=> No_Path
,
915 Object_TS
=> Empty_Time_Stamp
,
917 Current_Dep_Path
=> No_Path
,
919 Dep_TS
=> Osint
.Unknown_Attributes
,
921 Switches_Path
=> No_Path
,
922 Switches_TS
=> Empty_Time_Stamp
,
923 Naming_Exception
=> No
,
924 Duplicate_Unit
=> False,
925 Next_In_Lang
=> No_Source
,
926 Next_With_File_Name
=> No_Source
,
929 package Source_Files_Htable
is new Simple_HTable
930 (Header_Num
=> Header_Num
,
931 Element
=> Source_Id
,
932 No_Element
=> No_Source
,
933 Key
=> File_Name_Type
,
936 -- Mapping of source file names to source ids
938 package Source_Paths_Htable
is new Simple_HTable
939 (Header_Num
=> Header_Num
,
940 Element
=> Source_Id
,
941 No_Element
=> No_Source
,
942 Key
=> Path_Name_Type
,
945 -- Mapping of source paths to source ids
947 type Lib_Kind
is (Static
, Dynamic
, Relocatable
);
949 type Policy
is (Autonomous
, Compliant
, Controlled
, Restricted
, Direct
);
950 -- Type to specify the symbol policy, when symbol control is supported.
951 -- See full explanation about this type in package Symbols.
952 -- Autonomous: Create a symbol file without considering any reference
953 -- Compliant: Try to be as compatible as possible with an existing ref
954 -- Controlled: Fail if symbols are not the same as those in the reference
955 -- Restricted: Restrict the symbols to those in the symbol file
956 -- Direct: The symbol file is used as is
958 type Symbol_Record
is record
959 Symbol_File
: Path_Name_Type
:= No_Path
;
960 Reference
: Path_Name_Type
:= No_Path
;
961 Symbol_Policy
: Policy
:= Autonomous
;
963 -- Type to keep the symbol data to be used when building a shared library
965 No_Symbols
: constant Symbol_Record
:=
966 (Symbol_File
=> No_Path
,
967 Reference
=> No_Path
,
968 Symbol_Policy
=> Autonomous
);
969 -- The default value of the symbol data
971 function Image
(The_Casing
: Casing_Type
) return String;
972 -- Similar to 'Image (but avoid use of this attribute in compiler)
974 function Value
(Image
: String) return Casing_Type
;
975 -- Similar to 'Value (but avoid use of this attribute in compiler)
976 -- Raises Constraint_Error if not a Casing_Type image.
978 -- The following record contains data for a naming scheme
980 function Get_Object_Directory
981 (Project
: Project_Id
;
982 Including_Libraries
: Boolean;
983 Only_If_Ada
: Boolean := False) return Path_Name_Type
;
984 -- Return the object directory to use for the project. This depends on
985 -- whether we have a library project or a standard project. This function
986 -- might return No_Name when no directory applies. If the project is a
987 -- library project file and Including_Libraries is True then the library
988 -- ALI dir is returned instead of the object dir, except when there is no
989 -- ALI files in the Library ALI dir and the object directory exists. If
990 -- Only_If_Ada is True, then No_Name is returned when the project doesn't
991 -- include any Ada source.
993 procedure Compute_All_Imported_Projects
994 (Root_Project
: Project_Id
;
995 Tree
: Project_Tree_Ref
);
996 -- For all projects in the tree, compute the list of the projects imported
997 -- directly or indirectly by project Root_Project. The result is stored in
998 -- Project.All_Imported_Projects for each project
1000 function Ultimate_Extending_Project_Of
1001 (Proj
: Project_Id
) return Project_Id
;
1002 -- Returns the ultimate extending project of project Proj. If project Proj
1003 -- is not extended, returns Proj.
1005 type Project_List_Element
;
1006 type Project_List
is access all Project_List_Element
;
1007 type Project_List_Element
is record
1008 Project
: Project_Id
:= No_Project
;
1009 From_Encapsulated_Lib
: Boolean := False;
1010 Next
: Project_List
:= null;
1012 -- A list of projects
1015 (List
: in out Project_List
;
1016 Free_Project
: Boolean);
1017 -- Free the list of projects, if Free_Project, each project is also freed
1019 type Response_File_Format
is
1028 -- The format of the different response files
1030 type Project_Configuration
is record
1031 Target
: Name_Id
:= No_Name
;
1032 -- The target of the configuration, when specified
1034 Run_Path_Option
: Name_List_Index
:= No_Name_List
;
1035 -- The option to use when linking to specify the path where to look for
1038 Run_Path_Origin
: Name_Id
:= No_Name
;
1039 -- Specify the string (such as "$ORIGIN") to indicate paths relative to
1040 -- the directory of the executable in the run path option.
1042 Library_Install_Name_Option
: Name_Id
:= No_Name
;
1043 -- When this is not an empty list, this option, followed by the single
1044 -- name of the shared library file is used when linking a shared
1047 Separate_Run_Path_Options
: Boolean := False;
1048 -- True if each directory needs to be specified in a separate run path
1051 Executable_Suffix
: Name_Id
:= No_Name
;
1052 -- The suffix of executables, when specified in the configuration or in
1053 -- package Builder of the main project. When this is not specified, the
1054 -- executable suffix is the default for the platform.
1058 Linker
: Path_Name_Type
:= No_Path
;
1059 -- Path name of the linker driver. Specified in the configuration or in
1060 -- the package Builder of the main project.
1062 Map_File_Option
: Name_Id
:= No_Name
;
1063 -- Option to use when invoking the linker to build a map file
1065 Trailing_Linker_Required_Switches
: Name_List_Index
:= No_Name_List
;
1066 -- The minimum options for the linker driver. Specified in the
1069 Linker_Executable_Option
: Name_List_Index
:= No_Name_List
;
1070 -- The option(s) to indicate the name of the executable in the linker
1071 -- command. Specified in the configuration. When not specified, default
1072 -- to -o <executable name>.
1074 Linker_Lib_Dir_Option
: Name_Id
:= No_Name
;
1075 -- The option to specify where to find a library for linking. Specified
1076 -- in the configuration. When not specified, defaults to "-L".
1078 Linker_Lib_Name_Option
: Name_Id
:= No_Name
;
1079 -- The option to specify the name of a library for linking. Specified in
1080 -- the configuration. When not specified, defaults to "-l".
1082 Max_Command_Line_Length
: Natural := 0;
1083 -- When positive and when Resp_File_Format (see below) is not None,
1084 -- if the command line for the invocation of the linker would be greater
1085 -- than this value, a response file is used to invoke the linker.
1087 Resp_File_Format
: Response_File_Format
:= None
;
1088 -- The format of a response file, when linking with a response file is
1091 Resp_File_Options
: Name_List_Index
:= No_Name_List
;
1092 -- The switches, if any, that precede the path name of the response
1093 -- file in the invocation of the linker.
1097 Library_Builder
: Path_Name_Type
:= No_Path
;
1098 -- The executable to build library (specified in the configuration)
1100 Lib_Support
: Library_Support
:= None
;
1101 -- The level of library support. Specified in the configuration. Support
1102 -- is none, static libraries only or both static and shared libraries.
1104 Lib_Encapsulated_Supported
: Boolean := False;
1105 -- True when building fully standalone libraries supported on the target
1107 Archive_Builder
: Name_List_Index
:= No_Name_List
;
1108 -- The name of the executable to build archives, with the minimum
1109 -- switches. Specified in the configuration.
1111 Archive_Builder_Append_Option
: Name_List_Index
:= No_Name_List
;
1112 -- The options to append object files to an archive
1114 Archive_Indexer
: Name_List_Index
:= No_Name_List
;
1115 -- The name of the executable to index archives, with the minimum
1116 -- switches. Specified in the configuration.
1118 Archive_Suffix
: File_Name_Type
:= No_File
;
1119 -- The suffix of archives. Specified in the configuration. When not
1120 -- specified, defaults to ".a".
1122 Lib_Partial_Linker
: Name_List_Index
:= No_Name_List
;
1126 Shared_Lib_Driver
: File_Name_Type
:= No_File
;
1127 -- The driver to link shared libraries. Set with attribute Library_GCC.
1130 Shared_Lib_Prefix
: File_Name_Type
:= No_File
;
1131 -- Part of a shared library file name that precedes the name of the
1132 -- library. Specified in the configuration. When not specified, defaults
1135 Shared_Lib_Suffix
: File_Name_Type
:= No_File
;
1136 -- Suffix of shared libraries, after the library name in the shared
1137 -- library name. Specified in the configuration. When not specified,
1138 -- default to ".so".
1140 Shared_Lib_Min_Options
: Name_List_Index
:= No_Name_List
;
1141 -- The minimum options to use when building a shared library
1143 Lib_Version_Options
: Name_List_Index
:= No_Name_List
;
1144 -- The options to use to specify a library version
1146 Symbolic_Link_Supported
: Boolean := False;
1147 -- True if the platform supports symbolic link files
1149 Lib_Maj_Min_Id_Supported
: Boolean := False;
1150 -- True if platform supports library major and minor options, such as
1151 -- libname.so -> libname.so.2 -> libname.so.2.4
1153 Auto_Init_Supported
: Boolean := False;
1154 -- True if automatic initialisation is supported for shared stand-alone
1159 Artifacts_In_Exec_Dir
: Name_List_Index
:= No_Name_List
;
1160 -- List of regexp file names to be cleaned in the exec directory of the
1163 Artifacts_In_Object_Dir
: Name_List_Index
:= No_Name_List
;
1164 -- List of regexp file names to be cleaned in the object directory of
1169 Default_Project_Config
: constant Project_Configuration
:=
1171 Run_Path_Option
=> No_Name_List
,
1172 Run_Path_Origin
=> No_Name
,
1173 Library_Install_Name_Option
=> No_Name
,
1174 Separate_Run_Path_Options
=> False,
1175 Executable_Suffix
=> No_Name
,
1177 Map_File_Option
=> No_Name
,
1178 Trailing_Linker_Required_Switches
=>
1180 Linker_Executable_Option
=> No_Name_List
,
1181 Linker_Lib_Dir_Option
=> No_Name
,
1182 Linker_Lib_Name_Option
=> No_Name
,
1183 Library_Builder
=> No_Path
,
1184 Max_Command_Line_Length
=> 0,
1185 Resp_File_Format
=> None
,
1186 Resp_File_Options
=> No_Name_List
,
1187 Lib_Support
=> None
,
1188 Lib_Encapsulated_Supported
=> False,
1189 Archive_Builder
=> No_Name_List
,
1190 Archive_Builder_Append_Option
=> No_Name_List
,
1191 Archive_Indexer
=> No_Name_List
,
1192 Archive_Suffix
=> No_File
,
1193 Lib_Partial_Linker
=> No_Name_List
,
1194 Shared_Lib_Driver
=> No_File
,
1195 Shared_Lib_Prefix
=> No_File
,
1196 Shared_Lib_Suffix
=> No_File
,
1197 Shared_Lib_Min_Options
=> No_Name_List
,
1198 Lib_Version_Options
=> No_Name_List
,
1199 Symbolic_Link_Supported
=> False,
1200 Lib_Maj_Min_Id_Supported
=> False,
1201 Auto_Init_Supported
=> False,
1202 Artifacts_In_Exec_Dir
=> No_Name_List
,
1203 Artifacts_In_Object_Dir
=> No_Name_List
);
1205 -------------------------
1206 -- Aggregated projects --
1207 -------------------------
1209 type Aggregated_Project
;
1210 type Aggregated_Project_List
is access all Aggregated_Project
;
1211 type Aggregated_Project
is record
1212 Path
: Path_Name_Type
;
1213 Tree
: Project_Tree_Ref
;
1214 Project
: Project_Id
;
1215 Next
: Aggregated_Project_List
;
1218 procedure Free
(List
: in out Aggregated_Project_List
);
1219 -- Free the memory used for List
1221 procedure Add_Aggregated_Project
1222 (Project
: Project_Id
;
1223 Path
: Path_Name_Type
);
1224 -- Add a new aggregated project in Project.
1225 -- The aggregated project has not been processed yet. This procedure should
1226 -- the called while processing the aggregate project, and as a result
1227 -- Prj.Proc.Process will then automatically process the aggregated projects
1233 -- The following record describes a project file representation
1235 pragma Warnings
(Off
);
1239 -- The following clash with Standard is OK, and justified by the context
1240 -- which really wants to use the same set of qualifiers.
1245 pragma Warnings
(On
);
1247 type Project_Data
(Qualifier
: Project_Qualifier
:= Unspecified
) is record
1253 Name
: Name_Id
:= No_Name
;
1254 -- The name of the project
1256 Display_Name
: Name_Id
:= No_Name
;
1257 -- The name of the project with the spelling of its declaration
1259 Externally_Built
: Boolean := False;
1260 -- True if the project is externally built. In such case, the Project
1261 -- Manager will not modify anything in this project.
1263 Config
: Project_Configuration
;
1265 Path
: Path_Information
:= No_Path_Information
;
1266 -- The path name of the project file. This include base name of the
1269 Virtual
: Boolean := False;
1270 -- True for virtual extending projects
1272 Location
: Source_Ptr
:= No_Location
;
1273 -- The location in the project file source of the project name that
1274 -- immediately follows the reserved word "project".
1280 Languages
: Language_Ptr
:= No_Language_Index
;
1281 -- First index of the language data in the project. Traversing the list
1282 -- gives access to all the languages supported by the project.
1288 Mains
: String_List_Id
:= Nil_String
;
1289 -- List of mains specified by attribute Main
1291 Extends
: Project_Id
:= No_Project
;
1292 -- The reference of the project file, if any, that this project file
1295 Extended_By
: Project_Id
:= No_Project
;
1296 -- The reference of the project file, if any, that extends this project
1299 Decl
: Declarations
:= No_Declarations
;
1300 -- The declarations (variables, attributes and packages) of this project
1303 Imported_Projects
: Project_List
:= null;
1304 -- The list of all directly imported projects, if any
1306 All_Imported_Projects
: Project_List
:= null;
1307 -- The list of all projects imported directly or indirectly, if any.
1308 -- This does not include the project itself.
1314 Directory
: Path_Information
:= No_Path_Information
;
1315 -- Path name of the directory where the project file resides
1317 Object_Directory
: Path_Information
:= No_Path_Information
;
1318 -- The path name of the object directory of this project file
1320 Exec_Directory
: Path_Information
:= No_Path_Information
;
1321 -- The path name of the exec directory of this project file. Default is
1322 -- equal to Object_Directory.
1324 Object_Path_File
: Path_Name_Type
:= No_Path
;
1325 -- Store the name of the temporary file that contains the list of object
1326 -- directories, when attribute Object_Path_Switches is declared.
1332 Library
: Boolean := False;
1333 -- True if this is a library project
1335 Library_Name
: Name_Id
:= No_Name
;
1336 -- If a library project, name of the library
1338 Library_Kind
: Lib_Kind
:= Static
;
1339 -- If a library project, kind of library
1341 Library_Dir
: Path_Information
:= No_Path_Information
;
1342 -- If a library project, path name of the directory where the library
1345 Library_TS
: Time_Stamp_Type
:= Empty_Time_Stamp
;
1346 -- The timestamp of a library file in a library project
1348 Library_Src_Dir
: Path_Information
:= No_Path_Information
;
1349 -- If a Stand-Alone Library project, path name of the directory where
1350 -- the sources of the interfaces of the library are copied. By default,
1351 -- if attribute Library_Src_Dir is not specified, sources of the
1352 -- interfaces are not copied anywhere.
1354 Library_ALI_Dir
: Path_Information
:= No_Path_Information
;
1355 -- In a library project, path name of the directory where the ALI files
1356 -- are copied. If attribute Library_ALI_Dir is not specified, ALI files
1357 -- are copied in the Library_Dir.
1359 Lib_Internal_Name
: Name_Id
:= No_Name
;
1360 -- If a library project, internal name store inside the library
1362 Standalone_Library
: Standalone
:= No
;
1363 -- Indicate that this is a Standalone Library Project File
1365 Lib_Interface_ALIs
: String_List_Id
:= Nil_String
;
1366 -- For Standalone Library Project Files, list of Interface ALI files
1368 Other_Interfaces
: String_List_Id
:= Nil_String
;
1369 -- List of non unit based sources in attribute Interfaces
1371 Lib_Auto_Init
: Boolean := False;
1372 -- For non static Stand-Alone Library Project Files, True if the library
1373 -- initialisation should be automatic.
1375 Symbol_Data
: Symbol_Record
:= No_Symbols
;
1376 -- Symbol file name, reference symbol file name, symbol policy
1378 Need_To_Build_Lib
: Boolean := False;
1379 -- True if the library of a Library Project needs to be built or rebuilt
1384 -- The sources for all languages including Ada are accessible through
1385 -- the Source_Iterator type
1387 Interfaces_Defined
: Boolean := False;
1388 -- True if attribute Interfaces is declared for the project or any
1389 -- project it extends.
1391 Include_Path_File
: Path_Name_Type
:= No_Path
;
1392 -- The path name of the of the source search directory file.
1393 -- This is only used by gnatmake
1395 Source_Dirs
: String_List_Id
:= Nil_String
;
1396 -- The list of all the source directories
1398 Source_Dir_Ranks
: Number_List_Index
:= No_Number_List
;
1400 Ada_Include_Path
: String_Access
:= null;
1401 -- The cached value of source search path for this project file. Set by
1402 -- the first call to Prj.Env.Ada_Include_Path for the project. Do not
1403 -- use this field directly outside of the project manager, use
1404 -- Prj.Env.Ada_Include_Path instead.
1406 Has_Multi_Unit_Sources
: Boolean := False;
1407 -- Whether there is at least one source file containing multiple units
1413 Ada_Objects_Path
: String_Access
:= null;
1414 -- The cached value of ADA_OBJECTS_PATH for this project file, with
1415 -- library ALI directories for library projects instead of object
1416 -- directories. Do not use this field directly outside of the
1417 -- compiler, use Prj.Env.Ada_Objects_Path instead.
1419 Ada_Objects_Path_No_Libs
: String_Access
:= null;
1420 -- The cached value of ADA_OBJECTS_PATH for this project file with all
1421 -- object directories (no library ALI dir for library projects).
1423 Libgnarl_Needed
: Yes_No_Unknown
:= Unknown
;
1424 -- Set to True when libgnarl is needed to link
1426 Objects_Path
: String_Access
:= null;
1427 -- The cached value of the object dir path, used during the binding
1428 -- phase of gprbuild.
1430 Objects_Path_File_With_Libs
: Path_Name_Type
:= No_Path
;
1431 -- The cached value of the object path temp file (including library
1432 -- dirs) for this project file.
1434 Objects_Path_File_Without_Libs
: Path_Name_Type
:= No_Path
;
1435 -- The cached value of the object path temp file (excluding library
1436 -- dirs) for this project file.
1438 Config_File_Name
: Path_Name_Type
:= No_Path
;
1439 -- The path name of the configuration pragmas file, if any
1441 Config_File_Temp
: Boolean := False;
1442 -- True if the configuration pragmas file is a temporary file that must
1443 -- be deleted at the end.
1445 Config_Checked
: Boolean := False;
1446 -- A flag to avoid checking repetitively the configuration pragmas file
1448 Depth
: Natural := 0;
1449 -- The maximum depth of a project in the project graph. Depth of main
1452 Unkept_Comments
: Boolean := False;
1453 -- True if there are comments in the project sources that cannot be kept
1454 -- in the project tree.
1456 -----------------------------
1457 -- Qualifier-Specific data --
1458 -----------------------------
1460 -- The following fields are only valid for specific types of projects
1463 when Aggregate | Aggregate_Library
=>
1464 Aggregated_Projects
: Aggregated_Project_List
:= null;
1465 -- List of aggregated projects (which could themselves be
1466 -- aggregate projects).
1473 function Empty_Project
(Qualifier
: Project_Qualifier
) return Project_Data
;
1474 -- Return the representation of an empty project
1476 function Is_Extending
1477 (Extending
: Project_Id
;
1478 Extended
: Project_Id
) return Boolean;
1479 -- Return True if Extending is extending the Extended project
1482 (Extending
: Project_Id
;
1483 Extended
: Project_Id
) return Boolean renames Is_Extending
;
1485 function Has_Ada_Sources
(Data
: Project_Id
) return Boolean;
1486 -- Return True if the project has Ada sources
1488 Project_Error
: exception;
1489 -- Raised by some subprograms in Prj.Attr
1491 package Units_Htable
is new Simple_HTable
1492 (Header_Num
=> Header_Num
,
1493 Element
=> Unit_Index
,
1494 No_Element
=> No_Unit_Index
,
1498 -- Mapping of unit names to indexes in the Units table
1500 ---------------------
1501 -- Source_Iterator --
1502 ---------------------
1504 type Source_Iterator
is private;
1506 function For_Each_Source
1507 (In_Tree
: Project_Tree_Ref
;
1508 Project
: Project_Id
:= No_Project
;
1509 Language
: Name_Id
:= No_Name
;
1510 Encapsulated_Libs
: Boolean := True;
1511 Locally_Removed
: Boolean := True) return Source_Iterator
;
1512 -- Returns an iterator for all the sources of a project tree, or a specific
1513 -- project, or a specific language. Include sources from aggregated libs if
1514 -- Aggregated_Libs is True. If Locally_Removed is set to False the
1515 -- Locally_Removed files won't be reported.
1517 function Element
(Iter
: Source_Iterator
) return Source_Id
;
1518 -- Return the current source (or No_Source if there are no more sources)
1520 procedure Next
(Iter
: in out Source_Iterator
);
1521 -- Move on to the next source
1523 function Find_Source
1524 (In_Tree
: Project_Tree_Ref
;
1525 Project
: Project_Id
;
1526 In_Imported_Only
: Boolean := False;
1527 In_Extended_Only
: Boolean := False;
1528 Base_Name
: File_Name_Type
;
1529 Index
: Int
:= 0) return Source_Id
;
1530 -- Find the first source file with the given name.
1531 -- If In_Extended_Only is True, it will search in project and the project
1532 -- it extends, but not in the imported projects.
1533 -- Elsif In_Imported_Only is True, it will search in project and the
1534 -- projects it imports, but not in the others or in aggregated projects.
1535 -- Else it searches in the whole tree.
1536 -- If Index is specified, this only search for a source with that index.
1538 type Source_Ids
is array (Positive range <>) of Source_Id
;
1539 No_Sources
: constant Source_Ids
:= (1 .. 0 => No_Source
);
1541 function Find_All_Sources
1542 (In_Tree
: Project_Tree_Ref
;
1543 Project
: Project_Id
;
1544 In_Imported_Only
: Boolean := False;
1545 In_Extended_Only
: Boolean := False;
1546 Base_Name
: File_Name_Type
;
1547 Index
: Int
:= 0) return Source_Ids
;
1548 -- Find all source files with the given name:
1550 -- If In_Extended_Only is True, it will search in project and the project
1551 -- it extends, but not in the imported projects.
1553 -- If Extended_Only is False, and In_Imported_Only is True, it will
1554 -- search in project and the projects it imports, but not in the others
1555 -- or in aggregated projects.
1557 -- If both Extended_Only and In_Imported_Only are False (the default)
1558 -- then it searches the whole tree.
1560 -- If Index is specified, this only search for sources with that index.
1562 -----------------------
1563 -- Project_Tree_Data --
1564 -----------------------
1566 package Replaced_Source_HTable
is new Simple_HTable
1567 (Header_Num
=> Header_Num
,
1568 Element
=> File_Name_Type
,
1569 No_Element
=> No_File
,
1570 Key
=> File_Name_Type
,
1574 type Private_Project_Tree_Data
is private;
1575 -- Data for a project tree that is used only by the Project Manager
1577 type Shared_Project_Tree_Data
is record
1578 Name_Lists
: Name_List_Table
.Instance
;
1579 Number_Lists
: Number_List_Table
.Instance
;
1580 String_Elements
: String_Element_Table
.Instance
;
1581 Variable_Elements
: Variable_Element_Table
.Instance
;
1582 Array_Elements
: Array_Element_Table
.Instance
;
1583 Arrays
: Array_Table
.Instance
;
1584 Packages
: Package_Table
.Instance
;
1585 Private_Part
: Private_Project_Tree_Data
;
1586 Dot_String_List
: String_List_Id
:= Nil_String
;
1588 type Shared_Project_Tree_Data_Access
is access all Shared_Project_Tree_Data
;
1589 -- The data that is shared among multiple trees, when these trees are
1590 -- loaded through the same aggregate project.
1591 -- To avoid ambiguities, limit the number of parameters to the
1592 -- subprograms (we would have to parse the "root project tree" since this
1593 -- is where the configuration file was loaded, in addition to the project's
1594 -- own tree) and make the comparison of projects easier, all trees store
1595 -- the lists in the same tables.
1597 type Project_Tree_Appdata
is tagged null record;
1598 type Project_Tree_Appdata_Access
is access all Project_Tree_Appdata
'Class;
1599 -- Application-specific data that can be associated with a project tree.
1600 -- We do not make the Project_Tree_Data itself tagged for several reasons:
1601 -- - it couldn't have a default value for its discriminant
1602 -- - it would require a "factory" to allocate such data, because trees
1603 -- are created automatically when parsing aggregate projects.
1605 procedure Free
(Tree
: in out Project_Tree_Appdata
);
1606 -- Should be overridden if your derive your own data
1608 type Project_Tree_Data
(Is_Root_Tree
: Boolean := True) is record
1609 -- The root tree is the one loaded by the user from the command line.
1610 -- Is_Root_Tree is only false for projects aggregated within a root
1611 -- aggregate project.
1613 Projects
: Project_List
;
1614 -- List of projects in this tree
1616 Replaced_Sources
: Replaced_Source_HTable
.Instance
;
1617 -- The list of sources that have been replaced by sources with
1618 -- different file names.
1620 Replaced_Source_Number
: Natural := 0;
1621 -- The number of entries in Replaced_Sources
1623 Units_HT
: Units_Htable
.Instance
;
1624 -- Unit name to Unit_Index (and from there to Source_Id)
1626 Source_Files_HT
: Source_Files_Htable
.Instance
;
1627 -- Base source file names to Source_Id list
1629 Source_Paths_HT
: Source_Paths_Htable
.Instance
;
1630 -- Full path to Source_Id
1631 -- ??? What is behavior for multi-unit source files, where there are
1632 -- several source_id per file ?
1634 Source_Info_File_Name
: String_Access
:= null;
1635 -- The name of the source info file, if specified by the builder
1637 Source_Info_File_Exists
: Boolean := False;
1638 -- True when a source info file has been successfully read
1640 Shared
: Shared_Project_Tree_Data_Access
;
1641 -- The shared data for this tree and all aggregated trees
1643 Appdata
: Project_Tree_Appdata_Access
;
1644 -- Application-specific data for this tree
1646 case Is_Root_Tree
is
1648 Shared_Data
: aliased Shared_Project_Tree_Data
;
1649 -- Do not access directly, only through Shared
1655 -- Data for a project tree
1657 function Debug_Name
(Tree
: Project_Tree_Ref
) return Name_Id
;
1658 -- If debug traces are activated, return an identitier for the project
1659 -- tree. This modifies Name_Buffer.
1661 procedure Expect
(The_Token
: Token_Type
; Token_Image
: String);
1662 -- Check that the current token is The_Token. If it is not, then output
1663 -- an error message.
1665 procedure Initialize
(Tree
: Project_Tree_Ref
);
1666 -- This procedure must be called before using any services from the Prj
1667 -- hierarchy. Namet.Initialize must be called before Prj.Initialize.
1669 procedure Reset
(Tree
: Project_Tree_Ref
);
1670 -- This procedure resets all the tables that are used when processing a
1671 -- project file tree. Initialize must be called before the call to Reset.
1673 package Project_Boolean_Htable
is new Simple_HTable
1674 (Header_Num
=> Header_Num
,
1676 No_Element
=> False,
1680 -- A table that associates a project to a boolean. This is used to detect
1681 -- whether a project was already processed for instance.
1684 with procedure Action
(Project
: Project_Id
; Tree
: Project_Tree_Ref
);
1685 procedure For_Project_And_Aggregated
1686 (Root_Project
: Project_Id
;
1687 Root_Tree
: Project_Tree_Ref
);
1688 -- Execute Action for Root_Project and all its aggregated projects
1692 type State
is limited private;
1693 with procedure Action
1694 (Project
: Project_Id
;
1695 Tree
: Project_Tree_Ref
;
1696 With_State
: in out State
);
1697 procedure For_Every_Project_Imported
1699 Tree
: Project_Tree_Ref
;
1700 With_State
: in out State
;
1701 Include_Aggregated
: Boolean := True;
1702 Imported_First
: Boolean := False);
1703 -- Call Action for each project imported directly or indirectly by project
1704 -- By, as well as extended projects.
1706 -- The order of processing depends on Imported_First:
1708 -- If False, Action is called according to the order of importation: if A
1709 -- imports B, directly or indirectly, Action will be called for A before
1710 -- it is called for B. If two projects import each other directly or
1711 -- indirectly (using at least one "limited with"), it is not specified
1712 -- for which of these two projects Action will be called first.
1714 -- The order is reversed if Imported_First is True
1716 -- With_State may be used by Action to choose a behavior or to report some
1719 -- If Include_Aggregated is True, then an aggregate project will recurse
1720 -- into the projects it aggregates. Otherwise, the latter are never
1723 -- In_Aggregate_Lib is True if the project is in an aggregate library
1725 -- The Tree argument passed to the callback is required in the case of
1726 -- aggregated projects, since they might not be using the same tree as 'By'
1728 type Project_Context
is record
1729 In_Aggregate_Lib
: Boolean;
1730 -- True if the project is part of an aggregate library
1732 From_Encapsulated_Lib
: Boolean;
1733 -- True if the project is imported from an encapsulated library
1737 type State
is limited private;
1738 with procedure Action
1739 (Project
: Project_Id
;
1740 Tree
: Project_Tree_Ref
;
1741 Context
: Project_Context
;
1742 With_State
: in out State
);
1743 procedure For_Every_Project_Imported_Context
1745 Tree
: Project_Tree_Ref
;
1746 With_State
: in out State
;
1747 Include_Aggregated
: Boolean := True;
1748 Imported_First
: Boolean := False);
1749 -- As for For_Every_Project_Imported but with an associated context
1752 with procedure Action
1753 (Project
: Project_Id
;
1754 Tree
: Project_Tree_Ref
;
1755 Context
: Project_Context
);
1756 procedure For_Project_And_Aggregated_Context
1757 (Root_Project
: Project_Id
;
1758 Root_Tree
: Project_Tree_Ref
);
1759 -- As for For_Project_And_Aggregated but with an associated context
1761 function Extend_Name
1762 (File
: File_Name_Type
;
1763 With_Suffix
: String) return File_Name_Type
;
1764 -- Replace the extension of File with With_Suffix
1766 function Object_Name
1767 (Source_File_Name
: File_Name_Type
;
1768 Object_File_Suffix
: Name_Id
:= No_Name
) return File_Name_Type
;
1769 -- Returns the object file name corresponding to a source file name
1771 function Object_Name
1772 (Source_File_Name
: File_Name_Type
;
1774 Index_Separator
: Character;
1775 Object_File_Suffix
: Name_Id
:= No_Name
) return File_Name_Type
;
1776 -- Returns the object file name corresponding to a unit in a multi-source
1779 function Dependency_Name
1780 (Source_File_Name
: File_Name_Type
;
1781 Dependency
: Dependency_File_Kind
) return File_Name_Type
;
1782 -- Returns the dependency file name corresponding to a source file name
1784 function Switches_Name
1785 (Source_File_Name
: File_Name_Type
) return File_Name_Type
;
1786 -- Returns the switches file name corresponding to a source file name
1788 procedure Set_Path_File_Var
(Name
: String; Value
: String);
1789 -- Call Setenv, after calling To_Host_File_Spec
1791 function Current_Source_Path_File_Of
1792 (Shared
: Shared_Project_Tree_Data_Access
) return Path_Name_Type
;
1793 -- Get the current include path file name
1795 procedure Set_Current_Source_Path_File_Of
1796 (Shared
: Shared_Project_Tree_Data_Access
;
1797 To
: Path_Name_Type
);
1798 -- Record the current include path file name
1800 function Current_Object_Path_File_Of
1801 (Shared
: Shared_Project_Tree_Data_Access
) return Path_Name_Type
;
1802 -- Get the current object path file name
1804 procedure Set_Current_Object_Path_File_Of
1805 (Shared
: Shared_Project_Tree_Data_Access
;
1806 To
: Path_Name_Type
);
1807 -- Record the current object path file name
1813 type Processing_Flags
is private;
1814 -- Flags used while parsing and processing a project tree to configure the
1815 -- behavior of the parser, and indicate how to report error messages. This
1816 -- structure does not allocate memory and never needs to be freed
1818 type Error_Warning
is (Silent
, Warning
, Error
);
1819 -- Severity of some situations, such as: no Ada sources in a project where
1820 -- Ada is one of the language.
1822 -- When the situation occurs, the behaviour depends on the setting:
1824 -- - Silent: no action
1825 -- - Warning: issue a warning, does not cause the tool to fail
1826 -- - Error: issue an error, causes the tool to fail
1828 type Error_Handler
is access procedure
1829 (Project
: Project_Id
;
1830 Is_Warning
: Boolean);
1831 -- This warns when an error was found when parsing a project. The error
1832 -- itself is handled through Prj.Err (and Prj.Err.Finalize should be called
1833 -- to actually print the error). This ensures that duplicate error messages
1834 -- are always correctly removed, that errors msgs are sorted, and that all
1835 -- tools will report the same error to the user.
1837 function Create_Flags
1838 (Report_Error
: Error_Handler
;
1839 When_No_Sources
: Error_Warning
;
1840 Require_Sources_Other_Lang
: Boolean := True;
1841 Allow_Duplicate_Basenames
: Boolean := True;
1842 Compiler_Driver_Mandatory
: Boolean := False;
1843 Error_On_Unknown_Language
: Boolean := True;
1844 Require_Obj_Dirs
: Error_Warning
:= Error
;
1845 Allow_Invalid_External
: Error_Warning
:= Error
;
1846 Missing_Source_Files
: Error_Warning
:= Error
;
1847 Ignore_Missing_With
: Boolean := False)
1848 return Processing_Flags
;
1849 -- Function used to create Processing_Flags structure
1851 -- If Allow_Duplicate_Basenames, then files with the same base names are
1852 -- authorized within a project for source-based languages (never for unit
1853 -- based languages).
1855 -- If Compiler_Driver_Mandatory is true, then a Compiler.Driver attribute
1856 -- for each language must be defined, or we will not look for its source
1859 -- When_No_Sources indicates what should be done when no sources of a
1860 -- language are found in a project where this language is declared.
1861 -- If Require_Sources_Other_Lang is true, then all languages must have at
1862 -- least one source file, or an error is reported via When_No_Sources. If
1863 -- it is false, this is only required for Ada (and only if it is a language
1864 -- of the project). When this parameter is set to False, we do not check
1865 -- that a proper naming scheme is defined for languages other than Ada.
1867 -- If Report_Error is null, use the standard error reporting mechanism
1868 -- (Errout). Otherwise, report errors using Report_Error.
1870 -- If Error_On_Unknown_Language is true, an error is displayed if some of
1871 -- the source files listed in the project do not match any naming scheme
1873 -- If Require_Obj_Dirs is true, then all object directories must exist
1874 -- (possibly after they have been created automatically if the appropriate
1875 -- switches were specified), or an error is raised.
1877 -- If Allow_Invalid_External is Silent, then no error is reported when an
1878 -- invalid value is used for an external variable (and it doesn't match its
1879 -- type). Instead, the first possible value is used.
1881 -- Missing_Source_Files indicates whether it is an error or a warning that
1882 -- a source file mentioned in the Source_Files attributes is not actually
1883 -- found in the source directories. This also impacts errors for missing
1884 -- source directories.
1886 -- If Ignore_Missing_With is True, then a "with" statement that cannot be
1887 -- resolved will simply be ignored. However, in such a case, the flag
1888 -- Incomplete_With in the project tree will be set to True.
1889 -- This is meant for use by tools so that they can properly set the
1890 -- project path in such a case:
1891 -- * no "gnatls" found (so no default project path)
1892 -- * user project sets Project.IDE'gnatls attribute to a cross gnatls
1893 -- * user project also includes a "with" that can only be resolved
1894 -- once we have found the gnatls
1896 procedure Set_Ignore_Missing_With
1897 (Flags
: in out Processing_Flags
;
1899 -- Set the value of component Ignore_Missing_With in Flags to Value
1901 Gprbuild_Flags
: constant Processing_Flags
;
1902 Gprinstall_Flags
: constant Processing_Flags
;
1903 Gprclean_Flags
: constant Processing_Flags
;
1904 Gprexec_Flags
: constant Processing_Flags
;
1905 Gnatmake_Flags
: constant Processing_Flags
;
1906 -- Flags used by the various tools. They all display the error messages
1913 procedure Record_Temp_File
1914 (Shared
: Shared_Project_Tree_Data_Access
;
1915 Path
: Path_Name_Type
);
1916 -- Record the path of a newly created temporary file, so that it can be
1919 procedure Delete_All_Temp_Files
1920 (Shared
: Shared_Project_Tree_Data_Access
);
1921 -- Delete all recorded temporary files.
1922 -- Does nothing if Debug.Debug_Flag_N is set
1924 procedure Delete_Temp_Config_Files
(Project_Tree
: Project_Tree_Ref
);
1925 -- Delete all temporary config files. Does nothing if Debug.Debug_Flag_N is
1926 -- set or if Project_Tree is null. This initially came from gnatmake
1927 -- ??? Should this be combined with Delete_All_Temp_Files above
1929 procedure Delete_Temporary_File
1930 (Shared
: Shared_Project_Tree_Data_Access
:= null;
1931 Path
: Path_Name_Type
);
1932 -- Delete a temporary file from the disk. The file is also removed from the
1933 -- list of temporary files to delete at the end of the program, in case
1934 -- another program running on the same machine has recreated it. Does
1935 -- nothing if Debug.Debug_Flag_N is set
1937 Virtual_Prefix
: constant String := "v$";
1938 -- The prefix for virtual extending projects. Because of the '$', which is
1939 -- normally forbidden for project names, there cannot be any name clash.
1945 type Verbosity
is (Default
, Medium
, High
);
1946 pragma Ordered
(Verbosity
);
1947 -- Verbosity when parsing GNAT Project Files
1948 -- Default is default (very quiet, if no errors).
1949 -- Medium is more verbose.
1950 -- High is extremely verbose.
1952 Current_Verbosity
: Verbosity
:= Default
;
1953 -- The current value of the verbosity the project files are parsed with
1955 procedure Debug_Indent
;
1956 -- Inserts a series of blanks depending on the current indentation level
1958 procedure Debug_Output
(Str
: String);
1959 procedure Debug_Output
(Str
: String; Str2
: Name_Id
);
1960 -- If Current_Verbosity is not Default, outputs Str.
1961 -- This indents Str based on the current indentation level for traces
1962 -- Debug_Error is intended to be used to report an error in the traces.
1964 procedure Debug_Increase_Indent
1965 (Str
: String := ""; Str2
: Name_Id
:= No_Name
);
1966 procedure Debug_Decrease_Indent
(Str
: String := "");
1967 -- Increase or decrease the indentation level for debug traces. This
1968 -- indentation level only affects output done through Debug_Output.
1971 All_Packages
: constant String_List_Access
:= null;
1973 No_Project_Tree
: constant Project_Tree_Ref
:= null;
1975 Ignored
: constant Variable_Kind
:= Single
;
1977 Nil_Variable_Value
: constant Variable_Value
:=
1978 (Project
=> No_Project
,
1980 Location
=> No_Location
,
1983 type Source_Iterator
is record
1984 In_Tree
: Project_Tree_Ref
;
1986 Project
: Project_List
;
1987 All_Projects
: Boolean;
1988 -- Current project and whether we should move on to the next
1990 Language
: Language_Ptr
;
1991 -- Current language processed
1993 Language_Name
: Name_Id
;
1994 -- Only sources of this language will be returned (or all if No_Name)
1996 Current
: Source_Id
;
1998 Encapsulated_Libs
: Boolean;
1999 -- True if we want to include the sources from encapsulated libs
2001 Locally_Removed
: Boolean;
2004 procedure Add_To_Buffer
2006 To
: in out String_Access
;
2007 Last
: in out Natural);
2008 -- Append a String to the Buffer
2010 -- Table used to store the path name of all the created temporary files, so
2011 -- that they can be deleted at the end, or when the program is interrupted.
2013 package Temp_Files_Table
is new GNAT
.Dynamic_Tables
2014 (Table_Component_Type
=> Path_Name_Type
,
2015 Table_Index_Type
=> Integer,
2016 Table_Low_Bound
=> 1,
2017 Table_Initial
=> 10,
2018 Table_Increment
=> 10);
2020 -- The following type is used to represent the part of a project tree which
2021 -- is private to the Project Manager.
2023 type Private_Project_Tree_Data
is record
2024 Temp_Files
: Temp_Files_Table
.Instance
;
2025 -- Temporary files created as part of running tools (pragma files,
2026 -- mapping files,...)
2028 Current_Source_Path_File
: Path_Name_Type
:= No_Path
;
2029 -- Current value of project source path file env var. Used to avoid
2030 -- setting the env var to the same value. When different from No_Path,
2031 -- this indicates that environment variables were created and should be
2032 -- deassigned to avoid polluting the environment. For gnatmake only.
2034 Current_Object_Path_File
: Path_Name_Type
:= No_Path
;
2035 -- Current value of project object path file env var. Used to avoid
2036 -- setting the env var to the same value.
2040 -- The following type is used to hold processing flags which show what
2041 -- functions are required for the various tools that are handled.
2043 type Processing_Flags
is record
2044 Require_Sources_Other_Lang
: Boolean;
2045 Report_Error
: Error_Handler
;
2046 When_No_Sources
: Error_Warning
;
2047 Allow_Duplicate_Basenames
: Boolean;
2048 Compiler_Driver_Mandatory
: Boolean;
2049 Error_On_Unknown_Language
: Boolean;
2050 Require_Obj_Dirs
: Error_Warning
;
2051 Allow_Invalid_External
: Error_Warning
;
2052 Missing_Source_Files
: Error_Warning
;
2053 Ignore_Missing_With
: Boolean;
2055 Incomplete_Withs
: Boolean := False;
2056 -- This flag is set to True when the projects are parsed while ignoring
2057 -- missing withed project and some withed projects are not found.
2061 Gprbuild_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
=> Error
,
2069 Allow_Invalid_External
=> Error
,
2070 Missing_Source_Files
=> Error
,
2071 Ignore_Missing_With
=> False,
2072 Incomplete_Withs
=> False);
2074 Gprinstall_Flags
: constant Processing_Flags
:=
2075 (Report_Error
=> null,
2076 When_No_Sources
=> Warning
,
2077 Require_Sources_Other_Lang
=> True,
2078 Allow_Duplicate_Basenames
=> False,
2079 Compiler_Driver_Mandatory
=> True,
2080 Error_On_Unknown_Language
=> True,
2081 Require_Obj_Dirs
=> Silent
,
2082 Allow_Invalid_External
=> Error
,
2083 Missing_Source_Files
=> Error
,
2084 Ignore_Missing_With
=> False,
2085 Incomplete_Withs
=> False);
2087 Gprclean_Flags
: constant Processing_Flags
:=
2088 (Report_Error
=> null,
2089 When_No_Sources
=> Warning
,
2090 Require_Sources_Other_Lang
=> True,
2091 Allow_Duplicate_Basenames
=> False,
2092 Compiler_Driver_Mandatory
=> True,
2093 Error_On_Unknown_Language
=> True,
2094 Require_Obj_Dirs
=> Warning
,
2095 Allow_Invalid_External
=> Error
,
2096 Missing_Source_Files
=> Error
,
2097 Ignore_Missing_With
=> False,
2098 Incomplete_Withs
=> False);
2100 Gprexec_Flags
: constant Processing_Flags
:=
2101 (Report_Error
=> null,
2102 When_No_Sources
=> Silent
,
2103 Require_Sources_Other_Lang
=> False,
2104 Allow_Duplicate_Basenames
=> False,
2105 Compiler_Driver_Mandatory
=> False,
2106 Error_On_Unknown_Language
=> True,
2107 Require_Obj_Dirs
=> Silent
,
2108 Allow_Invalid_External
=> Error
,
2109 Missing_Source_Files
=> Silent
,
2110 Ignore_Missing_With
=> False,
2111 Incomplete_Withs
=> False);
2113 Gnatmake_Flags
: constant Processing_Flags
:=
2114 (Report_Error
=> null,
2115 When_No_Sources
=> Error
,
2116 Require_Sources_Other_Lang
=> False,
2117 Allow_Duplicate_Basenames
=> False,
2118 Compiler_Driver_Mandatory
=> False,
2119 Error_On_Unknown_Language
=> False,
2120 Require_Obj_Dirs
=> Error
,
2121 Allow_Invalid_External
=> Error
,
2122 Missing_Source_Files
=> Error
,
2123 Ignore_Missing_With
=> False,
2124 Incomplete_Withs
=> False);