diff mbox

[Ada] Create a new internal profile

Message ID 20161012103340.GA60838@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Oct. 12, 2016, 10:33 a.m. UTC
This new profile is not user visible and is the base to switch to the
restricted tasking runtime. It replaces the Restricted profile for that
purpose and is weaker than it.  The Restricted profile remains unchanged.
The purpose of that change is to lift some restrictions of the
GNAT_Extended_Ravenscar profile but still using the Restricted tasking.

No functional changes.

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

2016-10-12  Tristan Gingold  <gingold@adacore.com>

	* restrict.ads, restrict.adb (Restricted_Profile): Adjust
	comment, use Restricted_Tasking to compare restrictions.
	* s-rident.ads (Profile_Name): Add Restricted_Tasking and
	reorder literals.
	(Profile_Info): Set restrictions for Restricted_Tasking.
diff mbox

Patch

Index: restrict.adb
===================================================================
--- restrict.adb	(revision 241024)
+++ restrict.adb	(working copy)
@@ -1194,8 +1194,10 @@ 
          Restricted_Profile_Cached := True;
 
          declare
-            R : Restriction_Flags  renames Profile_Info (Restricted).Set;
-            V : Restriction_Values renames Profile_Info (Restricted).Value;
+            R : Restriction_Flags  renames
+                   Profile_Info (Restricted_Tasking).Set;
+            V : Restriction_Values renames
+                   Profile_Info (Restricted_Tasking).Value;
          begin
             for J in R'Range loop
                if R (J)
Index: restrict.ads
===================================================================
--- restrict.ads	(revision 241024)
+++ restrict.ads	(working copy)
@@ -6,7 +6,7 @@ 
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2015, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2016, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -424,10 +424,10 @@ 
    --  executing this code only if needed.
 
    function Restricted_Profile return Boolean;
-   --  Tests if set of restrictions corresponding to Profile (Restricted) is
-   --  currently in effect (set by pragma Profile, or by an appropriate set of
-   --  individual Restrictions pragmas). Returns True only if all the required
-   --  restrictions are set.
+   --  Tests if set of restrictions corresponding to Restricted_Tasking profile
+   --  is currently in effect (set by pragma Profile, or by an appropriate set
+   --  of individual Restrictions pragmas). Returns True only if all the
+   --  required restrictions are set.
 
    procedure Set_Hidden_Part_In_SPARK (Loc1, Loc2 : Source_Ptr);
    --  Insert a new hidden region range in the SPARK hides table. The effect
Index: s-rident.ads
===================================================================
--- s-rident.ads	(revision 241024)
+++ s-rident.ads	(working copy)
@@ -378,15 +378,19 @@ 
    type Profile_Name is
      (No_Profile,
       No_Implementation_Extensions,
+      Restricted_Tasking,
+      Restricted,
       Ravenscar,
-      GNAT_Extended_Ravenscar,
-      Restricted);
+      GNAT_Extended_Ravenscar);
    --  Names of recognized profiles. No_Profile is used to indicate that a
    --  restriction came from pragma Restrictions[_Warning], as opposed to
-   --  pragma Profile[_Warning].
+   --  pragma Profile[_Warning]. Restricted_Tasking is a non-user profile that
+   --  contaings the minimal set of restrictions to trigger the user of the
+   --  restricted tasking runtime. Restricted is the corresponding user profile
+   --  that also restrict protected types.
 
    subtype Profile_Name_Actual is Profile_Name
-     range No_Implementation_Extensions .. Restricted;
+     range No_Implementation_Extensions .. GNAT_Extended_Ravenscar;
    --  Actual used profile names
 
    type Profile_Data is record
@@ -422,6 +426,37 @@ 
                         Value =>
                           (others                          => 0)),
 
+                     --  Restricted_Tasking Profile
+
+                     Restricted_Tasking =>
+
+                        --  Restrictions for Restricted_Tasking profile
+
+                       (Set   =>
+                          (No_Abort_Statements             => True,
+                           No_Asynchronous_Control         => True,
+                           No_Dynamic_Attachment           => True,
+                           No_Dynamic_Priorities           => True,
+                           No_Local_Protected_Objects      => True,
+                           No_Protected_Type_Allocators    => True,
+                           No_Requeue_Statements           => True,
+                           No_Task_Allocators              => True,
+                           No_Task_Attributes_Package      => True,
+                           No_Task_Hierarchy               => True,
+                           No_Terminate_Alternatives       => True,
+                           Max_Asynchronous_Select_Nesting => True,
+                           Max_Select_Alternatives         => True,
+                           Max_Task_Entries                => True,
+                           others                          => False),
+
+                        --  Value settings for Restricted_Tasking profile
+
+                        Value =>
+                          (Max_Asynchronous_Select_Nesting => 0,
+                           Max_Select_Alternatives         => 0,
+                           Max_Task_Entries                => 0,
+                           others                          => 0)),
+
                      --  Restricted Profile
 
                      Restricted =>