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
This commit is contained in:
Emmanuel Briot 2011-08-03 15:30:38 +00:00 committed by Arnaud Charlet
parent fccd42a9a5
commit 41ba34dbe7
5 changed files with 435 additions and 136 deletions

View File

@ -1,3 +1,14 @@
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>
* sem_ch4.adb (Analyze_Conditional_Expression): only allow boolean

View File

@ -1297,7 +1297,10 @@ ada/a-ioexce.o : ada/ada.ads ada/a-except.ads ada/a-ioexce.ads \
ada/ada.o : ada/ada.ads ada/system.ads
ada/alfa.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alfa.ads ada/alfa.adb ada/gnat.ads ada/g-table.ads \
ada/a-uncdea.ads ada/alfa.ads ada/alfa.adb ada/alloc.ads ada/atree.ads \
ada/einfo.ads ada/snames.ads ada/interfac.ads ada/namet.ads \
ada/s-conca2.ads ada/sinfo.ads ada/table.ads ada/uintp.ads \
ada/urealp.ads ada/gnat.ads ada/g-table.ads \
ada/g-table.adb ada/hostparm.ads ada/output.ads ada/output.adb \
ada/put_alfa.ads ada/put_alfa.adb ada/system.ads ada/s-exctab.ads \
ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-soflin.ads \
@ -1862,27 +1865,27 @@ ada/exp_ch13.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/eval_fat.ads ada/exp_ch11.ads ada/exp_ch13.ads ada/exp_ch13.adb \
ada/exp_ch2.ads ada/exp_ch3.ads ada/exp_ch4.ads ada/exp_ch6.ads \
ada/exp_imgv.ads ada/exp_pakd.ads ada/exp_tss.ads ada/exp_util.ads \
ada/expander.ads ada/fname.ads ada/freeze.ads ada/get_targ.ads \
ada/gnat.ads ada/g-htable.ads ada/hlo.ads ada/hostparm.ads \
ada/inline.ads ada/interfac.ads ada/lib.ads ada/lib-load.ads \
ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
ada/rident.ads ada/rtsfind.ads ada/sem.ads ada/sem.adb ada/sem_attr.ads \
ada/sem_aux.ads ada/sem_ch10.ads ada/sem_ch11.ads ada/sem_ch12.ads \
ada/sem_ch13.ads ada/sem_ch2.ads ada/sem_ch3.ads ada/sem_ch4.ads \
ada/sem_ch5.ads ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads \
ada/sem_ch9.ads ada/sem_eval.ads ada/sem_prag.ads ada/sem_res.ads \
ada/sem_util.ads ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb \
ada/sinput.ads ada/snames.ads ada/sprint.ads ada/stand.ads \
ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads \
ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads \
ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads \
ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
ada/targparm.ads ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads \
ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads \
ada/widechar.ads
ada/expander.ads ada/fname.ads ada/fname-uf.ads ada/freeze.ads \
ada/get_targ.ads ada/gnat.ads ada/g-htable.ads ada/hlo.ads \
ada/hostparm.ads ada/inline.ads ada/interfac.ads ada/lib.ads \
ada/lib-load.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
ada/restrict.ads ada/restrict.adb ada/rident.ads ada/rtsfind.ads \
ada/sem.ads ada/sem.adb ada/sem_attr.ads ada/sem_aux.ads \
ada/sem_ch10.ads ada/sem_ch11.ads ada/sem_ch12.ads ada/sem_ch13.ads \
ada/sem_ch2.ads ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch5.ads \
ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_ch9.ads \
ada/sem_eval.ads ada/sem_prag.ads ada/sem_res.ads ada/sem_util.ads \
ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
ada/snames.ads ada/sprint.ads ada/stand.ads ada/system.ads \
ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads \
ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads ada/types.ads \
ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
ada/unchdeal.ads ada/urealp.ads ada/validsw.ads ada/widechar.ads
ada/exp_ch2.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@ -2072,34 +2075,35 @@ ada/exp_ch7.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads \
ada/debug_a.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \
ada/err_vars.ads ada/errout.ads ada/errout.adb ada/erroutc.ads \
ada/erroutc.adb ada/exp_aggr.ads ada/exp_ch11.ads ada/exp_ch6.ads \
ada/exp_ch7.ads ada/exp_ch7.adb ada/exp_ch9.ads ada/exp_dbug.ads \
ada/exp_disp.ads ada/exp_dist.ads ada/exp_tss.ads ada/exp_util.ads \
ada/exp_util.adb ada/expander.ads ada/fname.ads ada/fname-uf.ads \
ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-hesorg.ads \
ada/g-htable.ads ada/gnatvsn.ads ada/hlo.ads ada/hostparm.ads \
ada/inline.ads ada/interfac.ads ada/itypes.ads ada/lib.ads ada/lib.adb \
ada/lib-list.adb ada/lib-load.ads ada/lib-sort.adb ada/namet.ads \
ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb \
ada/opt.ads ada/output.ads ada/restrict.ads ada/restrict.adb \
ada/rident.ads ada/rtsfind.ads ada/rtsfind.adb ada/scans.ads \
ada/sem.ads ada/sem.adb ada/sem_attr.ads ada/sem_aux.ads \
ada/sem_aux.adb ada/sem_ch10.ads ada/sem_ch11.ads ada/sem_ch12.ads \
ada/sem_ch13.ads ada/sem_ch2.ads ada/sem_ch3.ads ada/sem_ch4.ads \
ada/sem_ch5.ads ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads \
ada/sem_ch9.ads ada/sem_dist.ads ada/sem_eval.ads ada/sem_prag.ads \
ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads ada/sinfo.ads \
ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
ada/stringt.ads ada/stylesw.ads ada/system.ads ada/s-exctab.ads \
ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads \
ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \
ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
ada/unchdeal.ads ada/urealp.ads ada/validsw.ads ada/widechar.ads
ada/elists.adb ada/err_vars.ads ada/errout.ads ada/errout.adb \
ada/erroutc.ads ada/erroutc.adb ada/exp_aggr.ads ada/exp_ch11.ads \
ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_ch7.adb ada/exp_ch9.ads \
ada/exp_dbug.ads ada/exp_disp.ads ada/exp_dist.ads ada/exp_tss.ads \
ada/exp_util.ads ada/exp_util.adb ada/expander.ads ada/fname.ads \
ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
ada/g-hesorg.ads ada/g-htable.ads ada/gnatvsn.ads ada/hlo.ads \
ada/hostparm.ads ada/inline.ads ada/interfac.ads ada/itypes.ads \
ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-load.ads \
ada/lib-sort.adb ada/namet.ads ada/namet.adb ada/nlists.ads \
ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
ada/restrict.ads ada/restrict.adb ada/rident.ads ada/rtsfind.ads \
ada/rtsfind.adb ada/scans.ads ada/sem.ads ada/sem.adb ada/sem_attr.ads \
ada/sem_aux.ads ada/sem_aux.adb ada/sem_ch10.ads ada/sem_ch11.ads \
ada/sem_ch12.ads ada/sem_ch13.ads ada/sem_ch2.ads ada/sem_ch3.ads \
ada/sem_ch4.ads ada/sem_ch5.ads ada/sem_ch6.ads ada/sem_ch7.ads \
ada/sem_ch8.ads ada/sem_ch9.ads ada/sem_dist.ads ada/sem_eval.ads \
ada/sem_prag.ads ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads \
ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
ada/stringt.ads ada/stringt.adb ada/stylesw.ads ada/system.ads \
ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads \
ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads \
ada/widechar.ads
ada/exp_ch8.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@ -2122,12 +2126,13 @@ ada/exp_ch8.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
ada/stringt.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
ada/s-rident.ads ada/s-secsta.ads ada/s-stalib.ads ada/s-stoele.ads \
ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads ada/types.ads \
ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
ada/unchdeal.ads ada/urealp.ads ada/validsw.ads ada/widechar.ads
ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads \
ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tree_io.ads \
ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads \
ada/widechar.ads
ada/exp_ch9.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@ -4483,42 +4488,42 @@ ada/sem_res.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/checks.adb \
ada/csets.ads ada/debug.ads ada/debug_a.ads ada/debug_a.adb \
ada/einfo.ads ada/einfo.adb ada/elists.ads ada/elists.adb \
ada/err_vars.ads ada/errout.ads ada/errout.adb ada/erroutc.ads \
ada/erroutc.adb ada/eval_fat.ads ada/exp_aggr.ads ada/exp_ch11.ads \
ada/exp_ch2.ads ada/exp_ch4.ads ada/exp_ch6.ads ada/exp_ch7.ads \
ada/exp_code.ads ada/exp_disp.ads ada/exp_dist.ads ada/exp_pakd.ads \
ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb ada/expander.ads \
ada/fname.ads ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads \
ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads ada/gnatvsn.ads \
ada/hlo.ads ada/hostparm.ads ada/inline.ads ada/interfac.ads \
ada/itypes.ads ada/lib.ads ada/lib.adb ada/lib-list.adb \
ada/lib-load.ads ada/lib-sort.adb ada/lib-util.ads ada/lib-xref.ads \
ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
ada/nmake.adb ada/opt.ads ada/output.ads ada/par_sco.ads \
ada/put_alfa.ads ada/restrict.ads ada/restrict.adb ada/rident.ads \
ada/rtsfind.ads ada/rtsfind.adb ada/scans.ads ada/sem.ads ada/sem.adb \
ada/sem_aggr.ads ada/sem_attr.ads ada/sem_aux.ads ada/sem_aux.adb \
ada/sem_cat.ads ada/sem_ch10.ads ada/sem_ch11.ads ada/sem_ch12.ads \
ada/sem_ch13.ads ada/sem_ch13.adb ada/sem_ch2.ads ada/sem_ch3.ads \
ada/sem_ch4.ads ada/sem_ch5.ads ada/sem_ch6.ads ada/sem_ch7.ads \
ada/sem_ch8.ads ada/sem_ch9.ads ada/sem_disp.ads ada/sem_dist.ads \
ada/sem_elab.ads ada/sem_elim.ads ada/sem_eval.ads ada/sem_eval.adb \
ada/sem_intr.ads ada/sem_prag.ads ada/sem_res.ads ada/sem_res.adb \
ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads \
ada/sem_warn.adb ada/sinfo.ads ada/sinfo.adb ada/sinfo-cn.ads \
ada/sinput.ads ada/sinput.adb ada/snames.ads ada/sprint.ads \
ada/stand.ads ada/stringt.ads ada/stringt.adb ada/style.ads \
ada/styleg.ads ada/styleg.adb ada/stylesw.ads ada/system.ads \
ada/s-carun8.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads \
ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads \
ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads \
ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
ada/targparm.ads ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \
ada/ttypes.ads ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb \
ada/uname.ads ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
ada/urealp.adb ada/validsw.ads ada/warnsw.ads ada/widechar.ads
ada/einfo.ads ada/einfo.adb ada/elists.ads ada/err_vars.ads \
ada/errout.ads ada/errout.adb ada/erroutc.ads ada/erroutc.adb \
ada/eval_fat.ads ada/exp_aggr.ads ada/exp_ch11.ads ada/exp_ch2.ads \
ada/exp_ch4.ads ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_code.ads \
ada/exp_disp.ads ada/exp_dist.ads ada/exp_pakd.ads ada/exp_tss.ads \
ada/exp_util.ads ada/exp_util.adb ada/expander.ads ada/fname.ads \
ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
ada/g-hesorg.ads ada/g-htable.ads ada/gnatvsn.ads ada/hlo.ads \
ada/hostparm.ads ada/inline.ads ada/interfac.ads ada/itypes.ads \
ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-load.ads \
ada/lib-sort.adb ada/lib-util.ads ada/lib-xref.ads ada/namet.ads \
ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb \
ada/opt.ads ada/output.ads ada/par_sco.ads ada/put_alfa.ads \
ada/restrict.ads ada/restrict.adb ada/rident.ads ada/rtsfind.ads \
ada/rtsfind.adb ada/scans.ads ada/sem.ads ada/sem.adb ada/sem_aggr.ads \
ada/sem_attr.ads ada/sem_aux.ads ada/sem_aux.adb ada/sem_cat.ads \
ada/sem_ch10.ads ada/sem_ch11.ads ada/sem_ch12.ads ada/sem_ch13.ads \
ada/sem_ch13.adb ada/sem_ch2.ads ada/sem_ch3.ads ada/sem_ch4.ads \
ada/sem_ch5.ads ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads \
ada/sem_ch9.ads ada/sem_disp.ads ada/sem_dist.ads ada/sem_elab.ads \
ada/sem_elim.ads ada/sem_eval.ads ada/sem_eval.adb ada/sem_intr.ads \
ada/sem_prag.ads ada/sem_res.ads ada/sem_res.adb ada/sem_type.ads \
ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads ada/sem_warn.adb \
ada/sinfo.ads ada/sinfo.adb ada/sinfo-cn.ads ada/sinput.ads \
ada/sinput.adb ada/snames.ads ada/sprint.ads ada/stand.ads \
ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \
ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-carun8.ads \
ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads \
ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb ada/uname.ads \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb \
ada/validsw.ads ada/warnsw.ads ada/widechar.ads
ada/sem_scil.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \

View File

@ -44,6 +44,7 @@ with Ada.Command_Line; use Ada.Command_Line;
with GNAT.Case_Util; use GNAT.Case_Util;
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
with GNAT.HTable;
with GNAT.Regexp; use GNAT.Regexp;
package body Makeutl is
@ -1230,7 +1231,9 @@ package body Makeutl is
procedure Add_Main
(Name : String;
Index : Int := 0;
Location : Source_Ptr := No_Location)
Location : Source_Ptr := No_Location;
Project : Project_Id := No_Project;
Tree : Project_Tree_Ref := null)
is
begin
Name_Len := 0;
@ -1238,7 +1241,8 @@ package body Makeutl is
Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
Names.Increment_Last;
Names.Table (Names.Last) := (Name_Find, Index, Location, No_Source);
Names.Table (Names.Last) :=
(Name_Find, Index, Location, No_Source, Project, Tree);
end Add_Main;
--------------------------
@ -1283,29 +1287,52 @@ package body Makeutl is
procedure Fill_From_Project
(Root_Project : Project_Id;
Project_Tree : Project_Tree_Ref) is
Project_Tree : Project_Tree_Ref)
is
procedure Add_Mains_From_Project
(Project : Project_Id; Tree : Project_Tree_Ref);
-- Add the main units from this project into Mains
procedure Add_Mains_From_Project
(Project : Project_Id;
Tree : Project_Tree_Ref)
is
List : String_List_Id;
Element : String_Element;
Agg : Aggregated_Project_List;
begin
Debug_Output ("Add_Mains_From_Project", Project.Name);
case Project.Qualifier is
when Aggregate =>
Agg := Project.Aggregated_Projects;
while Agg /= null loop
Add_Mains_From_Project (Agg.Project, Agg.Tree);
Agg := Agg.Next;
end loop;
when others =>
List := Project.Mains;
if List /= Prj.Nil_String then
-- The attribute Main is not an empty list.
-- Get the mains in the list
while List /= Prj.Nil_String loop
Element := Tree.Shared.String_Elements.Table (List);
Debug_Output ("Add_Main", Element.Value);
Add_Main (Name => Get_Name_String (Element.Value),
Index => Element.Index,
Location => Element.Location,
Project => Project,
Tree => Tree);
List := Element.Next;
end loop;
end if;
end case;
end Add_Mains_From_Project;
begin
if Number_Of_Mains = 0 then
declare
List : String_List_Id := Root_Project.Mains;
Element : String_Element;
begin
if List /= Prj.Nil_String then
-- The attribute Main is not an empty list.
-- Get the mains in the list
while List /= Prj.Nil_String loop
Element :=
Project_Tree.Shared.String_Elements.Table (List);
Add_Main (Name => Get_Name_String (Element.Value),
Index => Element.Index,
Location => Element.Location);
List := Element.Next;
end loop;
end if;
end;
Add_Mains_From_Project (Root_Project, Project_Tree);
end if;
-- If there are mains, check that they are sources of the main
@ -1314,7 +1341,7 @@ package body Makeutl is
if Mains.Number_Of_Mains > 0 then
for J in Names.First .. Names.Last loop
declare
File : constant Main_Info := Names.Table (J);
File : Main_Info := Names.Table (J);
Main_Id : File_Name_Type := File.File;
Main : constant String := Get_Name_String (Main_Id);
Project : Project_Id;
@ -1335,11 +1362,25 @@ package body Makeutl is
end if;
end if;
-- If no project or tree was specified for the main, it came
-- from the command line. In this case, it needs to belong
-- to the root project.
-- Note that the assignments below will not modify inside
-- the table itself.
if File.Project = null then
File.Project := Root_Project;
end if;
if File.Tree = null then
File.Tree := Project_Tree;
end if;
-- First, look for the main as specified.
Source := Find_Source
(In_Tree => Project_Tree,
Project => Project,
(In_Tree => File.Tree,
Project => File.Project,
Base_Name => File.File,
Index => File.Index);
@ -1350,11 +1391,11 @@ package body Makeutl is
-- Main already has a canonical casing
Main : constant String := Get_Name_String (Main_Id);
begin
Project := Root_Project;
Project := File.Project;
while Source = No_Source
and then Project /= No_Project
loop
Iter := For_Each_Source (Project_Tree, Project);
Iter := For_Each_Source (File.Tree, Project);
loop
Source := Prj.Element (Iter);
exit when Source = No_Source;
@ -1387,8 +1428,10 @@ package body Makeutl is
end if;
if Source /= No_Source then
Names.Table (J).File := Source.File;
Names.Table (J).Source := Source;
Names.Table (J).File := Source.File;
Names.Table (J).Project := File.Project;
Names.Table (J).Tree := File.Tree;
Names.Table (J).Source := Source;
elsif File.Location /= No_Location then
-- If the main is declared in package Builder of the
@ -1760,6 +1803,9 @@ package body Makeutl is
-- Whether S has already been processed. This marks the source as
-- processed, if it hasn't already been processed.
function Insert_No_Roots (Source : Source_Info) return Boolean;
-- Insert Source, but do not look for its roots (see doc for Insert).
-------------------
-- Was_Processed --
-------------------
@ -1951,12 +1997,16 @@ package body Makeutl is
end if;
end Initialize;
------------
-- Insert --
------------
---------------------
-- Insert_No_Roots --
---------------------
function Insert (Source : Source_Info) return Boolean is
function Insert_No_Roots (Source : Source_Info) return Boolean is
begin
pragma Assert
(Source.Format = Format_Gnatmake
or else Source.Id /= No_Source);
-- Only insert in the Q if it is not already done, to avoid
-- simultaneous compilations if -jnnn is used.
@ -1987,6 +2037,203 @@ package body Makeutl is
Write_Eol;
end if;
return True;
end Insert_No_Roots;
------------
-- Insert --
------------
function Insert
(Source : Source_Info; With_Roots : Boolean := False) return Boolean
is
Root_Arr : Array_Element_Id;
Roots : Variable_Value;
List : String_List_Id;
Elem : String_Element;
Unit_Name : Name_Id;
Pat_Root : Boolean;
Root_Pattern : Regexp;
Root_Found : Boolean;
Roots_Found : Boolean;
Dummy : Boolean;
Root_Source : Prj.Source_Id;
Iter : Source_Iterator;
pragma Unreferenced (Dummy);
begin
if not Insert_No_Roots (Source) then
-- Was already in the queue
return False;
end if;
if With_Roots and then Source.Format = Format_Gprbuild then
Debug_Output ("Looking for roots of", Name_Id (Source.Id.File));
Root_Arr :=
Prj.Util.Value_Of
(Name => Name_Roots,
In_Arrays => Source.Id.Project.Decl.Arrays,
Shared => Source.Tree.Shared);
Roots :=
Prj.Util.Value_Of
(Index => Name_Id (Source.Id.File),
Src_Index => 0,
In_Array => Root_Arr,
Shared => Source.Tree.Shared);
-- If there is no roots for the specific main, try the language
if Roots = Nil_Variable_Value then
Roots :=
Prj.Util.Value_Of
(Index => Source.Id.Language.Name,
Src_Index => 0,
In_Array => Root_Arr,
Shared => Source.Tree.Shared,
Force_Lower_Case_Index => True);
end if;
-- Then try "*"
if Roots = Nil_Variable_Value then
Name_Len := 1;
Name_Buffer (1) := '*';
Roots :=
Prj.Util.Value_Of
(Index => Name_Find,
Src_Index => 0,
In_Array => Root_Arr,
Shared => Source.Tree.Shared,
Force_Lower_Case_Index => True);
end if;
if Roots = Nil_Variable_Value then
Debug_Output (" -> no roots declared");
else
List := Roots.Values;
Pattern_Loop :
while List /= Nil_String loop
Elem := Source.Tree.Shared.String_Elements.Table (List);
Get_Name_String (Elem.Value);
To_Lower (Name_Buffer (1 .. Name_Len));
Unit_Name := Name_Find;
-- Check if it is a unit name or a pattern
Pat_Root := False;
for J in 1 .. Name_Len loop
if Name_Buffer (J) not in 'a' .. 'z'
and then Name_Buffer (J) not in '0' .. '9'
and then Name_Buffer (J) /= '_'
and then Name_Buffer (J) /= '.'
then
Pat_Root := True;
exit;
end if;
end loop;
if Pat_Root then
begin
Root_Pattern :=
Compile
(Pattern => Name_Buffer (1 .. Name_Len),
Glob => True);
exception
when Error_In_Regexp =>
Err_Vars.Error_Msg_Name_1 := Unit_Name;
Errutil.Error_Msg
("invalid pattern %", Roots.Location);
exit Pattern_Loop;
end;
end if;
Roots_Found := False;
Iter := For_Each_Source (Source.Tree);
Source_Loop :
loop
Root_Source := Prj.Element (Iter);
exit Source_Loop when Root_Source = No_Source;
Root_Found := False;
if Pat_Root then
Root_Found := Root_Source.Unit /= No_Unit_Index
and then Match
(Get_Name_String (Root_Source.Unit.Name),
Root_Pattern);
else
Root_Found :=
Root_Source.Unit /= No_Unit_Index
and then Root_Source.Unit.Name = Unit_Name;
end if;
if Root_Found then
case Root_Source.Kind is
when Impl =>
null;
when Spec =>
Root_Found := Other_Part (Root_Source) = No_Source;
when Sep =>
Root_Found := False;
end case;
end if;
if Root_Found then
Roots_Found := True;
Debug_Output
(" -> ", Name_Id (Root_Source.Display_File));
Dummy := Queue.Insert_No_Roots
(Source => (Format => Format_Gprbuild,
Tree => Source.Tree,
Id => Root_Source));
Initialize_Source_Record (Root_Source);
if Other_Part (Root_Source) /= No_Source then
Initialize_Source_Record (Other_Part (Root_Source));
end if;
-- Save the root for the binder.
Source.Id.Roots := new Source_Roots'
(Root => Root_Source,
Next => Source.Id.Roots);
exit Source_Loop when not Pat_Root;
end if;
Next (Iter);
end loop Source_Loop;
if not Roots_Found then
if Pat_Root then
if not Quiet_Output then
Error_Msg_Name_1 := Unit_Name;
Errutil.Error_Msg
("?no unit matches pattern %", Roots.Location);
end if;
else
Errutil.Error_Msg
("Unit " & Get_Name_String (Unit_Name)
& " does not exist", Roots.Location);
end if;
end if;
List := Elem.Next;
end loop Pattern_Loop;
end if;
end if;
return True;
end Insert;
@ -1994,11 +2241,13 @@ package body Makeutl is
-- Insert --
------------
procedure Insert (Source : Source_Info) is
procedure Insert
(Source : Source_Info; With_Roots : Boolean := False)
is
Discard : Boolean;
pragma Unreferenced (Discard);
begin
Discard := Insert (Source);
Discard := Insert (Source, With_Roots);
end Insert;
--------------
@ -2136,6 +2385,7 @@ package body Makeutl is
then
Queue.Insert
(Source => (Format => Format_Gprbuild,
Tree => Project_Tree,
Id => Source));
end if;
end if;
@ -2221,6 +2471,7 @@ package body Makeutl is
then
Queue.Insert
(Source => (Format => Format_Gprbuild,
Tree => Project_Tree,
Id => Src_Id));
end if;
end if;

View File

@ -245,15 +245,21 @@ package Makeutl is
File : File_Name_Type; -- Always canonical casing
Index : Int := 0;
Location : Source_Ptr := No_Location;
Source : Prj.Source_Id := No_Source;
Project : Project_Id;
Tree : Project_Tree_Ref;
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
procedure Add_Main
(Name : String;
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.
-- This is in general used to add the main files specified on the
-- command line.
@ -261,6 +267,10 @@ package Makeutl is
-- within the source is concerned.
-- Location is the location within the project file (if a project file
-- 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;
-- Empty the table
@ -290,8 +300,7 @@ package Makeutl is
Project_Tree : Project_Tree_Ref);
-- 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
-- project from all the
-- aggregated projects).
-- project from all the aggregated projects).
--
-- 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
@ -314,7 +323,8 @@ package Makeutl is
record
case Format is
when Format_Gprbuild =>
Id : Source_Id := null;
Tree : Project_Tree_Ref := null;
Id : Source_Id := null;
when Format_Gnatmake =>
File : File_Name_Type := No_File;
@ -352,11 +362,18 @@ package Makeutl is
-- Returns True if the queue is empty or if all object directories are
-- busy.
procedure Insert (Source : Source_Info);
function Insert (Source : Source_Info) return Boolean;
procedure Insert (Source : Source_Info; With_Roots : Boolean := False);
function Insert
(Source : Source_Info; With_Roots : Boolean := False) return Boolean;
-- Insert source in the queue.
-- The second version returns False if the Source was already marked in
-- 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
(Project : Project_Id;

View File

@ -660,6 +660,17 @@ package Prj is
No_Unit_Index : constant Unit_Index := null;
-- 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
type Source_Data is record
@ -784,6 +795,9 @@ package Prj is
Next_With_File_Name : Source_Id := No_Source;
-- Link to another source with the same base file name
Roots : Roots_Access := null;
-- The roots for a main unit
end record;
No_Source_Data : constant Source_Data :=
@ -821,7 +835,8 @@ package Prj is
Naming_Exception => False,
Duplicate_Unit => False,
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
(Header_Num => Header_Num,