aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorGary Dismukes <dismukes@adacore.com>2019-10-10 15:25:08 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-10-10 15:25:08 +0000
commit6c142b14a07b166fcb2809cd3c3fcd59a748ce7e (patch)
treeedf436e3c3c8c5b5d838648d74a63ec55bcef53d /gcc/ada
parent55160f6c7c838a2e35895cb741fff5ea237b1260 (diff)
downloadgcc-6c142b14a07b166fcb2809cd3c3fcd59a748ce7e.zip
gcc-6c142b14a07b166fcb2809cd3c3fcd59a748ce7e.tar.gz
gcc-6c142b14a07b166fcb2809cd3c3fcd59a748ce7e.tar.bz2
[Ada] Unnesting issues with entry families and accept statements
2019-10-10 Gary Dismukes <dismukes@adacore.com> gcc/ada/ * sem_util.adb (Enclosing_Subprogram): Handle the case of E_Entry_Family, returning the entry family's associated Protected_Body_Subprogram (as was already done for E_Entry). * exp_ch9.adb (Expand_N_Accept_Statement): Call Reset_Scopes_To on the block created for an accept statement to reset the scopes of any local entities to the block scope. From-SVN: r276830
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog12
-rw-r--r--gcc/ada/exp_ch9.adb7
-rw-r--r--gcc/ada/sem_util.adb12
3 files changed, 20 insertions, 11 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index c5e3f82..9cf5172 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,6 +1,8 @@
-2019-10-10 Ed Schonberg <schonberg@adacore.com>
+2019-10-10 Gary Dismukes <dismukes@adacore.com>
- * sem_ch12.adb (Analyze_Formal_Package_Declaration): Propagate
- an aspect specification for Abstract_State from generic package
- to formal package, so that it is available when analyzing the
- constructed formal. \ No newline at end of file
+ * sem_util.adb (Enclosing_Subprogram): Handle the case of
+ E_Entry_Family, returning the entry family's associated
+ Protected_Body_Subprogram (as was already done for E_Entry).
+ * exp_ch9.adb (Expand_N_Accept_Statement): Call Reset_Scopes_To
+ on the block created for an accept statement to reset the scopes
+ of any local entities to the block scope. \ No newline at end of file
diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb
index 99bd8d2..720c1a9 100644
--- a/gcc/ada/exp_ch9.adb
+++ b/gcc/ada/exp_ch9.adb
@@ -6624,6 +6624,13 @@ package body Exp_Ch9 is
Declarations => Declarations (N),
Handled_Statement_Sequence => Build_Accept_Body (N));
+ -- Reset the Scope of local entities associated with the accept
+ -- statement (that currently reference the entry scope) to the
+ -- block scope, to avoid having references to the locals treated
+ -- as up-level references.
+
+ Reset_Scopes_To (Block, Blkent);
+
-- For the analysis of the generated declarations, the parent node
-- must be properly set.
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 9569919..f488573 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -6997,17 +6997,17 @@ package body Sem_Util is
elsif Ekind_In (Dyn_Scop, E_Block, E_Loop, E_Return_Statement) then
return Enclosing_Subprogram (Dyn_Scop);
- elsif Ekind (Dyn_Scop) = E_Entry then
+ elsif Ekind_In (Dyn_Scop, E_Entry, E_Entry_Family) then
- -- For a task entry, return the enclosing subprogram of the
- -- task itself.
+ -- For a task entry or entry family, return the enclosing subprogram
+ -- of the task itself.
if Ekind (Scope (Dyn_Scop)) = E_Task_Type then
return Enclosing_Subprogram (Dyn_Scop);
- -- A protected entry is rewritten as a protected procedure which is
- -- the desired enclosing subprogram. This is relevant when unnesting
- -- a procedure local to an entry body.
+ -- A protected entry or entry family is rewritten as a protected
+ -- procedure which is the desired enclosing subprogram. This is
+ -- relevant when unnesting a procedure local to an entry body.
else
return Protected_Body_Subprogram (Dyn_Scop);