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> 2011-08-29 Yannick Moy <moy@adacore.com>
* sem_prag.adb (Analyze_Pragma): Allow Test_Case pragma without * sem_prag.adb (Analyze_Pragma): Allow Test_Case pragma without
......
...@@ -6621,7 +6621,7 @@ package body Make is ...@@ -6621,7 +6621,7 @@ package body Make is
Add_Object_Directories (Main_Project, Project_Tree); Add_Object_Directories (Main_Project, Project_Tree);
Recursive_Compute_Depth (Main_Project); Recursive_Compute_Depth (Main_Project);
Compute_All_Imported_Projects (Project_Tree); Compute_All_Imported_Projects (Main_Project, Project_Tree);
else else
......
...@@ -1283,72 +1283,97 @@ package body Prj is ...@@ -1283,72 +1283,97 @@ package body Prj is
-- Compute_All_Imported_Projects -- -- Compute_All_Imported_Projects --
----------------------------------- -----------------------------------
procedure Compute_All_Imported_Projects (Tree : Project_Tree_Ref) is procedure Compute_All_Imported_Projects
Project : Project_Id; (Root_Project : Project_Id;
Tree : Project_Tree_Ref)
procedure Recursive_Add is
(Prj : Project_Id; procedure Analyze_Tree
Tree : Project_Tree_Ref; (Local_Root : Project_Id; Local_Tree : Project_Tree_Ref);
Dummy : in out Boolean); -- Process Project and all its aggregated project to analyze their own
-- Recursively add the projects imported by project Project, but not -- imported projects.
-- those that are extended.
------------------
------------------- -- Analyze_Tree --
-- Recursive_Add -- ------------------
-------------------
procedure Analyze_Tree
procedure Recursive_Add (Local_Root : Project_Id; Local_Tree : Project_Tree_Ref)
(Prj : Project_Id;
Tree : Project_Tree_Ref;
Dummy : in out Boolean)
is is
pragma Unreferenced (Dummy, Tree); pragma Unreferenced (Local_Root);
List : Project_List;
Prj2 : Project_Id; Project : Project_Id;
procedure Recursive_Add
(Prj : Project_Id;
Tree : Project_Tree_Ref;
Dummy : in out Boolean);
-- Recursively add the projects imported by project Project, but not
-- those that are extended.
-------------------
-- Recursive_Add --
-------------------
procedure Recursive_Add
(Prj : Project_Id;
Tree : Project_Tree_Ref;
Dummy : in out Boolean)
is
pragma Unreferenced (Dummy, Tree);
List : Project_List;
Prj2 : Project_Id;
begin begin
-- A project is not importing itself -- A project is not importing itself
Prj2 := Ultimate_Extending_Project_Of (Prj); Prj2 := Ultimate_Extending_Project_Of (Prj);
if Project /= Prj2 then if Project /= Prj2 then
-- Check that the project is not already in the list. We know the -- Check that the project is not already in the list. We know
-- one passed to Recursive_Add have never been visited before, but -- the one passed to Recursive_Add have never been visited
-- the one passed it are the extended projects. -- before, but the one passed it are the extended projects.
List := Project.All_Imported_Projects; List := Project.All_Imported_Projects;
while List /= null loop while List /= null loop
if List.Project = Prj2 then if List.Project = Prj2 then
return; return;
end if; end if;
List := List.Next; List := List.Next;
end loop; end loop;
-- Add it to the list -- Add it to the list
Project.All_Imported_Projects := Project.All_Imported_Projects :=
new Project_List_Element' new Project_List_Element'
(Project => Prj2, (Project => Prj2,
Next => Project.All_Imported_Projects); Next => Project.All_Imported_Projects);
end if; end if;
end Recursive_Add; end Recursive_Add;
procedure For_All_Projects is procedure For_All_Projects is
new For_Every_Project_Imported (Boolean, Recursive_Add); new For_Every_Project_Imported (Boolean, Recursive_Add);
Dummy : Boolean := False; Dummy : Boolean := False;
List : Project_List; List : Project_List;
begin
List := Local_Tree.Projects;
while List /= null loop
Project := List.Project;
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 begin
List := Tree.Projects; For_Aggregates (Root_Project, Tree);
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);
List := List.Next;
end loop;
end Compute_All_Imported_Projects; end Compute_All_Imported_Projects;
------------------- -------------------
......
...@@ -909,9 +909,11 @@ package Prj is ...@@ -909,9 +909,11 @@ package Prj is
-- If Only_If_Ada is True, then No_Name will be returned when the project -- If Only_If_Ada is True, then No_Name will be returned when the project
-- doesn't Ada sources. -- 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 -- 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 -- Project.All_Imported_Projects for each project
function Ultimate_Extending_Project_Of function Ultimate_Extending_Project_Of
......
...@@ -4841,7 +4841,9 @@ package body Sem_Ch8 is ...@@ -4841,7 +4841,9 @@ package body Sem_Ch8 is
Set_Entity_Or_Discriminal (N, E); Set_Entity_Or_Discriminal (N, E);
if Ada_Version >= Ada_2012 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 then
Check_Implicit_Dereference (N, Etype (E)); Check_Implicit_Dereference (N, Etype (E));
end if; end if;
...@@ -5531,13 +5533,30 @@ package body Sem_Ch8 is ...@@ -5531,13 +5533,30 @@ package body Sem_Ch8 is
if Present (Inst) then if Present (Inst) then
if Within (It.Nam, 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 elsif Within (Old_S, Inst) then
return (Old_S); return (Old_S);
else else
return Report_Overload; return Report_Overload;
end if; end if;
-- If not within an instance, ambiguity is real.
else else
return Report_Overload; return Report_Overload;
end if; 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