[Ada] Check entries for formals of mode IN appearing as global outputs
authorPiotr Trojanek <trojanek@adacore.com>
Mon, 21 Dec 2020 23:58:21 +0000 (00:58 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 4 May 2021 09:17:30 +0000 (05:17 -0400)
gcc/ada/

* sem_prag.adb (Check_Mode_Restriction_In_Enclosing_Context):
Extend check to protected entries.

gcc/ada/sem_prag.adb

index 3009421..b13894c 100644 (file)
@@ -2634,7 +2634,7 @@ package body Sem_Prag is
                   Context := Anonymous_Object (Context);
                end if;
 
-               if (Is_Subprogram (Context)
+               if (Is_Subprogram_Or_Entry (Context)
                      or else Ekind (Context) = E_Task_Type
                      or else Is_Single_Task_Object (Context))
                  and then
@@ -2659,7 +2659,7 @@ package body Sem_Prag is
                        ("global item & cannot have mode In_Out or Output",
                         Item, Item_Id);
 
-                     if Is_Subprogram (Context) then
+                     if Is_Subprogram_Or_Entry (Context) then
                         SPARK_Msg_NE
                           (Fix_Msg (Subp_Id, "\item already appears as input "
                            & "of subprogram &"), Item, Context);