From 65e088926639654e51b8e85be481d586505b56b4 Mon Sep 17 00:00:00 2001 From: Piotr Trojanek Date: Wed, 1 Apr 2020 18:19:40 +0200 Subject: [PATCH] [Ada] Do expect task discriminants in Global and Depends contracts 2020-06-15 Piotr Trojanek gcc/ada/ * sem_prag.adb (Analyze_Depends_In_Decl_Part, Analyze_Global_In_Decl_Part): Bring back task discriminants for analysis of the Global/Depends contracts; add comments. --- gcc/ada/sem_prag.adb | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index eb374c4bb7a..673954acb5b 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -2001,7 +2001,14 @@ package body Sem_Prag is Push_Scope (Spec_Id); if Ekind (Spec_Id) = E_Task_Type then - null; + + -- Task discriminants cannot appear in the [Refined_]Depends + -- contract, but must be present for the analysis so that we + -- can reject them with an informative error message. + + if Has_Discriminants (Spec_Id) then + Install_Discriminants (Spec_Id); + end if; elsif Is_Generic_Subprogram (Spec_Id) then Install_Generic_Formals (Spec_Id); @@ -2789,7 +2796,14 @@ package body Sem_Prag is Push_Scope (Spec_Id); if Ekind (Spec_Id) = E_Task_Type then - null; + + -- Task discriminants cannot appear in the [Refined_]Global + -- contract, but must be present for the analysis so that we + -- can reject them with an informative error message. + + if Has_Discriminants (Spec_Id) then + Install_Discriminants (Spec_Id); + end if; elsif Is_Generic_Subprogram (Spec_Id) then Install_Generic_Formals (Spec_Id); -- 2.30.2