This patch enforces the restrictions No_Local_Timing_Events and
No_Specific_Termination_Handlers when the Ravenscar restrictions
are in effect, as required by D.13(6/3).

The following tests must trigger the following errors:

$ gcc -c tev.adb
tev.adb:6:04: violation of restriction "NO_LOCAL_TIMING_EVENTS"
tev.adb:6:04: from profile "RAVENSCAR" at line 1

$ gcc -c sth.adb
sth.adb:13:24: violation of restriction "NO_SPECIFIC_TERMINATION_HANDLERS"
sth.adb:13:24: from profile "RAVENSCAR" at line 1
sth.adb:16:30: violation of restriction "NO_SPECIFIC_TERMINATION_HANDLERS"
sth.adb:16:30: from profile "RAVENSCAR" at line 1

pragma Profile (Ravenscar);

with Ada.Real_Time.Timing_Events;

procedure TEV is
   E : Ada.Real_Time.Timing_Events.Timing_Event;
begin
   null;
end TEV;

pragma Profile (Ravenscar);

with Ada.Task_Termination;
with Ada.Task_Identification;
with Tasking;

procedure STH is
   TH : Ada.Task_Termination.Termination_Handler;
   Self : constant Ada.Task_Identification.Task_Id :=
      Ada.Task_Identification.Current_Task;

begin
   Ada.Task_Termination.Set_Specific_Handler
      (Self, Tasking.Termination_Controller.Handler'Access);

   TH := Ada.Task_Termination.Specific_Handler (Self);
end STH;

with Ada.Exceptions;
with Ada.Task_Identification;
with Ada.Task_Termination;

package Tasking is
   protected Termination_Controller is
      procedure Handler
         (Cause : Ada.Task_Termination.Cause_Of_Termination;
          T     : Ada.Task_Identification.Task_Id;
          X     : Ada.Exceptions.Exception_Occurrence);
   end Termination_Controller;
end Tasking;

package body Tasking is
   protected body Termination_Controller is
      procedure Handler
         (Cause : Ada.Task_Termination.Cause_Of_Termination;
          T     : Ada.Task_Identification.Task_Id;
          X     : Ada.Exceptions.Exception_Occurrence) is
      begin
         null;
      end Handler;
   end Termination_Controller;
end Tasking;

Tested on x86_64-pc-linux-gnu, committed on trunk

2014-02-24  Jose Ruiz  <r...@adacore.com>

        * s-rident.ads (Profile_Info): For Ravenscar, the restrictions
        No_Local_Timing_Events and No_Specific_Termination_Handlers
        must be set, according to the Ravenscar profile definition
        in D.13(6/3).

Index: s-rident.ads
===================================================================
--- s-rident.ads        (revision 208067)
+++ s-rident.ads        (working copy)
@@ -476,13 +476,15 @@
 
                            --  plus these additional restrictions:
 
-                           No_Calendar                     => True,
-                           No_Implicit_Heap_Allocations    => True,
-                           No_Relative_Delay               => True,
-                           No_Select_Statements            => True,
-                           No_Task_Termination             => True,
-                           Simple_Barriers                 => True,
-                           others                          => False),
+                           No_Calendar                      => True,
+                           No_Implicit_Heap_Allocations     => True,
+                           No_Local_Timing_Events           => True,
+                           No_Relative_Delay                => True,
+                           No_Select_Statements             => True,
+                           No_Specific_Termination_Handlers => True,
+                           No_Task_Termination              => True,
+                           Simple_Barriers                  => True,
+                           others                           => False),
 
                         --  Value settings for Ravenscar (same as Restricted)
 

Reply via email to