diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2020-04-01 18:19:40 +0200 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-06-15 04:04:40 -0400 |
commit | 65e088926639654e51b8e85be481d586505b56b4 (patch) | |
tree | cc23c687f5cb165101fe211531e91a4021467008 | |
parent | c5a913d3fd22769d66d480c2487edcf1d50644c5 (diff) | |
download | gcc-65e088926639654e51b8e85be481d586505b56b4.zip gcc-65e088926639654e51b8e85be481d586505b56b4.tar.gz gcc-65e088926639654e51b8e85be481d586505b56b4.tar.bz2 |
[Ada] Do expect task discriminants in Global and Depends contracts
2020-06-15 Piotr Trojanek <trojanek@adacore.com>
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.
-rw-r--r-- | gcc/ada/sem_prag.adb | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index eb374c4..673954a 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); |