]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Complete implementation of Ada 2022 aspect Exclusive_Functions
authorPiotr Trojanek <trojanek@adacore.com>
Thu, 25 Jan 2024 18:09:01 +0000 (19:09 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 13 May 2024 08:03:31 +0000 (10:03 +0200)
Extend implementation of RM 9.5.1(7/4), which now applies also to
protected function if the protected type has aspect Exclusive_Functions.

gcc/ada/

* exp_ch9.adb (Build_Protected_Subprogram_Call_Cleanup): If
aspect Exclusive_Functions is present then the cleanup of a
protected function now services queued entries, just like the
cleanup of a protected procedure.

gcc/ada/exp_ch9.adb

index 17d997b9f6031631030c9d61aaec1745a4bd0525..1b231b8bf2c250e1e57b7ecab177e871189b5dfa 100644 (file)
@@ -4032,12 +4032,25 @@ package body Exp_Ch9 is
       Nam : Node_Id;
 
    begin
-      --  If the associated protected object has entries, a protected
-      --  procedure has to service entry queues. In this case generate:
+      --  If the associated protected object has entries, the expanded
+      --  exclusive protected operation has to service entry queues. In
+      --  this case generate:
 
       --    Service_Entries (_object._object'Access);
 
-      if Nkind (Op_Spec) = N_Procedure_Specification
+      if (Nkind (Op_Spec) = N_Procedure_Specification
+            or else
+          (Nkind (Op_Spec) = N_Function_Specification
+             and then Has_Aspect (Conc_Typ, Aspect_Exclusive_Functions)
+             and then
+               (No
+                 (Find_Value_Of_Aspect (Conc_Typ,
+                    Aspect_Exclusive_Functions))
+                  or else
+                Is_True
+                  (Static_Boolean
+                     (Find_Value_Of_Aspect
+                        (Conc_Typ, Aspect_Exclusive_Functions))))))
         and then Has_Entries (Conc_Typ)
       then
          case Corresponding_Runtime_Package (Conc_Typ) is