diff options
author | Ronan Desplanques <desplanques@adacore.com> | 2024-11-21 10:01:47 +0100 |
---|---|---|
committer | Marc Poulhiès <dkm@gcc.gnu.org> | 2024-12-12 10:58:00 +0100 |
commit | 8f931770a52e208b0f66066e8c6e09214597655f (patch) | |
tree | bf1b74fbaa619e04ec050cc3da9c7454e02d92df /gcc | |
parent | 6b23686af726cba55d1ec07748e4ba0324cf2930 (diff) | |
download | gcc-8f931770a52e208b0f66066e8c6e09214597655f.zip gcc-8f931770a52e208b0f66066e8c6e09214597655f.tar.gz gcc-8f931770a52e208b0f66066e8c6e09214597655f.tar.bz2 |
ada: Improve task entry context detection
Access parameters are not allowed in specifications of task entries.
Before this patch, the compiler failed to detect that case in accept
statements that were not directly in their task body's scopes. This
patch fixes this issue.
gcc/ada/ChangeLog:
* sem_ch3.adb (Access_Definition): Remove test for task entry context.
* sem_ch6.adb (Process_Formals): Add improved test for task entry
context.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/sem_ch3.adb | 7 | ||||
-rw-r--r-- | gcc/ada/sem_ch6.adb | 10 |
2 files changed, 10 insertions, 7 deletions
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index a5d69c3..11f69db 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -761,13 +761,6 @@ package body Sem_Ch3 is Enclosing_Prot_Type : Entity_Id := Empty; begin - if Is_Entry (Current_Scope) - and then Is_Task_Type (Etype (Scope (Current_Scope))) - then - Error_Msg_N ("task entries cannot have access parameters", N); - return Empty; - end if; - -- Ada 2005: For an object declaration the corresponding anonymous -- type is declared in the current scope. diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 16f2965..1ac76bb 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -13144,6 +13144,16 @@ package body Sem_Ch6 is -- An access formal type else + if Nkind (Parent (T)) = N_Accept_Statement + or else (Nkind (Parent (T)) = N_Entry_Declaration + and then Nkind (Context) = N_Task_Definition) + then + Error_Msg_N + ("task entries cannot have access parameters", + Parameter_Type (Param_Spec)); + return; + end if; + Formal_Type := Access_Definition (Related_Nod, Parameter_Type (Param_Spec)); |