aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Briot <briot@adacore.com>2009-06-24 09:57:13 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2009-06-24 11:57:13 +0200
commitc928785785d29202b33a7738adecff9a09c93738 (patch)
treea4e7eb796c5e2dc481738203d747f83b12577a22
parent2b426674815acc4d32ef39140e531f92cbf20e14 (diff)
downloadgcc-c928785785d29202b33a7738adecff9a09c93738.zip
gcc-c928785785d29202b33a7738adecff9a09c93738.tar.gz
gcc-c928785785d29202b33a7738adecff9a09c93738.tar.bz2
prj-proc.adb, [...] (Allow_Duplicate_Basenames): New parameter to several subprograms.
2009-06-24 Emmanuel Briot <briot@adacore.com> * prj-proc.adb, prj-proc.ads, prj.ads, prj-nmsc.adb, prj-nmsc.ads, prj-conf.adb, prj-conf.ads (Allow_Duplicate_Basenames): New parameter to several subprograms. (Source_Data.Other_Part): Removed, since can be computed from the language. (Other_Part): New subprogram. From-SVN: r148904
-rw-r--r--gcc/ada/ChangeLog9
-rw-r--r--gcc/ada/prj-conf.adb4
-rw-r--r--gcc/ada/prj-conf.ads3
-rw-r--r--gcc/ada/prj-nmsc.adb134
-rw-r--r--gcc/ada/prj-nmsc.ads6
-rw-r--r--gcc/ada/prj-proc.adb23
-rw-r--r--gcc/ada/prj-proc.ads7
-rw-r--r--gcc/ada/prj.ads80
8 files changed, 158 insertions, 108 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 5642508..a1c4d33 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,14 @@
2009-06-24 Emmanuel Briot <briot@adacore.com>
+ * prj-proc.adb, prj-proc.ads, prj.ads, prj-nmsc.adb, prj-nmsc.ads,
+ prj-conf.adb, prj-conf.ads (Allow_Duplicate_Basenames): New parameter
+ to several subprograms.
+ (Source_Data.Other_Part): Removed, since can be computed from the
+ language.
+ (Other_Part): New subprogram.
+
+2009-06-24 Emmanuel Briot <briot@adacore.com>
+
* gnat_ugn.texi, prj-nmsc.adb (Suffix_Matches): A suffix can also match
the full base name of the file when the suffix doesn't start with a '.'.
diff --git a/gcc/ada/prj-conf.adb b/gcc/ada/prj-conf.adb
index 6490f9f..0520cf5 100644
--- a/gcc/ada/prj-conf.adb
+++ b/gcc/ada/prj-conf.adb
@@ -907,7 +907,8 @@ package body Prj.Conf is
Normalized_Hostname : String;
Report_Error : Put_Line_Access := null;
On_Load_Config : Config_File_Hook := null;
- Compiler_Driver_Mandatory : Boolean := True)
+ Compiler_Driver_Mandatory : Boolean := True;
+ Allow_Duplicate_Basenames : Boolean := False)
is
Main_Config_Project : Project_Id;
Success : Boolean;
@@ -962,6 +963,7 @@ package body Prj.Conf is
Current_Dir => Current_Directory,
When_No_Sources => Warning,
Compiler_Driver_Mandatory => Compiler_Driver_Mandatory,
+ Allow_Duplicate_Basenames => Allow_Duplicate_Basenames,
Is_Config_File => False);
if not Success then
diff --git a/gcc/ada/prj-conf.ads b/gcc/ada/prj-conf.ads
index 091ae54..4eb8691 100644
--- a/gcc/ada/prj-conf.ads
+++ b/gcc/ada/prj-conf.ads
@@ -98,7 +98,8 @@ package Prj.Conf is
Normalized_Hostname : String;
Report_Error : Put_Line_Access := null;
On_Load_Config : Config_File_Hook := null;
- Compiler_Driver_Mandatory : Boolean := True);
+ Compiler_Driver_Mandatory : Boolean := True;
+ Allow_Duplicate_Basenames : Boolean := False);
-- Same as above, except the project must already have been parsed through
-- Prj.Part.Parse, and only the processing of the project and the
-- configuration is done at this level.
diff --git a/gcc/ada/prj-nmsc.adb b/gcc/ada/prj-nmsc.adb
index 2bd72bf..c503b5e 100644
--- a/gcc/ada/prj-nmsc.adb
+++ b/gcc/ada/prj-nmsc.adb
@@ -240,7 +240,6 @@ package body Prj.Nmsc is
Naming_Exception : Boolean := False;
Path : Path_Information := No_Path_Information;
Alternate_Languages : Language_List := null;
- Other_Part : Source_Id := No_Source;
Unit : Name_Id := No_Name;
Index : Int := 0;
Source_To_Replace : Source_Id := No_Source);
@@ -378,11 +377,15 @@ package body Prj.Nmsc is
procedure Search_Directories
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
- For_All_Sources : Boolean);
+ For_All_Sources : Boolean;
+ Allow_Duplicate_Basenames : Boolean);
-- Search the source directories to find the sources.
-- If For_All_Sources is True, check each regular file name against the
-- naming schemes of the different languages. Otherwise consider only the
-- file names in the hash table Source_Names.
+ -- If Allow_Duplicate_Basenames, then files with the same base names are
+ -- authorized within a project for source-based languages (never for unit
+ -- based languages)
procedure Check_File
(Project : Project_Id;
@@ -390,7 +393,8 @@ package body Prj.Nmsc is
Path : Path_Name_Type;
File_Name : File_Name_Type;
Display_File_Name : File_Name_Type;
- For_All_Sources : Boolean);
+ For_All_Sources : Boolean;
+ Allow_Duplicate_Basenames : Boolean);
-- Check if file File_Name is a valid source of the project. This is used
-- in multi-language mode only.
-- When the file matches one of the naming schemes, it is added to
@@ -409,6 +413,10 @@ package body Prj.Nmsc is
--
-- If For_All_Sources is True, then all possible file names are analyzed
-- otherwise only those currently set in the Source_Names htable.
+ --
+ -- If Allow_Duplicate_Basenames, then files with the same base names are
+ -- authorized within a project for source-based languages (never for unit
+ -- based languages)
procedure Check_File_Naming_Schemes
(In_Tree : Project_Tree_Ref;
@@ -459,11 +467,15 @@ package body Prj.Nmsc is
procedure Find_Sources
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
- Proc_Data : in out Processing_Data);
+ Proc_Data : in out Processing_Data;
+ Allow_Duplicate_Basenames : Boolean);
-- Process the Source_Files and Source_List_File attributes, and store
-- the list of source files into the Source_Names htable.
-- When these attributes are not defined, find all files matching the
-- naming schemes in the source directories.
+ -- If Allow_Duplicate_Basenames, then files with the same base names are
+ -- authorized within a project for source-based languages (never for unit
+ -- based languages)
procedure Compute_Unit_Name
(File_Name : File_Name_Type;
@@ -525,11 +537,15 @@ package body Prj.Nmsc is
procedure Look_For_Sources
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
- Proc_Data : in out Processing_Data);
+ Proc_Data : in out Processing_Data;
+ Allow_Duplicate_Basenames : Boolean);
-- Find all the sources of project Project in project tree In_Tree and
-- update its Data accordingly. This assumes that Data.First_Source has
-- been initialized with the list of excluded sources and special naming
-- exceptions.
+ -- If Allow_Duplicate_Basenames, then files with the same base names are
+ -- authorized within a project for source-based languages (never for unit
+ -- based languages)
function Path_Name_Of
(File_Name : File_Name_Type;
@@ -683,7 +699,6 @@ package body Prj.Nmsc is
Naming_Exception : Boolean := False;
Path : Path_Information := No_Path_Information;
Alternate_Languages : Language_List := null;
- Other_Part : Source_Id := No_Source;
Unit : Name_Id := No_Name;
Index : Int := 0;
Source_To_Replace : Source_Id := No_Source)
@@ -716,11 +731,6 @@ package body Prj.Nmsc is
Id.Language := Lang_Id;
Id.Kind := Kind;
Id.Alternate_Languages := Alternate_Languages;
- Id.Other_Part := Other_Part;
-
- if Other_Part /= No_Source then
- Other_Part.Other_Part := Id;
- end if;
-- Add the source id to the Unit_Sources_HT hash table, if the unit name
-- is not null.
@@ -820,7 +830,8 @@ package body Prj.Nmsc is
Current_Dir : String;
Proc_Data : in out Processing_Data;
Is_Config_File : Boolean;
- Compiler_Driver_Mandatory : Boolean)
+ Compiler_Driver_Mandatory : Boolean;
+ Allow_Duplicate_Basenames : Boolean)
is
Extending : Boolean := False;
@@ -911,7 +922,8 @@ package body Prj.Nmsc is
-- Find the sources
if Project.Source_Dirs /= Nil_String then
- Look_For_Sources (Project, In_Tree, Proc_Data);
+ Look_For_Sources
+ (Project, In_Tree, Proc_Data, Allow_Duplicate_Basenames);
if Get_Mode = Ada_Only then
@@ -2533,6 +2545,7 @@ package body Prj.Nmsc is
Iter : Source_Iterator;
Source : Source_Id;
Project_2 : Project_Id;
+ Other : Source_Id;
begin
if not Interfaces.Default then
@@ -2573,9 +2586,11 @@ package body Prj.Nmsc is
Source.In_Interfaces := True;
Source.Declared_In_Interfaces := True;
- if Source.Other_Part /= No_Source then
- Source.Other_Part.In_Interfaces := True;
- Source.Other_Part.Declared_In_Interfaces := True;
+ Other := Other_Part (Source);
+
+ if Other /= No_Source then
+ Other.In_Interfaces := True;
+ Other.Declared_In_Interfaces := True;
end if;
if Current_Verbosity = High then
@@ -2971,7 +2986,6 @@ package body Prj.Nmsc is
Source : Source_Id;
Source_To_Replace : Source_Id := No_Source;
Other_Project : Project_Id;
- Other_Part : Source_Id := No_Source;
Iter : Source_Iterator;
begin
@@ -3049,8 +3063,6 @@ package body Prj.Nmsc is
if Source /= No_Source then
if Source.Kind /= Kind then
- Other_Part := Source;
-
loop
Next (Iter);
Source := Prj.Element (Iter);
@@ -3066,10 +3078,6 @@ package body Prj.Nmsc is
Other_Project := Source.Project;
if Is_Extending (Project, Other_Project) then
- Other_Part := Source.Other_Part;
-
- -- Record the source to be removed
-
Source_To_Replace := Source;
Source := No_Source;
@@ -3094,7 +3102,6 @@ package body Prj.Nmsc is
Kind => Kind,
File_Name => File_Name,
Display_File => File_Name_Type (Element.Value.Value),
- Other_Part => Other_Part,
Unit => Unit,
Index => Index,
Naming_Exception => True,
@@ -4661,9 +4668,9 @@ package body Prj.Nmsc is
if Source.Kind = Sep then
Source := No_Source;
elsif Source.Kind = Spec
- and then Source.Other_Part /= No_Source
+ and then Other_Part (Source) /= No_Source
then
- Source := Source.Other_Part;
+ Source := Other_Part (Source);
end if;
end if;
@@ -4683,10 +4690,10 @@ package body Prj.Nmsc is
(Interfaces).Location);
else
- if Source.Kind = Spec and then
- Source.Other_Part /= No_Source
+ if Source.Kind = Spec
+ and then Other_Part (Source) /= No_Source
then
- Source := Source.Other_Part;
+ Source := Other_Part (Source);
end if;
String_Element_Table.Increment_Last
@@ -6760,7 +6767,8 @@ package body Prj.Nmsc is
procedure Find_Sources
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
- Proc_Data : in out Processing_Data)
+ Proc_Data : in out Processing_Data;
+ Allow_Duplicate_Basenames : Boolean)
is
Sources : constant Variable_Value :=
Util.Value_Of
@@ -6926,7 +6934,8 @@ package body Prj.Nmsc is
Search_Directories
(Project, In_Tree,
For_All_Sources =>
- Sources.Default and then Source_List_File.Default);
+ Sources.Default and then Source_List_File.Default,
+ Allow_Duplicate_Basenames => Allow_Duplicate_Basenames);
end if;
-- Check if all exceptions have been found. For Ada, it is an error if
@@ -7342,7 +7351,8 @@ package body Prj.Nmsc is
Path : Path_Name_Type;
File_Name : File_Name_Type;
Display_File_Name : File_Name_Type;
- For_All_Sources : Boolean)
+ For_All_Sources : Boolean;
+ Allow_Duplicate_Basenames : Boolean)
is
Canonical_Path : constant Path_Name_Type :=
Path_Name_Type
@@ -7353,7 +7363,6 @@ package body Prj.Nmsc is
Alternate_Languages : Language_List;
Language : Language_Ptr;
Source : Source_Id;
- Other_Part : Source_Id;
Add_Src : Boolean;
Src_Ind : Source_File_Index;
Unit : Name_Id;
@@ -7414,8 +7423,6 @@ package body Prj.Nmsc is
end if;
if Check_Name then
- Other_Part := No_Source;
-
Check_File_Naming_Schemes
(In_Tree => In_Tree,
Project => Project,
@@ -7457,7 +7464,7 @@ package body Prj.Nmsc is
or else
(Source.Kind = Impl and then Kind = Spec))
then
- Other_Part := Source;
+ null; -- We found the "other_part (source)"
elsif (Unit /= No_Name
and then Source.Unit /= No_Unit_Index
@@ -7475,22 +7482,29 @@ package body Prj.Nmsc is
-- allowed if order of source directories is known.
if Project = Source.Project then
- if Project.Known_Order_Of_Source_Dirs then
- Add_Src := False;
-
- elsif Unit /= No_Name then
- Error_Msg_Name_1 := Unit;
- Error_Msg
- (Project, In_Tree, "duplicate unit %%",
- No_Location);
- Add_Src := False;
+ if Unit = No_Name then
+ if Allow_Duplicate_Basenames then
+ Add_Src := True;
+ elsif Project.Known_Order_Of_Source_Dirs then
+ Add_Src := False;
+ else
+ Error_Msg_File_1 := File_Name;
+ Error_Msg
+ (Project, In_Tree, "duplicate source file name {",
+ No_Location);
+ Add_Src := False;
+ end if;
else
- Error_Msg_File_1 := File_Name;
- Error_Msg
- (Project, In_Tree, "duplicate source file name {",
- No_Location);
- Add_Src := False;
+ if Project.Known_Order_Of_Source_Dirs then
+ Add_Src := False;
+ else
+ Error_Msg_Name_1 := Unit;
+ Error_Msg
+ (Project, In_Tree, "duplicate unit %%",
+ No_Location);
+ Add_Src := False;
+ end if;
end if;
-- Do not allow the same unit name in different projects,
@@ -7539,7 +7553,6 @@ package body Prj.Nmsc is
Alternate_Languages => Alternate_Languages,
File_Name => File_Name,
Display_File => Display_File_Name,
- Other_Part => Other_Part,
Unit => Unit,
Path => (Canonical_Path, Path),
Source_To_Replace => Source_To_Replace);
@@ -7555,7 +7568,8 @@ package body Prj.Nmsc is
procedure Search_Directories
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
- For_All_Sources : Boolean)
+ For_All_Sources : Boolean;
+ Allow_Duplicate_Basenames : Boolean)
is
Source_Dir : String_List_Id;
Element : String_Element;
@@ -7663,7 +7677,9 @@ package body Prj.Nmsc is
Path => Path,
File_Name => File_Name,
Display_File_Name => Display_File_Name,
- For_All_Sources => For_All_Sources);
+ For_All_Sources => For_All_Sources,
+ Allow_Duplicate_Basenames =>
+ Allow_Duplicate_Basenames);
end if;
end;
end if;
@@ -7761,7 +7777,8 @@ package body Prj.Nmsc is
procedure Look_For_Sources
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
- Proc_Data : in out Processing_Data)
+ Proc_Data : in out Processing_Data;
+ Allow_Duplicate_Basenames : Boolean)
is
Iter : Source_Iterator;
@@ -7914,7 +7931,7 @@ package body Prj.Nmsc is
else
case Src_Id.Kind is
when Spec =>
- if Src_Id.Other_Part = No_Source then
+ if Other_Part (Src_Id) = No_Source then
Check_Object (Src_Id);
end if;
@@ -7922,7 +7939,7 @@ package body Prj.Nmsc is
null;
when Impl =>
- if Src_Id.Other_Part /= No_Source then
+ if Other_Part (Src_Id) /= No_Source then
Check_Object (Src_Id);
else
@@ -7966,7 +7983,7 @@ package body Prj.Nmsc is
Load_Naming_Exceptions (Project, In_Tree);
end if;
- Find_Sources (Project, In_Tree, Proc_Data);
+ Find_Sources (Project, In_Tree, Proc_Data, Allow_Duplicate_Basenames);
Mark_Excluded_Sources;
if Get_Mode = Multi_Language then
@@ -8198,8 +8215,7 @@ package body Prj.Nmsc is
Path => (Canonical_Path, Path_Name),
Naming_Exception => Needs_Pragma,
Kind => Unit_Kind,
- Index => Unit_Ind,
- Other_Part => No_Source); -- ??? Can we find file ?
+ Index => Unit_Ind);
Source_Recorded := True;
end if;
end Record_Unit;
diff --git a/gcc/ada/prj-nmsc.ads b/gcc/ada/prj-nmsc.ads
index 8ab78af..dfb167c 100644
--- a/gcc/ada/prj-nmsc.ads
+++ b/gcc/ada/prj-nmsc.ads
@@ -48,7 +48,8 @@ private package Prj.Nmsc is
Current_Dir : String;
Proc_Data : in out Processing_Data;
Is_Config_File : Boolean;
- Compiler_Driver_Mandatory : Boolean);
+ Compiler_Driver_Mandatory : Boolean;
+ Allow_Duplicate_Basenames : Boolean);
-- Perform consistency and semantic checks on a project, starting from the
-- project tree parsed from the .gpr file. This procedure interprets the
-- various case statements in the project based on the current environment
@@ -74,6 +75,9 @@ private package Prj.Nmsc is
-- If Compiler_Driver_Mandatory is true, then a Compiler.Driver attribute
-- for each language must be defined, or we will not look for its source
-- files.
+ -- If Allow_Duplicate_Basenames, then files with the same base names are
+ -- authorized within a project for source-based languages (never for unit
+ -- based languages)
private
type Processing_Data is record
diff --git a/gcc/ada/prj-proc.adb b/gcc/ada/prj-proc.adb
index e509790..2946b42 100644
--- a/gcc/ada/prj-proc.adb
+++ b/gcc/ada/prj-proc.adb
@@ -84,11 +84,15 @@ package body Prj.Proc is
Current_Dir : String;
When_No_Sources : Error_Warning;
Is_Config_File : Boolean;
- Compiler_Driver_Mandatory : Boolean);
+ Compiler_Driver_Mandatory : Boolean;
+ Allow_Duplicate_Basenames : Boolean);
-- Set all projects to not checked, then call Recursive_Check for the
-- main project Project. Project is set to No_Project if errors occurred.
-- Current_Dir is for optimization purposes, avoiding extra system calls.
-- Is_Config_File should be True if Project is a config file (.cgpr).
+ -- If Allow_Duplicate_Basenames, then files with the same base names are
+ -- authorized within a project for source-based languages (never for unit
+ -- based languages)
procedure Copy_Package_Declarations
(From : Declarations;
@@ -154,6 +158,7 @@ package body Prj.Proc is
Proc_Data : Processing_Data;
Is_Config_File : Boolean;
Compiler_Driver_Mandatory : Boolean;
+ Allow_Duplicate_Basenames : Boolean;
end record;
-- Data passed to Recursive_Check
-- Current_Dir is for optimization purposes, avoiding extra system calls.
@@ -285,7 +290,8 @@ package body Prj.Proc is
Current_Dir : String;
When_No_Sources : Error_Warning;
Is_Config_File : Boolean;
- Compiler_Driver_Mandatory : Boolean)
+ Compiler_Driver_Mandatory : Boolean;
+ Allow_Duplicate_Basenames : Boolean)
is
Dir : aliased String := Current_Dir;
@@ -300,6 +306,7 @@ package body Prj.Proc is
Data.When_No_Sources := When_No_Sources;
Data.Is_Config_File := Is_Config_File;
Data.Compiler_Driver_Mandatory := Compiler_Driver_Mandatory;
+ Data.Allow_Duplicate_Basenames := Allow_Duplicate_Basenames;
Initialize (Data.Proc_Data);
@@ -330,8 +337,6 @@ package body Prj.Proc is
else
Unit_Htable.Remove (Name);
- Source1.Other_Part := Source2;
- Source2.Other_Part := Source1;
end if;
end if;
@@ -1263,6 +1268,7 @@ package body Prj.Proc is
When_No_Sources => When_No_Sources,
Current_Dir => Current_Dir,
Compiler_Driver_Mandatory => True,
+ Allow_Duplicate_Basenames => False,
Is_Config_File => Is_Config_File);
end if;
end Process;
@@ -2318,7 +2324,8 @@ package body Prj.Proc is
When_No_Sources : Error_Warning := Error;
Current_Dir : String;
Is_Config_File : Boolean;
- Compiler_Driver_Mandatory : Boolean)
+ Compiler_Driver_Mandatory : Boolean;
+ Allow_Duplicate_Basenames : Boolean)
is
Obj_Dir : Path_Name_Type;
Extending : Project_Id;
@@ -2334,7 +2341,8 @@ package body Prj.Proc is
if Project /= No_Project then
Check (In_Tree, Project, Current_Dir, When_No_Sources,
Is_Config_File => Is_Config_File,
- Compiler_Driver_Mandatory => Compiler_Driver_Mandatory);
+ Compiler_Driver_Mandatory => Compiler_Driver_Mandatory,
+ Allow_Duplicate_Basenames => Allow_Duplicate_Basenames);
end if;
-- If main project is an extending all project, set the object
@@ -2459,7 +2467,8 @@ package body Prj.Proc is
(Project, Data.In_Tree, Error_Report, Data.When_No_Sources,
Data.Current_Dir.all, Data.Proc_Data,
Compiler_Driver_Mandatory => Data.Compiler_Driver_Mandatory,
- Is_Config_File => Data.Is_Config_File);
+ Is_Config_File => Data.Is_Config_File,
+ Allow_Duplicate_Basenames => Data.Allow_Duplicate_Basenames);
end Recursive_Check;
-----------------------
diff --git a/gcc/ada/prj-proc.ads b/gcc/ada/prj-proc.ads
index 11f6f48..ae69d96 100644
--- a/gcc/ada/prj-proc.ads
+++ b/gcc/ada/prj-proc.ads
@@ -67,7 +67,8 @@ package Prj.Proc is
When_No_Sources : Error_Warning := Error;
Current_Dir : String;
Is_Config_File : Boolean;
- Compiler_Driver_Mandatory : Boolean);
+ Compiler_Driver_Mandatory : Boolean;
+ Allow_Duplicate_Basenames : Boolean);
-- Perform the second phase of the processing, filling the rest of the
-- project with the information extracted from the project tree. This phase
-- requires that the configuration file has already been parsed (in fact
@@ -78,6 +79,10 @@ package Prj.Proc is
-- Current_Dir is for optimization purposes, avoiding extra system calls.
--
-- Is_Config_File should be true if Project is a config file (.cgpr)
+ --
+ -- If Allow_Duplicate_Basenames, then files with the same base names are
+ -- authorized within a project for source-based languages (never for unit
+ -- based languages)
procedure Process
(In_Tree : Project_Tree_Ref;
diff --git a/gcc/ada/prj.ads b/gcc/ada/prj.ads
index 3dd6296..f1cc450 100644
--- a/gcc/ada/prj.ads
+++ b/gcc/ada/prj.ads
@@ -308,7 +308,8 @@ package Prj is
-- Constant indicating that there is no language data
function Get_Language_From_Name
- (Project : Project_Id; Name : String) return Language_Ptr;
+ (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
@@ -399,8 +400,13 @@ package Prj is
function Is_Compilable (Source : Source_Id) return Boolean;
pragma Inline (Is_Compilable);
- -- Return True if we know how to compile Source (ie if a compiler is
- -- defined). This doesn't indicate whether the source should be compiled
+ -- 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.
+
+ 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;
@@ -638,103 +644,102 @@ package Prj is
-- GNAT Project File(s).
type Source_Data is record
- Project : Project_Id := No_Project;
+ Project : Project_Id := No_Project;
-- Project of the source
- Language : Language_Ptr := No_Language_Index;
+ 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 : Language_List;
+ Alternate_Languages : Language_List;
-- 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
- 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 : Unit_Index := No_Unit_Index;
+ Unit : Unit_Index := No_Unit_Index;
-- Name of the unit, if language is unit based
- 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;
+ 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;
+ 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
-- Path.Name is set to Slash for an excluded file that does not belong
-- in the project in fact
- 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 : 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 : Time_Stamp_Type := Empty_Time_Stamp;
-- 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_Lang : Source_Id := No_Source;
+ Next_In_Lang : Source_Id := No_Source;
-- Link to another source of the same language in the same project
end record;
@@ -745,7 +750,6 @@ package Prj is
Declared_In_Interfaces => False,
Alternate_Languages => null,
Kind => Spec,
- Other_Part => No_Source,
Unit => No_Unit_Index,
Index => 0,
Locally_Removed => False,