Commit c9287857 by Emmanuel Briot Committed by Arnaud Charlet

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
parent 2b426674
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 '.'.
......
......@@ -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
......
......@@ -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.
......
......@@ -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
......
......@@ -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;
-----------------------
......
......@@ -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;
......
......@@ -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;
......@@ -659,15 +665,14 @@ package Prj is
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;
-- Name of the unit, if language is unit based
Index : Int := 0;
-- Index of the source in a multi unit source file
-- 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;
-- True if the source has been "excluded"
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment