aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2011-08-29 15:31:02 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2011-08-29 15:31:02 +0200
commit444acbddf8211319b4adc6c9b161ce836db7d129 (patch)
tree3d87f1a7616c77e1cd8ee882c97c12269c878086
parente02965831e0ec57a216cc64e38ebcdb10bc1e77f (diff)
downloadgcc-444acbddf8211319b4adc6c9b161ce836db7d129.zip
gcc-444acbddf8211319b4adc6c9b161ce836db7d129.tar.gz
gcc-444acbddf8211319b4adc6c9b161ce836db7d129.tar.bz2
[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
-rw-r--r--gcc/ada/ChangeLog11
-rw-r--r--gcc/ada/make.adb2
-rw-r--r--gcc/ada/prj.adb131
-rw-r--r--gcc/ada/prj.ads6
-rw-r--r--gcc/ada/sem_ch8.adb23
5 files changed, 115 insertions, 58 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index d99c28a..f96c6c8 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,14 @@
+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
diff --git a/gcc/ada/make.adb b/gcc/ada/make.adb
index 7b9087f..3cf73c8 100644
--- a/gcc/ada/make.adb
+++ b/gcc/ada/make.adb
@@ -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
diff --git a/gcc/ada/prj.adb b/gcc/ada/prj.adb
index fc65860..63fb127 100644
--- a/gcc/ada/prj.adb
+++ b/gcc/ada/prj.adb
@@ -1283,72 +1283,97 @@ package body Prj is
-- Compute_All_Imported_Projects --
-----------------------------------
- procedure Compute_All_Imported_Projects (Tree : Project_Tree_Ref) is
- 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)
+ 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 (Dummy, Tree);
- List : Project_List;
- Prj2 : Project_Id;
+ pragma Unreferenced (Local_Root);
+
+ 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
- -- A project is not importing itself
+ begin
+ -- 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
- -- 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
- if List.Project = Prj2 then
- return;
- end if;
+ List := Project.All_Imported_Projects;
+ while List /= null loop
+ if List.Project = Prj2 then
+ return;
+ end if;
- List := List.Next;
- end loop;
+ List := List.Next;
+ end loop;
- -- Add it to the list
+ -- Add it to the list
- Project.All_Imported_Projects :=
- new Project_List_Element'
- (Project => Prj2,
- Next => Project.All_Imported_Projects);
- end if;
- end Recursive_Add;
+ Project.All_Imported_Projects :=
+ new Project_List_Element'
+ (Project => Prj2,
+ Next => Project.All_Imported_Projects);
+ end if;
+ end Recursive_Add;
- procedure For_All_Projects is
- new For_Every_Project_Imported (Boolean, Recursive_Add);
+ procedure For_All_Projects is
+ new For_Every_Project_Imported (Boolean, Recursive_Add);
- Dummy : Boolean := False;
- List : Project_List;
+ Dummy : Boolean := False;
+ 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
- List := 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);
- List := List.Next;
- end loop;
+ For_Aggregates (Root_Project, Tree);
end Compute_All_Imported_Projects;
-------------------
diff --git a/gcc/ada/prj.ads b/gcc/ada/prj.ads
index aa953b3..6cd46d3 100644
--- a/gcc/ada/prj.ads
+++ b/gcc/ada/prj.ads
@@ -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
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index 6340b2a..deb25af 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -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;