X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fada%2Fprj.ads;h=353138d2dafe9a2b8837e195867a25fcd6712d29;hb=20d2f5309ee374943308566fa4f174cd3312853b;hp=10d023b8e6599be084cb0b3c7ac6c6f6560ad0f1;hpb=54f039539f708da93031b67807af1700d3d1bc6f;p=pf3gnuchains%2Fgcc-fork.git
diff --git a/gcc/ada/prj.ads b/gcc/ada/prj.ads
index 10d023b8e65..353138d2daf 100644
--- a/gcc/ada/prj.ads
+++ b/gcc/ada/prj.ads
@@ -31,6 +31,7 @@
with Casing; use Casing;
with Namet; use Namet;
+with Osint;
with Scans; use Scans;
with Types; use Types;
@@ -44,10 +45,6 @@ package Prj is
-- Name used to replace others as an index of an associative array
-- attribute in situations where this is allowed.
- Subdirs_Option : constant String := "--subdirs=";
- -- Switch used to indicate that the real directories (object, exec,
- -- library, ...) are subdirectories of those in the project file.
-
Subdirs : String_Ptr := null;
-- The value after the equal sign in switch --subdirs=...
-- Contains the relative subdirectory.
@@ -63,14 +60,11 @@ package Prj is
type Yes_No_Unknown is (Yes, No, Unknown);
-- Tri-state to decide if -lgnarl is needed when linking
- type Mode is (Multi_Language, Ada_Only);
- -- Ada_Only: mode for gnatmake, gnatclean, gnatname, the GNAT driver
- -- Multi_Language: mode for gprbuild, gprclean
-
type Project_Qualifier is
(Unspecified,
Standard,
Library,
+ Configuration,
Dry,
Aggregate,
Aggregate_Library);
@@ -81,29 +75,7 @@ package Prj is
-- Dry: abstract project is
-- Aggregate: aggregate project is
-- Aggregate_Library: aggregate library project is ...
-
- function Get_Mode return Mode;
- pragma Inline (Get_Mode);
-
- procedure Set_Mode (New_Mode : Mode);
- pragma Inline (Set_Mode);
-
- Default_Language_Is_Ada : Boolean := True;
- -- If no language was defined in the project or the configuration file, it
- -- is an error, unless this variable is True, in which case it defaults to
- -- Ada. Calling Set_Mode will reset this variable, default is for Ada_Only.
-
- Must_Check_Configuration : Boolean := False;
- -- True when the contents of the configuration file must be checked. This
- -- is in general only needed by gprbuild itself, since other applications
- -- can ignore such errors when they don't need to build directly. Calling
- -- Set_Mode will reset this variable, default is for Ada_Only.
-
- function In_Configuration return Boolean;
- pragma Inline (In_Configuration);
-
- procedure Set_In_Configuration (Value : Boolean);
- pragma Inline (Set_In_Configuration);
+ -- Configuration: configuration project is ...
All_Packages : constant String_List_Access;
-- Default value of parameter Packages of procedures Parse, in Prj.Pars and
@@ -119,36 +91,12 @@ package Prj is
procedure Free (Tree : in out Project_Tree_Ref);
-- Free memory associated with the tree
- function Default_Ada_Spec_Suffix return File_Name_Type;
- pragma Inline (Default_Ada_Spec_Suffix);
- -- The name for the standard GNAT suffix for Ada spec source file name
- -- ".ads". Initialized by Prj.Initialize.
-
- function Default_Ada_Body_Suffix return File_Name_Type;
- pragma Inline (Default_Ada_Body_Suffix);
- -- The name for the standard GNAT suffix for Ada body source file name
- -- ".adb". Initialized by Prj.Initialize.
-
- function Slash return Path_Name_Type;
- pragma Inline (Slash);
- -- "/", used as the path of locally removed files
-
Config_Project_File_Extension : String := ".cgpr";
Project_File_Extension : String := ".gpr";
-- The standard config and user project file name extensions. They are not
-- constants, because Canonical_Case_File_Name is called on these variables
-- in the body of Prj.
- type Error_Warning is (Silent, Warning, Error);
- -- Severity of some situations, such as: no Ada sources in a project where
- -- Ada is one of the language.
- --
- -- When the situation occurs, the behaviour depends on the setting:
- --
- -- - Silent: no action
- -- - Warning: issue a warning, does not cause the tool to fail
- -- - Error: issue an error, causes the tool to fail
-
function Empty_File return File_Name_Type;
function Empty_String return Name_Id;
-- Return the id for an empty string ""
@@ -157,11 +105,13 @@ package Prj is
Name : Path_Name_Type := No_Path;
Display_Name : Path_Name_Type := No_Path;
end record;
+ -- Directory names always end with a directory separator
No_Path_Information : constant Path_Information := (No_Path, No_Path);
- type Project_Id is new Nat;
- No_Project : constant Project_Id := 0;
+ type Project_Data;
+ type Project_Id is access all Project_Data;
+ No_Project : constant Project_Id := null;
-- Id of a Project File
type String_List_Id is new Nat;
@@ -211,7 +161,7 @@ package Prj is
end case;
end record;
-- Values for variables and array elements. Default is True if the
- -- current value is the default one for the variable
+ -- current value is the default one for the variable.
Nil_Variable_Value : constant Variable_Value;
-- Value of a non existing variable or array element
@@ -307,16 +257,18 @@ package Prj is
Table_Increment => 100);
-- The table that contains all packages
- type Language_Index is new Nat;
+ type Language_Data;
+ type Language_Ptr is access all Language_Data;
-- Index of language data
- No_Language_Index : constant Language_Index := 0;
+ No_Language_Index : constant Language_Ptr := null;
-- Constant indicating that there is no language data
- procedure Display_Language_Name
- (In_Tree : Project_Tree_Ref;
- Language : Language_Index);
- -- Output the name of a language
+ function Get_Language_From_Name
+ (Project : Project_Id;
+ Name : String) return Language_Ptr;
+ -- Get a language from a project. This might return null if no such
+ -- language exists in the project
Max_Header_Num : constant := 6150;
type Header_Num is range 0 .. Max_Header_Num;
@@ -327,10 +279,8 @@ package Prj is
function Hash (Name : Name_Id) return Header_Num;
function Hash (Name : File_Name_Type) return Header_Num;
function Hash (Name : Path_Name_Type) return Header_Num;
- -- Used for computing hash values for names put into above hash table
-
- function Hash (Project : Project_Id) return Header_Num;
- -- Used for hash tables where Project_Id is the Key
+ function Hash (Project : Project_Id) return Header_Num;
+ -- Used for computing hash values for names put into hash tables
type Language_Kind is (File_Based, Unit_Based);
-- Type for the kind of language. All languages are file based, except Ada
@@ -365,7 +315,28 @@ package Prj is
Table_Low_Bound => 1,
Table_Initial => 10,
Table_Increment => 100);
- -- The table for lists of names used in package Language_Processing
+ -- The table for lists of names
+
+ function Length
+ (Table : Name_List_Table.Instance;
+ List : Name_List_Index) return Natural;
+ -- Return the number of elements in specified list
+
+ type Number_List_Index is new Nat;
+ No_Number_List : constant Number_List_Index := 0;
+
+ type Number_Node is record
+ Number : Natural := 0;
+ Next : Number_List_Index := No_Number_List;
+ end record;
+
+ package Number_List_Table is new GNAT.Dynamic_Tables
+ (Table_Component_Type => Number_Node,
+ Table_Index_Type => Number_List_Index,
+ Table_Low_Bound => 1,
+ Table_Initial => 10,
+ Table_Increment => 100);
+ -- The table for lists of numbers
package Mapping_Files_Htable is new Simple_HTable
(Header_Num => Header_Num,
@@ -376,6 +347,8 @@ package Prj is
Equal => "=");
-- A hash table to store the mapping files that are not used
+ -- The following record ???
+
type Lang_Naming_Data is record
Dot_Replacement : File_Name_Type := No_File;
-- The string to replace '.' in the source file name (for Ada)
@@ -402,17 +375,40 @@ package Prj is
Spec_Suffix => No_File,
Body_Suffix => No_File);
- type Source_Id is new Nat;
+ function Is_Standard_GNAT_Naming (Naming : Lang_Naming_Data) return Boolean;
+ -- True if the naming scheme is GNAT's default naming scheme. This
+ -- is to take into account shortened names like "Ada." (a-), "System." (s-)
+ -- and so on.
+
+ type Source_Data;
+ type Source_Id is access all Source_Data;
+
+ function Is_Compilable (Source : Source_Id) return Boolean;
+ pragma Inline (Is_Compilable);
+ -- Return True if we know how to compile Source (i.e. if a compiler is
+ -- defined). This doesn't indicate whether the source should be compiled.
- No_Source : constant Source_Id := 0;
+ function Object_To_Global_Archive (Source : Source_Id) return Boolean;
+ pragma Inline (Object_To_Global_Archive);
+ -- Return True if the object file should be put in the global archive.
+ -- This is for Ada, when only the closure of a main needs to be
+ -- (re)compiled.
+
+ function Other_Part (Source : Source_Id) return Source_Id;
+ pragma Inline (Other_Part);
+ -- Source ID for the other part, if any: for a spec, indicates its body;
+ -- for a body, indicates its spec.
+
+ No_Source : constant Source_Id := null;
type Path_Syntax_Kind is
(Canonical,
-- Unix style
-
Host);
-- Host specific syntax, for example on VMS (the default)
+ -- The following record describes the configuration of a language
+
type Language_Config is record
Kind : Language_Kind := File_Based;
-- Kind of language. All languages are file based, except Ada which is
@@ -422,10 +418,10 @@ package Prj is
-- The naming data for the languages (prefixes, etc.)
Include_Compatible_Languages : Name_List_Index := No_Name_List;
- -- The list of languages that are "include compatible" with this
- -- language. A language B (for example "C") is "include compatible" with
- -- a language A (for example "C++") if it is expected that sources of
- -- language A may "include" header files from language B.
+ -- List of languages that are "include compatible" with this language. A
+ -- language B (for example "C") is "include compatible" with a language
+ -- A (for example "C++") if it is expected that sources of language A
+ -- may "include" header files from language B.
Compiler_Driver : File_Name_Type := No_File;
-- The name of the executable for the compiler of the language
@@ -433,63 +429,79 @@ package Prj is
Compiler_Driver_Path : String_Access := null;
-- The path name of the executable for the compiler of the language
- Compiler_Required_Switches : Name_List_Index := No_Name_List;
- -- The list of switches that are required as a minimum to invoke the
- -- compiler driver.
+ Compiler_Leading_Required_Switches : Name_List_Index := No_Name_List;
+ -- The list of initial switches that are required as a minimum to invoke
+ -- the compiler driver.
+
+ Compiler_Trailing_Required_Switches : Name_List_Index := No_Name_List;
+ -- The list of final switches that are required as a minimum to invoke
+ -- the compiler driver.
+
+ Multi_Unit_Switches : Name_List_Index := No_Name_List;
+ -- The switch(es) to indicate the index of a unit in a multi-source file
- Path_Syntax : Path_Syntax_Kind := Host;
+ Multi_Unit_Object_Separator : Character := ' ';
+ -- The string separating the base name of a source from the index of the
+ -- unit in a multi-source file, in the object file name.
+
+ Path_Syntax : Path_Syntax_Kind := Host;
-- Value may be Canonical (Unix style) or Host (host syntax, for example
-- on VMS for DEC C).
Object_File_Suffix : Name_Id := No_Name;
+ -- Optional alternate object file suffix
+
+ Object_File_Switches : Name_List_Index := No_Name_List;
+ -- Optional object file switches. When this is defined, the switches
+ -- are used to specify the object file. The object file name is appended
+ -- to the last switch in the list. Example: ("-o", "").
Compilation_PIC_Option : Name_List_Index := No_Name_List;
-- The option(s) to compile a source in Position Independent Code for
-- shared libraries. Specified in the configuration. When not specified,
-- there is no need for such switch.
- Object_Generated : Boolean := True;
+ Object_Generated : Boolean := True;
-- False in no object file is generated
- Objects_Linked : Boolean := True;
+ Objects_Linked : Boolean := True;
-- False if object files are not use to link executables and build
-- libraries.
- Runtime_Library_Dir : Name_Id := No_Name;
+ Runtime_Library_Dir : Name_Id := No_Name;
-- Path name of the runtime library directory, if any
- Runtime_Source_Dir : Name_Id := No_Name;
+ Runtime_Source_Dir : Name_Id := No_Name;
-- Path name of the runtime source directory, if any
- Mapping_File_Switches : Name_List_Index := No_Name_List;
+ Mapping_File_Switches : Name_List_Index := No_Name_List;
-- The option(s) to provide a mapping file to the compiler. Specified in
-- the configuration. When value is No_Name_List, there is no mapping
-- file.
- Mapping_Spec_Suffix : File_Name_Type := No_File;
+ Mapping_Spec_Suffix : File_Name_Type := No_File;
-- Placeholder representing the spec suffix in a mapping file
- Mapping_Body_Suffix : File_Name_Type := No_File;
+ Mapping_Body_Suffix : File_Name_Type := No_File;
-- Placeholder representing the body suffix in a mapping file
- Config_File_Switches : Name_List_Index := No_Name_List;
+ Config_File_Switches : Name_List_Index := No_Name_List;
-- The option(s) to provide a config file to the compiler. Specified in
- -- the configuration. When value is No_Name_List, there is no config
- -- file.
+ -- the configuration. If value is No_Name_List there is no config file.
- Dependency_Kind : Dependency_File_Kind := None;
+ Dependency_Kind : Dependency_File_Kind := None;
-- The kind of dependency to be checked: none, Makefile fragment or
-- ALI file (for Ada).
- Dependency_Option : Name_List_Index := No_Name_List;
+ Dependency_Option : Name_List_Index := No_Name_List;
-- The option(s) to be used to create the dependency file. When value is
-- No_Name_List, there is not such option(s).
- Compute_Dependency : Name_List_Index := No_Name_List;
+ Compute_Dependency : Name_List_Index := No_Name_List;
-- Hold the value of attribute Dependency_Driver, if declared for the
-- language.
- Include_Option : Name_List_Index := No_Name_List;
+ Include_Option : Name_List_Index := No_Name_List;
-- Hold the value of attribute Include_Switches, if declared for the
-- language.
@@ -509,47 +521,54 @@ package Prj is
-- Name of environment variable declared by attribute Objects_Path_File
-- for the language.
- Config_Body : Name_Id := No_Name;
+ Config_Body : Name_Id := No_Name;
-- The template for a pragma Source_File_Name(_Project) for a specific
-- file name of a body.
- Config_Spec : Name_Id := No_Name;
+ Config_Body_Index : Name_Id := No_Name;
-- The template for a pragma Source_File_Name(_Project) for a specific
- -- file name of a spec.
+ -- file name of a body in a multi-source file.
- Config_Body_Pattern : Name_Id := No_Name;
+ Config_Body_Pattern : Name_Id := No_Name;
-- The template for a pragma Source_File_Name(_Project) for a naming
-- body pattern.
- Config_Spec_Pattern : Name_Id := No_Name;
+ Config_Spec : Name_Id := No_Name;
+ -- The template for a pragma Source_File_Name(_Project) for a specific
+ -- file name of a spec.
+
+ Config_Spec_Index : Name_Id := No_Name;
+ -- The template for a pragma Source_File_Name(_Project) for a specific
+ -- file name of a spec in a multi-source file.
+
+ Config_Spec_Pattern : Name_Id := No_Name;
-- The template for a pragma Source_File_Name(_Project) for a naming
-- spec pattern.
- Config_File_Unique : Boolean := False;
+ Config_File_Unique : Boolean := False;
-- Indicate if the config file specified to the compiler needs to be
-- unique. If it is unique, then all config files are concatenated into
-- a temp config file.
- Binder_Driver : File_Name_Type := No_File;
+ Binder_Driver : File_Name_Type := No_File;
-- The name of the binder driver for the language, if any
- Binder_Driver_Path : Path_Name_Type := No_Path;
+ Binder_Driver_Path : Path_Name_Type := No_Path;
-- The path name of the binder driver
- Binder_Required_Switches : Name_List_Index := No_Name_List;
+ Binder_Required_Switches : Name_List_Index := No_Name_List;
-- Hold the value of attribute Binder'Required_Switches for the language
- Binder_Prefix : Name_Id := No_Name;
+ Binder_Prefix : Name_Id := No_Name;
-- Hold the value of attribute Binder'Prefix for the language
- Toolchain_Version : Name_Id := No_Name;
+ Toolchain_Version : Name_Id := No_Name;
-- Hold the value of attribute Toolchain_Version for the language
- Toolchain_Description : Name_Id := No_Name;
+ Toolchain_Description : Name_Id := No_Name;
-- Hold the value of attribute Toolchain_Description for the language
end record;
- -- Record describing the configuration of a language
No_Language_Config : constant Language_Config :=
(Kind => File_Based,
@@ -557,9 +576,13 @@ package Prj is
Include_Compatible_Languages => No_Name_List,
Compiler_Driver => No_File,
Compiler_Driver_Path => null,
- Compiler_Required_Switches => No_Name_List,
+ Compiler_Leading_Required_Switches => No_Name_List,
+ Compiler_Trailing_Required_Switches => No_Name_List,
+ Multi_Unit_Switches => No_Name_List,
+ Multi_Unit_Object_Separator => ' ',
Path_Syntax => Canonical,
Object_File_Suffix => No_Name,
+ Object_File_Switches => No_Name_List,
Compilation_PIC_Option => No_Name_List,
Object_Generated => True,
Objects_Linked => True,
@@ -569,7 +592,7 @@ package Prj is
Mapping_Spec_Suffix => No_File,
Mapping_Body_Suffix => No_File,
Config_File_Switches => No_Name_List,
- Dependency_Kind => Makefile,
+ Dependency_Kind => None,
Dependency_Option => No_Name_List,
Compute_Dependency => No_Name_List,
Include_Option => No_Name_List,
@@ -578,8 +601,10 @@ package Prj is
Objects_Path => No_Name,
Objects_Path_File => No_Name,
Config_Body => No_Name,
- Config_Spec => No_Name,
+ Config_Body_Index => No_Name,
Config_Body_Pattern => No_Name,
+ Config_Spec => No_Name,
+ Config_Spec_Index => No_Name,
Config_Spec_Pattern => No_Name,
Config_File_Unique => False,
Binder_Driver => No_File,
@@ -589,6 +614,8 @@ package Prj is
Toolchain_Version => No_Name,
Toolchain_Description => No_Name);
+ -- The following record ???
+
type Language_Data is record
Name : Name_Id := No_Name;
Display_Name : Name_Id := No_Name;
@@ -596,7 +623,7 @@ package Prj is
First_Source : Source_Id := No_Source;
Mapping_Files : Mapping_Files_Htable.Instance :=
Mapping_Files_Htable.Nil;
- Next : Language_Index := No_Language_Index;
+ Next : Language_Ptr := No_Language_Index;
end record;
No_Language_Data : constant Language_Data :=
@@ -607,178 +634,155 @@ package Prj is
Mapping_Files => Mapping_Files_Htable.Nil,
Next => No_Language_Index);
- package Language_Data_Table is new GNAT.Dynamic_Tables
- (Table_Component_Type => Language_Data,
- Table_Index_Type => Language_Index,
- Table_Low_Bound => 1,
- Table_Initial => 10,
- Table_Increment => 100);
- -- The table for lists of names used in package Language_Processing
+ type Language_List_Element;
+ type Language_List is access all Language_List_Element;
+ type Language_List_Element is record
+ Language : Language_Ptr := No_Language_Index;
+ Next : Language_List;
+ end record;
- type Alternate_Language_Id is new Nat;
+ type Source_Kind is (Spec, Impl, Sep);
+ subtype Spec_Or_Body is Source_Kind range Spec .. Impl;
- No_Alternate_Language : constant Alternate_Language_Id := 0;
+ -- The following declarations declare a structure used to store the Name
+ -- and File and Path names of a unit, with a reference to its GNAT Project
+ -- File(s). Some units might have neither Spec nor Impl when they were
+ -- created for a "separate".
- type Alternate_Language_Data is record
- Language : Language_Index := No_Language_Index;
- Next : Alternate_Language_Id := No_Alternate_Language;
+ type File_Names_Data is array (Spec_Or_Body) of Source_Id;
+
+ type Unit_Data is record
+ Name : Name_Id := No_Name;
+ File_Names : File_Names_Data;
end record;
- package Alternate_Language_Table is new GNAT.Dynamic_Tables
- (Table_Component_Type => Alternate_Language_Data,
- Table_Index_Type => Alternate_Language_Id,
- Table_Low_Bound => 1,
- Table_Initial => 10,
- Table_Increment => 100);
- -- The table for storing the alternate languages of a header file that
- -- is used for several languages.
+ type Unit_Index is access all Unit_Data;
- type Source_Kind is (Spec, Impl, Sep);
+ No_Unit_Index : constant Unit_Index := null;
+ -- Used to indicate a null entry for no unit
+
+ -- Structure to define source data
type Source_Data is record
- Project : Project_Id := No_Project;
+ Project : Project_Id := No_Project;
-- Project of the source
- Language : Language_Index := No_Language_Index;
- -- Index of the language. This is an index into
- -- project_tree.languages_data
+ Source_Dir_Rank : Natural := 0;
+ -- The rank of the source directory in list declared with attribute
+ -- Source_Dirs. Two source files with the same name cannot appears in
+ -- different directory with the same rank. That can happen when the
+ -- recursive notation
/** is used in attribute Source_Dirs.
- Lang_Kind : Language_Kind := File_Based;
- -- Kind of the language
-
- Compiled : Boolean := True;
- -- False when there is no compiler for the language
+ Language : Language_Ptr := No_Language_Index;
+ -- Index of the language. This is an index into
+ -- Project_Tree.Languages_Data.
- In_Interfaces : Boolean := True;
+ In_Interfaces : Boolean := True;
-- False when the source is not included in interfaces, when attribute
-- Interfaces is declared.
- Declared_In_Interfaces : Boolean := False;
+ Declared_In_Interfaces : Boolean := False;
-- True when source is declared in attribute Interfaces
- Alternate_Languages : Alternate_Language_Id := No_Alternate_Language;
- -- List of languages a header file may also be, in addition of
- -- language Language_Name.
+ Alternate_Languages : Language_List := null;
+ -- List of languages a header file may also be, in addition of language
+ -- Language_Name.
- Kind : Source_Kind := Spec;
+ Kind : Source_Kind := Spec;
-- Kind of the source: spec, body or subunit
- Dependency : Dependency_File_Kind := None;
- -- Kind of dependency: none, Makefile fragment or ALI file
-
- Other_Part : Source_Id := No_Source;
- -- Source ID for the other part, if any: for a spec, indicates its body;
- -- for a body, indicates its spec.
-
- Unit : Name_Id := No_Name;
- -- Name of the unit, if language is unit based
+ Unit : Unit_Index := No_Unit_Index;
+ -- Name of the unit, if language is unit based. This is only set for
+ -- those files that are part of the compilation set (for instance a
+ -- file in an extended project that is overridden will not have this
+ -- field set).
- Index : Int := 0;
- -- Index of the source in a multi unit source file
+ Index : Int := 0;
+ -- Index of the source in a multi unit source file (the same Source_Data
+ -- is duplicated several times when there are several units in the same
+ -- file). Index is 0 if there is either no unit or a single one, and
+ -- starts at 1 when there are multiple units
- Locally_Removed : Boolean := False;
+ Locally_Removed : Boolean := False;
-- True if the source has been "excluded"
- Get_Object : Boolean := False;
- -- Indicates that the object of the source should be put in the global
- -- archive. This is for Ada, when only the closure of a main needs to
- -- be compiled/recompiled.
+ Replaced_By : Source_Id := No_Source;
+ -- Missing comment ???
- Replaced_By : Source_Id := No_Source;
-
- File : File_Name_Type := No_File;
+ File : File_Name_Type := No_File;
-- Canonical file name of the source
- Display_File : File_Name_Type := No_File;
+ Display_File : File_Name_Type := No_File;
-- File name of the source, for display purposes
- Path : Path_Information := No_Path_Information;
+ Path : Path_Information := No_Path_Information;
-- Path name of the source
- Source_TS : Time_Stamp_Type := Empty_Time_Stamp;
+ Source_TS : Time_Stamp_Type := Empty_Time_Stamp;
-- Time stamp of the source file
- Object_Project : Project_Id := No_Project;
+ Object_Project : Project_Id := No_Project;
-- Project where the object file is. This might be different from
-- Project when using extending project files.
- Object_Exists : Boolean := True;
- -- True if an object file exists
-
- Object_Linked : Boolean := True;
- -- False if the object file is not use to link executables or included
- -- in libraries.
-
- Object : File_Name_Type := No_File;
+ Object : File_Name_Type := No_File;
-- File name of the object file
- Current_Object_Path : Path_Name_Type := No_Path;
+ Current_Object_Path : Path_Name_Type := No_Path;
-- Object path of an existing object file
- Object_Path : Path_Name_Type := No_Path;
+ Object_Path : Path_Name_Type := No_Path;
-- Object path of the real object file
- Object_TS : Time_Stamp_Type := Empty_Time_Stamp;
+ Object_TS : Time_Stamp_Type := Empty_Time_Stamp;
-- Object file time stamp
- Dep_Name : File_Name_Type := No_File;
+ Dep_Name : File_Name_Type := No_File;
-- Dependency file simple name
- Current_Dep_Path : Path_Name_Type := No_Path;
+ Current_Dep_Path : Path_Name_Type := No_Path;
-- Path name of an existing dependency file
- Dep_Path : Path_Name_Type := No_Path;
+ Dep_Path : Path_Name_Type := No_Path;
-- Path name of the real dependency file
- Dep_TS : Time_Stamp_Type := Empty_Time_Stamp;
+ Dep_TS : aliased Osint.File_Attributes := Osint.Unknown_Attributes;
-- Dependency file time stamp
- Switches : File_Name_Type := No_File;
+ Switches : File_Name_Type := No_File;
-- File name of the switches file. For all languages, this is a file
-- that ends with the .cswi extension.
- Switches_Path : Path_Name_Type := No_Path;
+ Switches_Path : Path_Name_Type := No_Path;
-- Path name of the switches file
- Switches_TS : Time_Stamp_Type := Empty_Time_Stamp;
+ Switches_TS : Time_Stamp_Type := Empty_Time_Stamp;
-- Switches file time stamp
- Naming_Exception : Boolean := False;
+ Naming_Exception : Boolean := False;
-- True if the source has an exceptional name
- Next_In_Sources : Source_Id := No_Source;
- -- Link to another source in the project tree
-
- Next_In_Project : Source_Id := No_Source;
- -- Link to another source in the project
-
- Next_In_Lang : Source_Id := No_Source;
- -- Link to another source of the same language
+ Next_In_Lang : Source_Id := No_Source;
+ -- Link to another source of the same language in the same project
end record;
No_Source_Data : constant Source_Data :=
(Project => No_Project,
+ Source_Dir_Rank => 0,
Language => No_Language_Index,
- Lang_Kind => File_Based,
- Compiled => True,
In_Interfaces => True,
Declared_In_Interfaces => False,
- Alternate_Languages => No_Alternate_Language,
+ Alternate_Languages => null,
Kind => Spec,
- Dependency => None,
- Other_Part => No_Source,
- Unit => No_Name,
+ Unit => No_Unit_Index,
Index => 0,
Locally_Removed => False,
- Get_Object => False,
Replaced_By => No_Source,
File => No_File,
Display_File => No_File,
Path => No_Path_Information,
Source_TS => Empty_Time_Stamp,
Object_Project => No_Project,
- Object_Exists => True,
- Object_Linked => True,
Object => No_File,
Current_Object_Path => No_Path,
Object_Path => No_Path,
@@ -786,23 +790,13 @@ package Prj is
Dep_Name => No_File,
Current_Dep_Path => No_Path,
Dep_Path => No_Path,
- Dep_TS => Empty_Time_Stamp,
+ Dep_TS => Osint.Unknown_Attributes,
Switches => No_File,
Switches_Path => No_Path,
Switches_TS => Empty_Time_Stamp,
Naming_Exception => False,
- Next_In_Sources => No_Source,
- Next_In_Project => No_Source,
Next_In_Lang => No_Source);
- package Source_Data_Table is new GNAT.Dynamic_Tables
- (Table_Component_Type => Source_Data,
- Table_Index_Type => Source_Id,
- Table_Low_Bound => 1,
- Table_Initial => 1000,
- Table_Increment => 100);
- -- The table for the sources
-
package Source_Paths_Htable is new Simple_HTable
(Header_Num => Header_Num,
Element => Source_Id,
@@ -853,7 +847,7 @@ package Prj is
Symbol_Policy => Autonomous);
-- The default value of the symbol data
- function Image (Casing : Casing_Type) return String;
+ function Image (The_Casing : Casing_Type) return String;
-- Similar to 'Image (but avoid use of this attribute in compiler)
function Value (Image : String) return Casing_Type;
@@ -862,121 +856,40 @@ package Prj is
-- The following record contains data for a naming scheme
- type Naming_Data is record
-
- Dot_Replacement : File_Name_Type := No_File;
- -- The string to replace '.' in the source file name (for Ada)
-
- Casing : Casing_Type := All_Lower_Case;
- -- The casing of the source file name (for Ada)
-
- Spec_Suffix : Array_Element_Id := No_Array_Element;
- -- The string to append to the unit name for the
- -- source file name of a spec.
- -- Indexed by the programming language.
-
- Body_Suffix : Array_Element_Id := No_Array_Element;
- -- The string to append to the unit name for the
- -- source file name of a body.
- -- Indexed by the programming language.
-
- Separate_Suffix : File_Name_Type := No_File;
- -- String to append to unit name for source file name of an Ada subunit
-
- Specs : Array_Element_Id := No_Array_Element;
- -- An associative array mapping individual specs to source file names
- -- This is specific to unit-based languages.
-
- Bodies : Array_Element_Id := No_Array_Element;
- -- An associative array mapping individual bodies to source file names
- -- This is specific to unit-based languages.
-
- Specification_Exceptions : Array_Element_Id := No_Array_Element;
- -- An associative array listing spec file names that do not have the
- -- spec suffix. Not used by Ada. Indexed by programming language name.
-
- Implementation_Exceptions : Array_Element_Id := No_Array_Element;
- -- An associative array listing body file names that do not have the
- -- body suffix. Not used by Ada. Indexed by programming language name.
-
- end record;
-
- function Spec_Suffix_Of
- (In_Tree : Project_Tree_Ref;
- Language : String;
- Naming : Naming_Data) return String;
-
- function Spec_Suffix_Id_Of
- (In_Tree : Project_Tree_Ref;
- Language : String;
- Naming : Naming_Data) return File_Name_Type;
-
- function Spec_Suffix_Id_Of
- (In_Tree : Project_Tree_Ref;
- Language_Id : Name_Id;
- Naming : Naming_Data) return File_Name_Type;
-
- procedure Set_Spec_Suffix
- (In_Tree : Project_Tree_Ref;
- Language : String;
- Naming : in out Naming_Data;
- Suffix : File_Name_Type);
-
- function Body_Suffix_Id_Of
- (In_Tree : Project_Tree_Ref;
- Language : String;
- Naming : Naming_Data) return File_Name_Type;
-
- function Body_Suffix_Id_Of
- (In_Tree : Project_Tree_Ref;
- Language_Id : Name_Id;
- Naming : Naming_Data) return File_Name_Type;
-
- function Body_Suffix_Of
- (In_Tree : Project_Tree_Ref;
- Language : String;
- Naming : Naming_Data) return String;
-
- procedure Set_Body_Suffix
- (In_Tree : Project_Tree_Ref;
- Language : String;
- Naming : in out Naming_Data;
- Suffix : File_Name_Type);
-
- function Objects_Exist_For
- (Language : String;
- In_Tree : Project_Tree_Ref) return Boolean;
-
- function Standard_Naming_Data
- (Tree : Project_Tree_Ref := No_Project_Tree) return Naming_Data;
- pragma Inline (Standard_Naming_Data);
- -- The standard GNAT naming scheme when Tree is No_Project_Tree.
- -- Otherwise, return the default naming scheme for the project tree Tree,
- -- which must have been Initialized.
-
- function Same_Naming_Scheme
- (Left, Right : Naming_Data) return Boolean;
- -- Returns True if Left and Right are the same naming scheme
- -- not considering Specs and Bodies.
-
- type Project_List is new Nat;
- Empty_Project_List : constant Project_List := 0;
- -- A list of project files
-
- type Project_Element is record
+ function Get_Object_Directory
+ (Project : Project_Id;
+ Including_Libraries : Boolean;
+ Only_If_Ada : Boolean := False) return Path_Name_Type;
+ -- Return the object directory to use for the project. This depends on
+ -- whether we have a library project or a standard project. This function
+ -- might return No_Name when no directory applies.
+ -- If we have a a library project file and Including_Libraries is True then
+ -- the library dir is returned instead of the object dir.
+ -- If Only_If_Ada is True, then No_Name will be returned when the project
+ -- doesn't Ada sources.
+
+ procedure Compute_All_Imported_Projects (Tree : Project_Tree_Ref);
+ -- For all projects in the tree, compute the list of the projects imported
+ -- directly or indirectly by project Project. The result is stored in
+ -- Project.All_Imported_Projects for each project
+
+ function Ultimate_Extending_Project_Of
+ (Proj : Project_Id) return Project_Id;
+ -- Returns the ultimate extending project of project Proj. If project Proj
+ -- is not extended, returns Proj.
+
+ type Project_List_Element;
+ type Project_List is access all Project_List_Element;
+ type Project_List_Element is record
Project : Project_Id := No_Project;
- Next : Project_List := Empty_Project_List;
+ Next : Project_List := null;
end record;
- -- Element in a list of project files. Next is the id of the next
- -- project file in the list.
+ -- A list of projects
- package Project_List_Table is new GNAT.Dynamic_Tables
- (Table_Component_Type => Project_Element,
- Table_Index_Type => Project_List,
- Table_Low_Bound => 1,
- Table_Initial => 100,
- Table_Increment => 100);
- -- The table that contains the lists of project files
+ procedure Free_List
+ (List : in out Project_List;
+ Free_Project : Boolean);
+ -- Free the list of projects, if Free_Project, each project is also freed
type Response_File_Format is
(None,
@@ -986,117 +899,126 @@ package Prj is
-- The format of the different response files
type Project_Configuration is record
- Target : Name_Id := No_Name;
+ Target : Name_Id := No_Name;
-- The target of the configuration, when specified
- Run_Path_Option : Name_List_Index := No_Name_List;
+ Run_Path_Option : Name_List_Index := No_Name_List;
-- The option to use when linking to specify the path where to look for
-- libraries.
- Separate_Run_Path_Options : Boolean := False;
+ Run_Path_Origin : Name_Id := No_Name;
+ -- Specify the string (such as "$ORIGIN") to indicate paths relative to
+ -- the directory of the executable in the run path option.
+
+ Library_Install_Name_Option : Name_Id := No_Name;
+ -- When this is not an empty list, this option, followed by the single
+ -- name of the shared library file is used when linking a shared
+ -- library.
+
+ Separate_Run_Path_Options : Boolean := False;
-- True if each directory needs to be specified in a separate run path
-- option.
- Executable_Suffix : Name_Id := No_Name;
+ Executable_Suffix : Name_Id := No_Name;
-- The suffix of executables, when specified in the configuration or in
-- package Builder of the main project. When this is not specified, the
-- executable suffix is the default for the platform.
-- Linking
- Linker : Path_Name_Type := No_Path;
+ Linker : Path_Name_Type := No_Path;
-- Path name of the linker driver. Specified in the configuration or in
-- the package Builder of the main project.
- Map_File_Option : Name_Id := No_Name;
+ Map_File_Option : Name_Id := No_Name;
-- Option to use when invoking the linker to build a map file
- Minimum_Linker_Options : Name_List_Index := No_Name_List;
+ Minimum_Linker_Options : Name_List_Index := No_Name_List;
-- The minimum options for the linker driver. Specified in the
-- configuration.
- Linker_Executable_Option : Name_List_Index := No_Name_List;
+ Linker_Executable_Option : Name_List_Index := No_Name_List;
-- The option(s) to indicate the name of the executable in the linker
-- command. Specified in the configuration. When not specified, default
-- to -o .
- Linker_Lib_Dir_Option : Name_Id := No_Name;
+ Linker_Lib_Dir_Option : Name_Id := No_Name;
-- The option to specify where to find a library for linking. Specified
-- in the configuration. When not specified, defaults to "-L".
- Linker_Lib_Name_Option : Name_Id := No_Name;
+ Linker_Lib_Name_Option : Name_Id := No_Name;
-- The option to specify the name of a library for linking. Specified in
-- the configuration. When not specified, defaults to "-l".
- Max_Command_Line_Length : Natural := 0;
+ Max_Command_Line_Length : Natural := 0;
-- When positive and when Resp_File_Format (see below) is not None,
-- if the command line for the invocation of the linker would be greater
-- than this value, a response file is used to invoke the linker.
- Resp_File_Format : Response_File_Format := None;
+ Resp_File_Format : Response_File_Format := None;
-- The format of a response file, when linking with a response file is
-- supported.
- Resp_File_Options : Name_List_Index := No_Name_List;
+ Resp_File_Options : Name_List_Index := No_Name_List;
-- The switches, if any, that precede the path name of the response
-- file in the invocation of the linker.
-- Libraries
- Library_Builder : Path_Name_Type := No_Path;
+ Library_Builder : Path_Name_Type := No_Path;
-- The executable to build library (specified in the configuration)
- Lib_Support : Library_Support := None;
+ Lib_Support : Library_Support := None;
-- The level of library support. Specified in the configuration. Support
-- is none, static libraries only or both static and shared libraries.
- Archive_Builder : Name_List_Index := No_Name_List;
+ Archive_Builder : Name_List_Index := No_Name_List;
-- The name of the executable to build archives, with the minimum
-- switches. Specified in the configuration.
Archive_Builder_Append_Option : Name_List_Index := No_Name_List;
-- The options to append object files to an archive
- Archive_Indexer : Name_List_Index := No_Name_List;
+ Archive_Indexer : Name_List_Index := No_Name_List;
-- The name of the executable to index archives, with the minimum
-- switches. Specified in the configuration.
- Archive_Suffix : File_Name_Type := No_File;
+ Archive_Suffix : File_Name_Type := No_File;
-- The suffix of archives. Specified in the configuration. When not
-- specified, defaults to ".a".
- Lib_Partial_Linker : Name_List_Index := No_Name_List;
+ Lib_Partial_Linker : Name_List_Index := No_Name_List;
-- Shared libraries
- Shared_Lib_Driver : File_Name_Type := No_File;
+ Shared_Lib_Driver : File_Name_Type := No_File;
-- The driver to link shared libraries. Set with attribute Library_GCC.
-- Default to gcc.
- Shared_Lib_Prefix : File_Name_Type := No_File;
+ Shared_Lib_Prefix : File_Name_Type := No_File;
-- Part of a shared library file name that precedes the name of the
-- library. Specified in the configuration. When not specified, defaults
-- to "lib".
- Shared_Lib_Suffix : File_Name_Type := No_File;
+ Shared_Lib_Suffix : File_Name_Type := No_File;
-- Suffix of shared libraries, after the library name in the shared
-- library name. Specified in the configuration. When not specified,
-- default to ".so".
- Shared_Lib_Min_Options : Name_List_Index := No_Name_List;
+ Shared_Lib_Min_Options : Name_List_Index := No_Name_List;
-- The minimum options to use when building a shared library
- Lib_Version_Options : Name_List_Index := No_Name_List;
+ Lib_Version_Options : Name_List_Index := No_Name_List;
-- The options to use to specify a library version
- Symbolic_Link_Supported : Boolean := False;
+ Symbolic_Link_Supported : Boolean := False;
-- True if the platform supports symbolic link files
- Lib_Maj_Min_Id_Supported : Boolean := False;
+ Lib_Maj_Min_Id_Supported : Boolean := False;
-- True if platform supports library major and minor options, such as
-- libname.so -> libname.so.2 -> libname.so.2.4
- Auto_Init_Supported : Boolean := False;
+ Auto_Init_Supported : Boolean := False;
-- True if automatic initialisation is supported for shared stand-alone
-- libraries.
end record;
@@ -1104,6 +1026,8 @@ package Prj is
Default_Project_Config : constant Project_Configuration :=
(Target => No_Name,
Run_Path_Option => No_Name_List,
+ Run_Path_Origin => No_Name,
+ Library_Install_Name_Option => No_Name,
Separate_Run_Path_Options => False,
Executable_Suffix => No_Name,
Linker => No_Path,
@@ -1159,7 +1083,8 @@ package Prj is
Config : Project_Configuration;
Path : Path_Information := No_Path_Information;
- -- The path name of the project file
+ -- The path name of the project file. This include base name of the
+ -- project file.
Virtual : Boolean := False;
-- True for virtual extending projects
@@ -1167,21 +1092,15 @@ package Prj is
Location : Source_Ptr := No_Location;
-- The location in the project file source of the reserved word project
- Naming : Naming_Data := Standard_Naming_Data;
- -- The naming scheme of this project file
-
---------------
-- Languages --
---------------
- Languages : Name_List_Index := No_Name_List;
- -- The list of languages of the sources of this project
- -- mode: Ada_Only
-
- First_Language_Processing : Language_Index := No_Language_Index;
+ Languages : Language_Ptr := No_Language_Index;
-- First index of the language data in the project.
- -- This is an index into the project_tree_data.languages_data
- -- mode: Multi_Language
+ -- This is an index into the project_tree_data.languages_data.
+ -- Traversing the list gives access to all the languages supported by
+ -- the project.
--------------
-- Projects --
@@ -1202,11 +1121,12 @@ package Prj is
-- The declarations (variables, attributes and packages) of this project
-- file.
- Imported_Projects : Project_List := Empty_Project_List;
+ Imported_Projects : Project_List;
-- The list of all directly imported projects, if any
- All_Imported_Projects : Project_List := Empty_Project_List;
- -- The list of all projects imported directly or indirectly, if any
+ All_Imported_Projects : Project_List;
+ -- The list of all projects imported directly or indirectly, if any.
+ -- This does not include the project itself.
-----------------
-- Directories --
@@ -1215,9 +1135,6 @@ package Prj is
Directory : Path_Information := No_Path_Information;
-- Path name of the directory where the project file resides
- Dir_Path : String_Access;
- -- Same as Directory.Name, but as an access to String
-
Object_Directory : Path_Information := No_Path_Information;
-- The path name of the object directory of this project file
@@ -1280,47 +1197,21 @@ package Prj is
-------------
-- Sources --
-------------
+ -- The sources for all languages including Ada are accessible through
+ -- the Source_Iterator type
- Ada_Sources_Present : Boolean := True;
- -- True if there are Ada sources in the project
-
- Other_Sources_Present : Boolean := True;
- -- True if there are non-Ada sources in the project
-
- Ada_Sources : String_List_Id := Nil_String;
- -- The list of all the Ada source file names (gnatmake only)
-
- First_Source : Source_Id := No_Source;
- Last_Source : Source_Id := No_Source;
- -- Head and tail of the list of sources
-
- Interfaces_Defined : Boolean := False;
+ Interfaces_Defined : Boolean := False;
-- True if attribute Interfaces is declared for the project or any
-- project it extends.
- Imported_Directories_Switches : Argument_List_Access := null;
- -- List of the source search switches (-I