From 5b2217f83f77747f59c910a9f4a971c147b9c51f Mon Sep 17 00:00:00 2001 From: Robert Dewar Date: Wed, 28 May 2008 15:47:56 +0200 Subject: [PATCH] restrict.ads: Add missing restrictions, and properly label all GNAT defined ones 2008-05-28 Robert Dewar * 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 | 16 +++++++++- gcc/ada/restrict.ads | 9 ++++-- gcc/ada/rtsfind.ads | 73 ++++++++++++++++++++++++++------------------ gcc/ada/s-rident.ads | 2 ++ gcc/ada/sem_ch3.adb | 8 +++++ gcc/ada/sem_res.adb | 9 ++++++ 6 files changed, 83 insertions(+), 34 deletions(-) diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index 69baaa202c2..5046cc56c73 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -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 diff --git a/gcc/ada/restrict.ads b/gcc/ada/restrict.ads index fbc8a8a54f8..bb81d85ed79 100644 --- a/gcc/ada/restrict.ads +++ b/gcc/ada/restrict.ads @@ -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 diff --git a/gcc/ada/rtsfind.ads b/gcc/ada/rtsfind.ads index 76110c036ef..b3bbf6a3539 100644 --- a/gcc/ada/rtsfind.ads +++ b/gcc/ada/rtsfind.ads @@ -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, diff --git a/gcc/ada/s-rident.ads b/gcc/ada/s-rident.ads index 2c5ffb60832..bbe422377de 100644 --- a/gcc/ada/s-rident.ads +++ b/gcc/ada/s-rident.ads @@ -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)) diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index b67a2ceeb6b..3dc47a37537 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -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; --------------------------- diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index f59e6415962..d1f2cefc803 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -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); -- 2.30.2