restrict.ads: Add missing restrictions, and properly label all GNAT defined ones
authorRobert Dewar <dewar@adacore.com>
Wed, 28 May 2008 13:47:56 +0000 (15:47 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Wed, 28 May 2008 13:47:56 +0000 (15:47 +0200)
2008-05-28  Robert Dewar  <dewar@adacore.com>

* restrict.ads:
Add missing restrictions, and properly label all GNAT defined ones

* rtsfind.ads:
Add entry for Ada_Real_Time.Timing_Events.Timing_Event
Add entry for Ada.Task_Termination.Set_Specific_Handler
Add entry for Ada.Task_Termination.Specific_Handler

* s-rident.ads:
Add missing restrictions and properly mark all gnat defined ones

* sem_ch3.adb:
(Analyze_Object_Declaration): Check No_Local_Timing_Events restriction

* sem_res.adb:
(Resolve_Call): Check violation of No_Specific_Termination_Handlers

* gnat_rm.texi: Add missing restrictions, and properly label all
GNAT defined ones

From-SVN: r136087

gcc/ada/gnat_rm.texi
gcc/ada/restrict.ads
gcc/ada/rtsfind.ads
gcc/ada/s-rident.ads
gcc/ada/sem_ch3.adb
gcc/ada/sem_res.adb

index 69baaa202c227d2365deda178bfd7baf7b125da7..5046cc56c731a014b4cbd1bacb0a44858c9bff09 100644 (file)
@@ -3897,7 +3897,7 @@ the Profile (Ravenscar), the value of Max_Task_Entries is always
 no calls to Task_Identification.Abort_Task.
 
 @item No_Asynchronous_Control
-[RM D.7] There are no semantic dependences on the package
+There are no semantic dependences on the package
 Asynchronous_Task_Control.
 
 @item No_Calendar
@@ -3918,6 +3918,10 @@ Detach_Handler, and Reference).
 Protected objects and access types that designate
 such objects shall be declared only at library level.
 
+@item No_Local_Timing_Events
+[RM D.7] All objects of type Ada.Timing_Events.Timing_Event are
+declared at the library level.
+
 @item No_Protected_Type_Allocators
 There are no allocators for protected types or
 types containing protected subcomponents.
@@ -3931,6 +3935,10 @@ Requeue statements are not allowed.
 @item No_Select_Statements
 There are no select_statements.
 
+@item No_Specific_Termination_Handlers
+[RM D.7] There are no calls to Ada.Task_Termination.Set_Specific_Handler
+or to Ada.Task_Termination.Specific_Handler.
+
 @item No_Task_Allocators
 [RM D.7] There are no allocators for task types
 or types containing task subcomponents.
@@ -3945,6 +3953,12 @@ directly on the environment task of the partition.
 @item No_Task_Termination
 Tasks which terminate are erroneous.
 
+@item No_Unchecked_Conversion
+There are no semantic dependencies on the Ada.Unchecked_Conversion package.
+
+@item No_Unchecked_Deallocation
+There are no semantic dependencies on the Ada.Unchecked_Deallocation package.
+
 @item Simple_Barriers
 Entry barrier condition expressions shall be either static
 boolean expressions or boolean objects which are declared in
index fbc8a8a54f8041f0bd5e0ecb91c07046672ed99b..bb81d85ed79969badcc93ea5c439ea6b9f371005 100644 (file)
@@ -105,14 +105,18 @@ package Restrict is
 
    Implementation_Restriction : array (All_Restrictions) of Boolean :=
      (Simple_Barriers                    => True,
+      No_Asynchronous_Control            => True,
       No_Calendar                        => True,
       No_Dispatching_Calls               => True,
       No_Dynamic_Attachment              => True,
+      No_Elaboration_Code                => True,
       No_Enumeration_Maps                => True,
       No_Entry_Calls_In_Elaboration_Code => True,
       No_Entry_Queue                     => True,
       No_Exception_Handlers              => True,
       No_Exception_Registration          => True,
+      No_Implementation_Attributes       => True,
+      No_Implementation_Pragmas          => True,
       No_Implicit_Conditionals           => True,
       No_Implicit_Dynamic_Code           => True,
       No_Implicit_Loops                  => True,
@@ -126,12 +130,11 @@ package Restrict is
       No_Streams                         => True,
       No_Task_Attributes_Package         => True,
       No_Task_Termination                => True,
+      No_Unchecked_Conversion            => True,
+      No_Unchecked_Deallocation          => True,
       No_Wide_Characters                 => True,
       Static_Priorities                  => True,
       Static_Storage_Size                => True,
-      No_Implementation_Attributes       => True,
-      No_Implementation_Pragmas          => True,
-      No_Elaboration_Code                => True,
       others                             => False);
 
    --  The following table records entries made by Restrictions pragmas
index 76110c036efdc4baf581110f1eb7b7c4fc38800d..b3bbf6a35395a14119c5011325cd68e9c50d6a4f 100644 (file)
@@ -144,6 +144,7 @@ package Rtsfind is
       --  Children of Ada.Real_Time
 
       Ada_Real_Time_Delays,
+      Ada_Real_Time_Timing_Events,
 
       --  Children of Ada.Streams
 
@@ -394,7 +395,7 @@ package Rtsfind is
    --  Range of values for children of Ada.Interrupts
 
    subtype Ada_Real_Time_Child is Ada_Child
-     range Ada_Real_Time_Delays .. Ada_Real_Time_Delays;
+     range Ada_Real_Time_Delays .. Ada_Real_Time_Timing_Events;
    --  Range of values for children of Ada.Real_Time
 
    subtype Ada_Streams_Child is Ada_Child
@@ -470,6 +471,12 @@ package Rtsfind is
 
      RE_Null,
 
+     RO_CA_Time,                         -- Ada.Calendar
+
+     RO_CA_Delay_For,                    -- Ada.Calendar.Delays
+     RO_CA_Delay_Until,                  -- Ada.Calendar.Delays
+     RO_CA_To_Duration,                  -- Ada.Calendar.Delays
+
      RE_Set_Deadline,                    -- Ada.Dispatching.EDF
 
      RE_Code_Loc,                        -- Ada.Exceptions
@@ -503,6 +510,16 @@ package Rtsfind is
 
      RE_Names,                           -- Ada.Interrupts.Names
 
+     RE_Clock,                           -- Ada.Real_Time
+     RE_Time_Span,                       -- Ada.Real_Time
+     RE_Time_Span_Zero,                  -- Ada.Real_Time
+     RO_RT_Time,                         -- Ada.Real_Time
+
+     RO_RT_Delay_Until,                  -- Ada.Real_Time.Delays
+     RO_RT_To_Duration,                  -- Ada.Real_Time.Delays
+
+     RE_Timing_Event,                    -- Ada_Real_Time_Timing_Events
+
      RE_Root_Stream_Type,                -- Ada.Streams
      RE_Stream_Element,                  -- Ada.Streams
 
@@ -590,24 +607,13 @@ package Rtsfind is
      RE_TK_Tagged,                       -- Ada.Tags
      RE_TK_Task,                         -- Ada.Tags
 
+     RE_Set_Specific_Handler,            -- Ada.Task_Termination
+     RE_Specific_Handler,                -- Ada.Task_Termination
+
      RE_Abort_Task,                      -- Ada.Task_Identification
      RE_Current_Task,                    -- Ada.Task_Identification
      RO_AT_Task_Id,                      -- Ada.Task_Identification
 
-     RO_CA_Time,                         -- Ada.Calendar
-
-     RO_CA_Delay_For,                    -- Ada.Calendar.Delays
-     RO_CA_Delay_Until,                  -- Ada.Calendar.Delays
-     RO_CA_To_Duration,                  -- Ada.Calendar.Delays
-
-     RE_Clock,                           -- Ada.Real_Time
-     RE_Time_Span,                       -- Ada.Real_Time
-     RE_Time_Span_Zero,                  -- Ada.Real_Time
-     RO_RT_Time,                         -- Ada.Real_Time
-
-     RO_RT_Delay_Until,                  -- Ada.Real_Time.Delays
-     RO_RT_To_Duration,                  -- Ada.Real_Time.Delays
-
      RE_Integer_64,                      -- Interfaces
      RE_Unsigned_8,                      -- Interfaces
      RE_Unsigned_16,                     -- Interfaces
@@ -1599,14 +1605,20 @@ package Rtsfind is
      RO_TS_Set_Entry_Name,               -- System.Tasking.Stages
      RE_Terminated);                     -- System.Tasking.Stages
 
-   --  The following declarations build a table that is indexed by the
-   --  RTE function to determine the unit containing the given entity.
-   --  This table is sorted in order of package names.
+   --  The following declarations build a table that is indexed by the RTE
+   --  function to determine the unit containing the given entity. This table
+   --  is sorted in order of package names.
 
    RE_Unit_Table : array (RE_Id) of RTU_Id := (
 
      RE_Null                             => RTU_Null,
 
+     RO_CA_Time                          => Ada_Calendar,
+
+     RO_CA_Delay_For                     => Ada_Calendar_Delays,
+     RO_CA_Delay_Until                   => Ada_Calendar_Delays,
+     RO_CA_To_Duration                   => Ada_Calendar_Delays,
+
      RE_Set_Deadline                     => Ada_Dispatching_EDF,
 
      RE_Code_Loc                         => Ada_Exceptions,
@@ -1640,6 +1652,16 @@ package Rtsfind is
 
      RE_Names                            => Ada_Interrupts_Names,
 
+     RE_Clock                            => Ada_Real_Time,
+     RE_Time_Span                        => Ada_Real_Time,
+     RE_Time_Span_Zero                   => Ada_Real_Time,
+     RO_RT_Time                          => Ada_Real_Time,
+
+     RO_RT_Delay_Until                   => Ada_Real_Time_Delays,
+     RO_RT_To_Duration                   => Ada_Real_Time_Delays,
+
+     RE_Timing_Event                     => Ada_Real_Time_Timing_Events,
+
      RE_Root_Stream_Type                 => Ada_Streams,
      RE_Stream_Element                   => Ada_Streams,
 
@@ -1727,22 +1749,13 @@ package Rtsfind is
      RE_TK_Tagged                        => Ada_Tags,
      RE_TK_Task                          => Ada_Tags,
 
+     RE_Set_Specific_Handler             => Ada_Task_Termination,
+     RE_Specific_Handler                 => Ada_Task_Termination,
+
      RE_Abort_Task                       => Ada_Task_Identification,
      RE_Current_Task                     => Ada_Task_Identification,
      RO_AT_Task_Id                       => Ada_Task_Identification,
 
-     RO_CA_Time                          => Ada_Calendar,
-     RO_CA_Delay_For                     => Ada_Calendar_Delays,
-     RO_CA_Delay_Until                   => Ada_Calendar_Delays,
-     RO_CA_To_Duration                   => Ada_Calendar_Delays,
-
-     RE_Clock                            => Ada_Real_Time,
-     RE_Time_Span                        => Ada_Real_Time,
-     RE_Time_Span_Zero                   => Ada_Real_Time,
-     RO_RT_Time                          => Ada_Real_Time,
-     RO_RT_Delay_Until                   => Ada_Real_Time_Delays,
-     RO_RT_To_Duration                   => Ada_Real_Time_Delays,
-
      RE_Integer_64                       => Interfaces,
      RE_Unsigned_8                       => Interfaces,
      RE_Unsigned_16                      => Interfaces,
index 2c5ffb6083277fd47216d08452b79f73d628b784..bbe422377dedc9203b63cef56228b8fb0d4199ff 100644 (file)
@@ -89,6 +89,7 @@ package System.Rident is
       No_Implicit_Loops,                       -- GNAT
       No_Initialize_Scalars,                   -- GNAT
       No_Local_Allocators,                     -- (RM H.4(8))
+      No_Local_Timing_Events,                  -- (RM D.7(10.2/2))
       No_Local_Protected_Objects,              -- GNAT
       No_Nested_Finalization,                  -- (RM D.7(4))
       No_Protected_Type_Allocators,            -- GNAT
@@ -99,6 +100,7 @@ package System.Rident is
       No_Requeue_Statements,                   -- GNAT
       No_Secondary_Stack,                      -- GNAT
       No_Select_Statements,                    -- GNAT (Ravenscar)
+      No_Specific_Termination_Handlers,        -- (RM D.7(10.7/2))
       No_Standard_Storage_Pools,               -- GNAT
       No_Streams,                              -- GNAT
       No_Task_Allocators,                      -- (RM D.7(7))
index b67a2ceeb6b55fd83eab08e227ddd04040ec8b70..3dc47a37537b1fa9084d823ca4dddb3bc7aa0b89 100644 (file)
@@ -3064,6 +3064,14 @@ package body Sem_Ch3 is
       then
          Set_In_Private_Part (Id);
       end if;
+
+      --  Check for violation of No_Local_Timing_Events
+
+      if Is_RTE (Etype (Id), RE_Timing_Event)
+        and then not Is_Library_Level_Entity (Id)
+      then
+         Check_Restriction (No_Local_Timing_Events, N);
+      end if;
    end Analyze_Object_Declaration;
 
    ---------------------------
index f59e6415962ab6db5168626a9a0c8656c5ca6010..d1f2cefc803aaa9dca83a0dba2a9a7d8cba6f810 100644 (file)
@@ -5146,6 +5146,15 @@ package body Sem_Res is
          Check_Intrinsic_Call (N);
       end if;
 
+      --  Check for violation of restriction No_Specific_Termination_Handlers
+
+      if Is_RTE (Nam, RE_Set_Specific_Handler)
+           or else
+         Is_RTE (Nam, RE_Specific_Handler)
+      then
+         Check_Restriction (No_Specific_Termination_Handlers, N);
+      end if;
+
       --  All done, evaluate call and deal with elaboration issues
 
       Eval_Call (N);