einfo.ads, einfo.adb: New attribute PPC_Wrapper for entries and entry families.
[gcc.git] / gcc / ada / sem_res.adb
index 5955070260a95b7a352df24eb49ccb7209bd3b95..3ca9798f9c38f4212b527afdcffbe8369ada26b5 100644 (file)
@@ -6327,6 +6327,29 @@ package body Sem_Res is
          end;
       end if;
 
+      if Ekind_In (Nam, E_Entry, E_Entry_Family)
+        and then Present (PPC_Wrapper (Nam))
+        and then Current_Scope /= PPC_Wrapper (Nam)
+      then
+
+         --  Rewrite as call to the precondition wrapper, adding the
+         --  task object to the list of actuals.
+
+         declare
+            New_Call : Node_Id;
+            New_Actuals : List_Id;
+         begin
+            New_Actuals := New_List (Obj);
+            Append_List (Parameter_Associations (N), New_Actuals);
+            New_Call := Make_Procedure_Call_Statement (Loc,
+              Name => New_Occurrence_Of (PPC_Wrapper (Nam), Loc),
+              Parameter_Associations => New_Actuals);
+            Rewrite (N, New_Call);
+            Analyze_And_Resolve (N);
+            return;
+         end;
+      end if;
+
       --  The operation name may have been overloaded. Order the actuals
       --  according to the formals of the resolved entity, and set the
       --  return type to that of the operation.