aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2018-07-17 08:05:29 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-07-17 08:05:29 +0000
commitad8adad11752db7a98fce95d9090f4c6fbb849b7 (patch)
tree2941ff6bac237308cf8c36980db098063b826c12
parent8d45ce773959d3e89c18790d9f5b48d526dcdd07 (diff)
downloadgcc-ad8adad11752db7a98fce95d9090f4c6fbb849b7.zip
gcc-ad8adad11752db7a98fce95d9090f4c6fbb849b7.tar.gz
gcc-ad8adad11752db7a98fce95d9090f4c6fbb849b7.tar.bz2
[Ada] Fix unnesting issues involving tasks
2018-07-17 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * sem_util.adb (Enclosing_Subprogram): Handle properly entries, and synchronized types that are completions of limited types or private extensions. (Scope_Within): Handle properly accept statements in task bodies. From-SVN: r262769
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/sem_util.adb27
2 files changed, 30 insertions, 4 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index b322861..294602e 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,10 @@
+2018-07-17 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_util.adb (Enclosing_Subprogram): Handle properly entries, and
+ synchronized types that are completions of limited types or private
+ extensions.
+ (Scope_Within): Handle properly accept statements in task bodies.
+
2018-07-17 Hristian Kirtchev <kirtchev@adacore.com>
* sem_prag.adb (Has_Visible_State): Do not consider generic formals
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 0977392..3b14252 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -6906,17 +6906,21 @@ package body Sem_Util is
elsif Ekind (Dynamic_Scope) = E_Subprogram_Body then
return Corresponding_Spec (Parent (Parent (Dynamic_Scope)));
- elsif Ekind (Dynamic_Scope) = E_Block
- or else Ekind (Dynamic_Scope) = E_Return_Statement
+ elsif Ekind_In (Dynamic_Scope, E_Block, E_Return_Statement, E_Entry)
then
return Enclosing_Subprogram (Dynamic_Scope);
elsif Ekind (Dynamic_Scope) = E_Task_Type then
return Get_Task_Body_Procedure (Dynamic_Scope);
- elsif Ekind (Dynamic_Scope) = E_Limited_Private_Type
+ -- The scope may appear as a private type or as a private extension
+ -- whose completion is a task or protected type.
+
+ elsif Ekind_In (Dynamic_Scope,
+ E_Limited_Private_Type, E_Record_Type_With_Private)
and then Present (Full_View (Dynamic_Scope))
- and then Ekind (Full_View (Dynamic_Scope)) = E_Task_Type
+ and then Ekind_In (Full_View (Dynamic_Scope),
+ E_Task_Type, E_Protected_Type)
then
return Get_Task_Body_Procedure (Full_View (Dynamic_Scope));
@@ -23994,6 +23998,21 @@ package body Sem_Util is
if Curr = Outer then
return True;
+
+ -- A selective accept body appears within a task type, but the
+ -- enclosing subprogram is the procedure of the task body.
+
+ elsif Ekind (Curr) = E_Task_Type
+ and then Outer = Task_Body_Procedure (Curr)
+ then
+ return True;
+
+ -- Ditto for the body of a protected operation.
+
+ elsif Is_Subprogram (Curr)
+ and then Outer = Protected_Body_Subprogram (Curr)
+ then
+ return True;
end if;
end loop;