Commit 41ba34db by Emmanuel Briot Committed by Arnaud Charlet

prj.ads, [...] (Queue.Insert): now also inserts the "roots" for a main.

2011-08-03  Emmanuel Briot  <briot@adacore.com>

	* prj.ads, makeutl.adb, makeutl.ads (Queue.Insert): now also inserts
	the "roots" for a main.
	(Fill_From_Project): add support for aggregate projects. Main units
	in aggregated projects are now automatically added in the list of
	files to build (although this fails later on in gprbuild, because
	these files are not using the root proejct tree, so this needs
	further cleanup)
	* gcc-interface/Make-lang.in: Update dependencies.

From-SVN: r177287
parent fccd42a9
2011-08-03 Emmanuel Briot <briot@adacore.com>
* prj.ads, makeutl.adb, makeutl.ads (Queue.Insert): now also inserts
the "roots" for a main.
(Fill_From_Project): add support for aggregate projects. Main units
in aggregated projects are now automatically added in the list of
files to build (although this fails later on in gprbuild, because
these files are not using the root proejct tree, so this needs
further cleanup)
* gcc-interface/Make-lang.in: Update dependencies.
2011-08-03 Yannick Moy <moy@adacore.com> 2011-08-03 Yannick Moy <moy@adacore.com>
* sem_ch4.adb (Analyze_Conditional_Expression): only allow boolean * sem_ch4.adb (Analyze_Conditional_Expression): only allow boolean
......
...@@ -245,15 +245,21 @@ package Makeutl is ...@@ -245,15 +245,21 @@ package Makeutl is
File : File_Name_Type; -- Always canonical casing File : File_Name_Type; -- Always canonical casing
Index : Int := 0; Index : Int := 0;
Location : Source_Ptr := No_Location; Location : Source_Ptr := No_Location;
Source : Prj.Source_Id := No_Source; Source : Prj.Source_Id := No_Source;
Project : Project_Id;
Tree : Project_Tree_Ref;
end record; end record;
No_Main_Info : constant Main_Info := (No_File, 0, No_Location, No_Source); No_Main_Info : constant Main_Info :=
(No_File, 0, No_Location, No_Source, No_Project, null);
package Mains is package Mains is
procedure Add_Main procedure Add_Main
(Name : String; (Name : String;
Index : Int := 0; Index : Int := 0;
Location : Source_Ptr := No_Location); Location : Source_Ptr := No_Location;
Project : Project_Id := No_Project;
Tree : Project_Tree_Ref := null);
-- Add one main to the table. -- Add one main to the table.
-- This is in general used to add the main files specified on the -- This is in general used to add the main files specified on the
-- command line. -- command line.
...@@ -261,6 +267,10 @@ package Makeutl is ...@@ -261,6 +267,10 @@ package Makeutl is
-- within the source is concerned. -- within the source is concerned.
-- Location is the location within the project file (if a project file -- Location is the location within the project file (if a project file
-- is used). -- is used).
-- Project and Tree indicate to which project the main should belong.
-- In particular, for aggregate projects, this isn't necessarily the
-- main project tree. These can be set to No_Project and null when not
-- using projects.
procedure Delete; procedure Delete;
-- Empty the table -- Empty the table
...@@ -290,8 +300,7 @@ package Makeutl is ...@@ -290,8 +300,7 @@ package Makeutl is
Project_Tree : Project_Tree_Ref); Project_Tree : Project_Tree_Ref);
-- If no main was already added (presumably from the command line), add -- If no main was already added (presumably from the command line), add
-- the main units from root_project (or in the case of an aggregate -- the main units from root_project (or in the case of an aggregate
-- project from all the -- project from all the aggregated projects).
-- aggregated projects).
-- --
-- If some main units were already added from the command line, check -- If some main units were already added from the command line, check
-- that they all belong to the root project, and that they are full -- that they all belong to the root project, and that they are full
...@@ -314,7 +323,8 @@ package Makeutl is ...@@ -314,7 +323,8 @@ package Makeutl is
record record
case Format is case Format is
when Format_Gprbuild => when Format_Gprbuild =>
Id : Source_Id := null; Tree : Project_Tree_Ref := null;
Id : Source_Id := null;
when Format_Gnatmake => when Format_Gnatmake =>
File : File_Name_Type := No_File; File : File_Name_Type := No_File;
...@@ -352,11 +362,18 @@ package Makeutl is ...@@ -352,11 +362,18 @@ package Makeutl is
-- Returns True if the queue is empty or if all object directories are -- Returns True if the queue is empty or if all object directories are
-- busy. -- busy.
procedure Insert (Source : Source_Info); procedure Insert (Source : Source_Info; With_Roots : Boolean := False);
function Insert (Source : Source_Info) return Boolean; function Insert
(Source : Source_Info; With_Roots : Boolean := False) return Boolean;
-- Insert source in the queue. -- Insert source in the queue.
-- The second version returns False if the Source was already marked in -- The second version returns False if the Source was already marked in
-- the queue. -- the queue.
-- If With_Roots is True and the source is in Format_Gprbuild mode (ie
-- with a project), this procedure also includes the "Roots" for this
-- main, ie all the other files that must be included in the library or
-- binary (in particular to combine Ada and C files connected through
-- pragma Export/Import). When the roots are computed, they are also
-- stored in the corresponding Source_Id for later reuse by the binder.
procedure Insert_Project_Sources procedure Insert_Project_Sources
(Project : Project_Id; (Project : Project_Id;
......
...@@ -660,6 +660,17 @@ package Prj is ...@@ -660,6 +660,17 @@ package Prj is
No_Unit_Index : constant Unit_Index := null; No_Unit_Index : constant Unit_Index := null;
-- Used to indicate a null entry for no unit -- Used to indicate a null entry for no unit
type Source_Roots;
type Roots_Access is access Source_Roots;
type Source_Roots is record
Root : Source_Id;
Next : Roots_Access;
end record;
-- A list to store the roots associated with a main unit. These are the
-- files that need to linked along with the main (for instance a C file
-- corresponding to an Ada file). In general, these are dependencies that
-- cannot be computed automatically by the builder.
-- Structure to define source data -- Structure to define source data
type Source_Data is record type Source_Data is record
...@@ -784,6 +795,9 @@ package Prj is ...@@ -784,6 +795,9 @@ package Prj is
Next_With_File_Name : Source_Id := No_Source; Next_With_File_Name : Source_Id := No_Source;
-- Link to another source with the same base file name -- Link to another source with the same base file name
Roots : Roots_Access := null;
-- The roots for a main unit
end record; end record;
No_Source_Data : constant Source_Data := No_Source_Data : constant Source_Data :=
...@@ -821,7 +835,8 @@ package Prj is ...@@ -821,7 +835,8 @@ package Prj is
Naming_Exception => False, Naming_Exception => False,
Duplicate_Unit => False, Duplicate_Unit => False,
Next_In_Lang => No_Source, Next_In_Lang => No_Source,
Next_With_File_Name => No_Source); Next_With_File_Name => No_Source,
Roots => null);
package Source_Files_Htable is new Simple_HTable package Source_Files_Htable is new Simple_HTable
(Header_Num => Header_Num, (Header_Num => Header_Num,
......
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