Commit 444acbdd by Arnaud Charlet

[multiple changes]

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

	* make.adb, prj.adb, prj.ads (Compute_All_Imported_Projects): Also
	initialize aggregated projects.

2011-08-29  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch8.adb (Find_Renamed_Entity): Within an instance, use scope
	depth of candidates to resolve a potentially spurious ambiguity between
	two visible subprograms.

From-SVN: r178225
parent e0296583
2011-08-29 Emmanuel Briot <briot@adacore.com>
* make.adb, prj.adb, prj.ads (Compute_All_Imported_Projects): Also
initialize aggregated projects.
2011-08-29 Ed Schonberg <schonberg@adacore.com>
* sem_ch8.adb (Find_Renamed_Entity): Within an instance, use scope
depth of candidates to resolve a potentially spurious ambiguity between
two visible subprograms.
2011-08-29 Yannick Moy <moy@adacore.com>
* sem_prag.adb (Analyze_Pragma): Allow Test_Case pragma without
......
......@@ -6621,7 +6621,7 @@ package body Make is
Add_Object_Directories (Main_Project, Project_Tree);
Recursive_Compute_Depth (Main_Project);
Compute_All_Imported_Projects (Project_Tree);
Compute_All_Imported_Projects (Main_Project, Project_Tree);
else
......
......@@ -1283,7 +1283,24 @@ package body Prj is
-- Compute_All_Imported_Projects --
-----------------------------------
procedure Compute_All_Imported_Projects (Tree : Project_Tree_Ref) is
procedure Compute_All_Imported_Projects
(Root_Project : Project_Id;
Tree : Project_Tree_Ref)
is
procedure Analyze_Tree
(Local_Root : Project_Id; Local_Tree : Project_Tree_Ref);
-- Process Project and all its aggregated project to analyze their own
-- imported projects.
------------------
-- Analyze_Tree --
------------------
procedure Analyze_Tree
(Local_Root : Project_Id; Local_Tree : Project_Tree_Ref)
is
pragma Unreferenced (Local_Root);
Project : Project_Id;
procedure Recursive_Add
......@@ -1313,9 +1330,9 @@ package body Prj is
if Project /= Prj2 then
-- Check that the project is not already in the list. We know the
-- one passed to Recursive_Add have never been visited before, but
-- the one passed it are the extended projects.
-- Check that the project is not already in the list. We know
-- the one passed to Recursive_Add have never been visited
-- before, but the one passed it are the extended projects.
List := Project.All_Imported_Projects;
while List /= null loop
......@@ -1340,15 +1357,23 @@ package body Prj is
Dummy : Boolean := False;
List : Project_List;
begin
List := Tree.Projects;
List := Local_Tree.Projects;
while List /= null loop
Project := List.Project;
Free_List (Project.All_Imported_Projects, Free_Project => False);
For_All_Projects (Project, Tree, Dummy, Include_Aggregated => False);
Free_List
(Project.All_Imported_Projects, Free_Project => False);
For_All_Projects
(Project, Local_Tree, Dummy, Include_Aggregated => False);
List := List.Next;
end loop;
end Analyze_Tree;
procedure For_Aggregates is
new For_Project_And_Aggregated (Analyze_Tree);
begin
For_Aggregates (Root_Project, Tree);
end Compute_All_Imported_Projects;
-------------------
......
......@@ -909,9 +909,11 @@ package Prj is
-- 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);
procedure Compute_All_Imported_Projects
(Root_Project : Project_Id;
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
-- directly or indirectly by project Root_Project. The result is stored in
-- Project.All_Imported_Projects for each project
function Ultimate_Extending_Project_Of
......
......@@ -4841,7 +4841,9 @@ package body Sem_Ch8 is
Set_Entity_Or_Discriminal (N, E);
if Ada_Version >= Ada_2012
and then Nkind (Parent (N)) in N_Subexpr
and then
(Nkind (Parent (N)) in N_Subexpr
or else Nkind (Parent (N)) = N_Object_Declaration)
then
Check_Implicit_Dereference (N, Etype (E));
end if;
......@@ -5531,13 +5533,30 @@ package body Sem_Ch8 is
if Present (Inst) then
if Within (It.Nam, Inst) then
return (It.Nam);
if Within (Old_S, Inst) then
-- Choose the innermost subprogram, which would
-- have hidden the outer one in the generic.
if Scope_Depth (It.Nam) <
Scope_Depth (Old_S)
then
return Old_S;
else
return It.Nam;
end if;
end if;
elsif Within (Old_S, Inst) then
return (Old_S);
else
return Report_Overload;
end if;
-- If not within an instance, ambiguity is real.
else
return Report_Overload;
end if;
......
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