| 1 |
------------------------------------------------------------------------------ |
| 2 |
-- -- |
| 3 |
-- GNAT COMPILER COMPONENTS -- |
| 4 |
-- -- |
| 5 |
-- S Y S T E M . R I D E N T -- |
| 6 |
-- -- |
| 7 |
-- S p e c -- |
| 8 |
-- -- |
| 9 |
-- Copyright (C) 1992-2025, Free Software Foundation, Inc. -- |
| 10 |
-- -- |
| 11 |
-- GNAT is free software; you can redistribute it and/or modify it under -- |
| 12 |
-- terms of the GNU General Public License as published by the Free Soft- -- |
| 13 |
-- ware Foundation; either version 3, or (at your option) any later ver- -- |
| 14 |
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- |
| 15 |
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- |
| 16 |
-- or FITNESS FOR A PARTICULAR PURPOSE. -- |
| 17 |
-- -- |
| 18 |
-- As a special exception under Section 7 of GPL version 3, you are granted -- |
| 19 |
-- additional permissions described in the GCC Runtime Library Exception, -- |
| 20 |
-- version 3.1, as published by the Free Software Foundation. -- |
| 21 |
-- -- |
| 22 |
-- You should have received a copy of the GNU General Public License and -- |
| 23 |
-- a copy of the GCC Runtime Library Exception along with this program; -- |
| 24 |
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- |
| 25 |
-- <http://www.gnu.org/licenses/>. -- |
| 26 |
-- -- |
| 27 |
-- GNAT was originally developed by the GNAT team at New York University. -- |
| 28 |
-- Extensive contributions were provided by Ada Core Technologies Inc. -- |
| 29 |
-- -- |
| 30 |
------------------------------------------------------------------------------ |
| 31 |
|
| 32 |
-- This package defines the set of restriction identifiers. It is a generic |
| 33 |
-- package that is instantiated by the compiler/binder in package ``Rident``, |
| 34 |
-- and is instantiated in package ``System.Restrictions`` for use at |
| 35 |
-- run-time. |
| 36 |
|
| 37 |
-- The reason that we make this a generic package is so that in the case of |
| 38 |
-- the instantiation in Rident for use at compile time and bind time, we can |
| 39 |
-- generate normal image tables for the enumeration types, which are needed |
| 40 |
-- for diagnostic and informational messages. At run-time we really do not |
| 41 |
-- want to waste the space for these image tables, and they are not needed, |
| 42 |
-- so we can do the instantiation under control of Discard_Names to remove |
| 43 |
-- the tables. |
| 44 |
|
| 45 |
-- Note: this unit is used during bootstrap, see ADA_GENERATED_FILES in |
| 46 |
-- gcc-interface/Make-lang.in for details on the constraints. |
| 47 |
|
| 48 |
--------------------------------------------------- |
| 49 |
-- Note On Compile/Run-Time Consistency Checking -- |
| 50 |
--------------------------------------------------- |
| 51 |
|
| 52 |
-- This unit is with'ed by the run-time (to make System.Restrictions which is |
| 53 |
-- used for run-time access to restriction information), by the compiler (to |
| 54 |
-- determine what restrictions are implemented and what their category is) and |
| 55 |
-- by the binder (in processing ali files, and generating the information used |
| 56 |
-- at run-time to access restriction information). |
| 57 |
|
| 58 |
-- Normally the version of System.Rident referenced in all three contexts |
| 59 |
-- should be the same. However, problems could arise in certain inconsistent |
| 60 |
-- builds that used inconsistent versions of the compiler and run-time. This |
| 61 |
-- sort of thing is not strictly correct, but it does arise when short-cuts |
| 62 |
-- are taken in build procedures. |
| 63 |
|
| 64 |
-- Previously, this kind of inconsistency could cause a significant problem. |
| 65 |
-- If versions of System.Rident accessed by the compiler and binder differed, |
| 66 |
-- then the binder could fail to recognize the R (restrictions line) in the |
| 67 |
-- ali file, leading to bind errors when restrictions were added or removed. |
| 68 |
|
| 69 |
-- The latest implementation avoids this problem by using a named scheme |
| 70 |
-- for recording restrictions, rather than a positional scheme that fails |
| 71 |
-- completely if restrictions are added or subtracted. Now the worst that |
| 72 |
-- happens at bind time in inconsistent builds is that unrecognized |
| 73 |
-- restrictions are ignored, and the consistency checking for restrictions |
| 74 |
-- might be incomplete, which is no big deal. |
| 75 |
|
| 76 |
generic |
| 77 |
package System.Rident is |
| 78 |
pragma Preelaborate; |
| 79 |
|
| 80 |
-- The following enumeration type defines the set of restriction |
| 81 |
-- identifiers that are implemented in GNAT. |
| 82 |
|
| 83 |
-- To add a new restriction identifier, add an entry with the name to be |
| 84 |
-- used in the pragma, and add calls to the Restrict.Check_Restriction |
| 85 |
-- routine as appropriate. If the new restriction is GNAT specific, also |
| 86 |
-- add an entry in Restrict.Implementation_Restriction (restrict.ads). |
| 87 |
|
| 88 |
type Restriction_Id is |
| 89 |
|
| 90 |
-- The following cases are checked for consistency in the binder. The |
| 91 |
-- binder will check that every unit either has the restriction set, or |
| 92 |
-- does not violate the restriction. |
| 93 |
|
| 94 |
(Simple_Barriers, -- Ada 2012 (D.7 (10.9/3)) |
| 95 |
Pure_Barriers, -- Ada 2022 (D.7(10.11/5)) |
| 96 |
No_Abort_Statements, -- (RM D.7(5), H.4(3)) |
| 97 |
No_Access_Parameter_Allocators, -- Ada 2012 (RM H.4 (8.3/3)) |
| 98 |
No_Access_Subprograms, -- (RM H.4(17)) |
| 99 |
No_Allocators, -- (RM H.4(7)) |
| 100 |
No_Anonymous_Allocators, -- Ada 2012 (RM H.4(8/1)) |
| 101 |
No_Asynchronous_Control, -- (RM J.13(3/2) |
| 102 |
No_Calendar, -- GNAT |
| 103 |
No_Coextensions, -- Ada 2012 (RM H.4(8.2/3)) |
| 104 |
No_Default_Stream_Attributes, -- Ada 2012 (RM 13.12.1(4/2)) |
| 105 |
No_Delay, -- (RM H.4(21)) |
| 106 |
No_Direct_Boolean_Operators, -- GNAT |
| 107 |
No_Dispatch, -- (RM H.4(19)) |
| 108 |
No_Dispatching_Calls, -- GNAT |
| 109 |
No_Dynamic_Accessibility_Checks, -- GNAT |
| 110 |
No_Dynamic_Attachment, -- Ada 2012 (RM E.7(10/3)) |
| 111 |
No_Dynamic_CPU_Assignment, -- Ada 2022 (RM D.7(10/3)) |
| 112 |
No_Dynamic_Priorities, -- (RM D.9(9)) |
| 113 |
No_Enumeration_Maps, -- GNAT |
| 114 |
No_Entry_Calls_In_Elaboration_Code, -- GNAT |
| 115 |
No_Entry_Queue, -- GNAT (Ravenscar) |
| 116 |
No_Exception_Handlers, -- GNAT |
| 117 |
No_Exception_Propagation, -- GNAT |
| 118 |
No_Exception_Registration, -- GNAT |
| 119 |
No_Exceptions, -- (RM H.4(12)) |
| 120 |
No_Finalization, -- GNAT |
| 121 |
No_Fixed_IO, -- GNAT |
| 122 |
No_Fixed_Point, -- (RM H.4(15)) |
| 123 |
No_Floating_Point, -- (RM H.4(14)) |
| 124 |
No_IO, -- (RM H.4(20)) |
| 125 |
No_Implicit_Conditionals, -- GNAT |
| 126 |
No_Implicit_Dynamic_Code, -- GNAT |
| 127 |
No_Implicit_Heap_Allocations, -- (RM D.8(8), H.4(3)) |
| 128 |
No_Implicit_Task_Allocations, -- GNAT |
| 129 |
No_Implicit_Protected_Object_Allocations, -- GNAT |
| 130 |
No_Initialize_Scalars, -- GNAT |
| 131 |
No_Local_Tagged_Types, -- GNAT |
| 132 |
No_Local_Allocators, -- (RM H.4(8)) |
| 133 |
No_Local_Timing_Events, -- (RM D.7(10.2/2)) |
| 134 |
No_Local_Protected_Objects, -- Ada 2012 (D.7(10/1.3)) |
| 135 |
No_Long_Long_Integers, -- GNAT |
| 136 |
No_Multiple_Elaboration, -- GNAT |
| 137 |
No_Nested_Finalization, -- (RM D.7(4)) |
| 138 |
No_Protected_Type_Allocators, -- Ada 2012 (D.7 (10.3/2)) |
| 139 |
No_Protected_Types, -- (RM H.4(5)) |
| 140 |
No_Recursion, -- (RM H.4(22)) |
| 141 |
No_Reentrancy, -- (RM H.4(23)) |
| 142 |
No_Relative_Delay, -- Ada 2012 (D.7 (10.5/3)) |
| 143 |
No_Requeue_Statements, -- Ada 2012 (D.7 (10.6/3)) |
| 144 |
No_Secondary_Stack, -- GNAT |
| 145 |
No_Select_Statements, -- Ada 2012 (D.7 (10.7/4)) |
| 146 |
No_Specific_Termination_Handlers, -- (RM D.7(10.7/2)) |
| 147 |
No_Standard_Allocators_After_Elaboration, -- Ada 2012 (RM D.7(19.1/2)) |
| 148 |
No_Standard_Storage_Pools, -- GNAT |
| 149 |
No_Stream_Optimizations, -- GNAT |
| 150 |
No_Streams, -- GNAT |
| 151 |
No_Tagged_Type_Registration, -- GNAT |
| 152 |
No_Task_Allocators, -- (RM D.7(7)) |
| 153 |
No_Task_Attributes_Package, -- GNAT |
| 154 |
No_Task_At_Interrupt_Priority, -- GNAT |
| 155 |
No_Task_Hierarchy, -- (RM D.7(3), H.4(3)) |
| 156 |
No_Task_Hierarchy_Implicit, -- GNAT |
| 157 |
No_Task_Termination, -- Ada 2005 (D.7(15.1/2)) |
| 158 |
No_Tasks_Unassigned_To_CPU, -- Ada 2022 (D.7(10.10/4)) |
| 159 |
No_Tasking, -- GNAT |
| 160 |
No_Terminate_Alternatives, -- (RM D.7(6)) |
| 161 |
No_Unchecked_Access, -- (RM H.4(18)) |
| 162 |
No_Unchecked_Conversion, -- (RM J.13(4/2)) |
| 163 |
No_Unchecked_Deallocation, -- (RM J.13(5/2)) |
| 164 |
Static_Priorities, -- GNAT |
| 165 |
Static_Storage_Size, -- GNAT |
| 166 |
|
| 167 |
-- The following require consistency checking with special rules. See |
| 168 |
-- individual routines in unit Bcheck for details of what is required. |
| 169 |
|
| 170 |
No_Default_Initialization, -- GNAT |
| 171 |
|
| 172 |
-- The following cases do not require consistency checking and if used |
| 173 |
-- as a configuration pragma within a specific unit, apply only to that |
| 174 |
-- unit (e.g. if used in the package spec, do not apply to the body) |
| 175 |
|
| 176 |
-- Note: No_Elaboration_Code is handled specially. Like the other |
| 177 |
-- non-partition-wide restrictions, it can only be set in a unit that |
| 178 |
-- is part of the extended main source unit (body/spec/subunits). But |
| 179 |
-- it is sticky, in that if it is found anywhere within any of these |
| 180 |
-- units, it applies to all units in this extended main source. |
| 181 |
|
| 182 |
Immediate_Reclamation, -- (RM H.4(10)) |
| 183 |
No_Dynamic_Sized_Objects, -- GNAT |
| 184 |
No_Implementation_Aspect_Specifications, -- Ada 2012 AI-241 |
| 185 |
No_Implementation_Attributes, -- Ada 2005 AI-257 |
| 186 |
No_Implementation_Identifiers, -- Ada 2012 AI-246 |
| 187 |
No_Implementation_Pragmas, -- Ada 2005 AI-257 |
| 188 |
No_Implementation_Restrictions, -- GNAT |
| 189 |
No_Implementation_Units, -- Ada 2012 AI-242 |
| 190 |
No_Implicit_Aliasing, -- GNAT |
| 191 |
No_Implicit_Loops, -- GNAT |
| 192 |
No_Elaboration_Code, -- GNAT |
| 193 |
No_Obsolescent_Features, -- Ada 2005 AI-368 |
| 194 |
No_Unrecognized_Aspects, -- AI12-0389-1/02 |
| 195 |
No_Unrecognized_Pragmas, -- AI12-0389-1/02 |
| 196 |
No_Wide_Characters, -- GNAT |
| 197 |
Static_Dispatch_Tables, -- GNAT |
| 198 |
SPARK_05, -- GNAT |
| 199 |
|
| 200 |
-- The following cases require a parameter value |
| 201 |
|
| 202 |
No_Specification_Of_Aspect, -- 2012 (RM 13.12.1 (6.1/3)) |
| 203 |
No_Use_Of_Attribute, -- 2012 (RM 13.12.1 (6.2/3)) |
| 204 |
No_Use_Of_Pragma, -- 2012 (RM 13.12.1 (6.3/3)) |
| 205 |
|
| 206 |
-- The following entries are fully checked at compile/bind time, which |
| 207 |
-- means that the compiler can in general tell the minimum value which |
| 208 |
-- could be used with a restrictions pragma. The binder can deduce the |
| 209 |
-- appropriate minimum value for the partition by taking the maximum |
| 210 |
-- value required by any unit. |
| 211 |
|
| 212 |
Max_Protected_Entries, -- (RM D.7(14)) |
| 213 |
Max_Select_Alternatives, -- (RM D.7(12)) |
| 214 |
Max_Task_Entries, -- (RM D.7(13), H.4(3)) |
| 215 |
|
| 216 |
-- The following entries are also fully checked at compile/bind time, |
| 217 |
-- and the compiler can also at least in some cases tell the minimum |
| 218 |
-- value which could be used with a restriction pragma. The difference |
| 219 |
-- is that the contributions are additive, so the binder deduces this |
| 220 |
-- value by adding the unit contributions. |
| 221 |
|
| 222 |
Max_Tasks, -- (RM D.7(19), H.4(3)) |
| 223 |
|
| 224 |
-- The following entries are checked at compile time only for zero/ |
| 225 |
-- nonzero entries. This means that the compiler can tell at compile |
| 226 |
-- time if a restriction value of zero is (would be) violated, but that |
| 227 |
-- the compiler cannot distinguish between different non-zero values. |
| 228 |
|
| 229 |
Max_Asynchronous_Select_Nesting, -- (RM D.7(18), H.4(3)) |
| 230 |
Max_Entry_Queue_Length, -- Ada 2012 (RM D.7 (19.1/2)) |
| 231 |
|
| 232 |
-- The remaining entries are not checked at compile/bind time |
| 233 |
|
| 234 |
Max_Storage_At_Blocking, -- (RM D.7(17)) |
| 235 |
|
| 236 |
Not_A_Restriction_Id); |
| 237 |
|
| 238 |
-- Synonyms permitted for historical purposes of compatibility. |
| 239 |
-- Must be coordinated with Restrict.Process_Restriction_Synonym. |
| 240 |
|
| 241 |
Boolean_Entry_Barriers : Restriction_Id renames Simple_Barriers; |
| 242 |
Max_Entry_Queue_Depth : Restriction_Id renames Max_Entry_Queue_Length; |
| 243 |
No_Dynamic_Interrupts : Restriction_Id renames No_Dynamic_Attachment; |
| 244 |
No_Requeue : Restriction_Id renames No_Requeue_Statements; |
| 245 |
No_Task_Attributes : Restriction_Id renames No_Task_Attributes_Package; |
| 246 |
|
| 247 |
subtype All_Restrictions is Restriction_Id range |
| 248 |
Simple_Barriers .. Max_Storage_At_Blocking; |
| 249 |
-- All restrictions (excluding only Not_A_Restriction_Id) |
| 250 |
|
| 251 |
subtype All_Boolean_Restrictions is Restriction_Id range |
| 252 |
Simple_Barriers .. SPARK_05; |
| 253 |
-- All restrictions which do not take a parameter |
| 254 |
|
| 255 |
subtype Partition_Boolean_Restrictions is All_Boolean_Restrictions range |
| 256 |
Simple_Barriers .. Static_Storage_Size; |
| 257 |
-- Boolean restrictions that are checked for partition consistency. |
| 258 |
-- Note that all parameter restrictions are checked for partition |
| 259 |
-- consistency by default, so this distinction is only needed in the |
| 260 |
-- case of Boolean restrictions. |
| 261 |
|
| 262 |
subtype Cunit_Boolean_Restrictions is All_Boolean_Restrictions range |
| 263 |
Immediate_Reclamation .. SPARK_05; |
| 264 |
-- Boolean restrictions that are not checked for partition consistency |
| 265 |
-- and that thus apply only to the current unit. Note that for these |
| 266 |
-- restrictions, the compiler does not apply restrictions found in |
| 267 |
-- with'ed units, parent specs etc. to the main unit, and vice versa. |
| 268 |
|
| 269 |
subtype All_Parameter_Restrictions is |
| 270 |
Restriction_Id range |
| 271 |
No_Specification_Of_Aspect .. Max_Storage_At_Blocking; |
| 272 |
-- All restrictions that take a parameter |
| 273 |
|
| 274 |
subtype Integer_Parameter_Restrictions is |
| 275 |
Restriction_Id range |
| 276 |
Max_Protected_Entries .. Max_Storage_At_Blocking; |
| 277 |
-- All restrictions taking an integer parameter |
| 278 |
|
| 279 |
subtype Checked_Parameter_Restrictions is |
| 280 |
All_Parameter_Restrictions range |
| 281 |
Max_Protected_Entries .. Max_Entry_Queue_Length; |
| 282 |
-- These are the parameter restrictions that can be at least partially |
| 283 |
-- checked at compile/binder time. Minimally, the compiler can detect |
| 284 |
-- violations of a restriction pragma with a value of zero reliably. |
| 285 |
|
| 286 |
subtype Checked_Max_Parameter_Restrictions is |
| 287 |
Checked_Parameter_Restrictions range |
| 288 |
Max_Protected_Entries .. Max_Task_Entries; |
| 289 |
-- Restrictions with parameters that can be checked in some cases by |
| 290 |
-- maximizing among statically detected instances where the compiler |
| 291 |
-- can determine the count. |
| 292 |
|
| 293 |
subtype Checked_Add_Parameter_Restrictions is |
| 294 |
Checked_Parameter_Restrictions range |
| 295 |
Max_Tasks .. Max_Tasks; |
| 296 |
-- Restrictions with parameters that can be checked in some cases by |
| 297 |
-- summing the statically detected instances where the compiler can |
| 298 |
-- determine the count. |
| 299 |
|
| 300 |
subtype Checked_Val_Parameter_Restrictions is |
| 301 |
Checked_Parameter_Restrictions range |
| 302 |
Max_Protected_Entries .. Max_Tasks; |
| 303 |
-- Restrictions with parameter where the count is known at least in some |
| 304 |
-- cases by the compiler/binder. |
| 305 |
|
| 306 |
subtype Checked_Zero_Parameter_Restrictions is |
| 307 |
Checked_Parameter_Restrictions range |
| 308 |
Max_Asynchronous_Select_Nesting .. Max_Entry_Queue_Length; |
| 309 |
-- Restrictions with parameters where the compiler can detect the use of |
| 310 |
-- the feature, and hence violations of a restriction specifying a value |
| 311 |
-- of zero, but cannot detect specific values other than zero/nonzero. |
| 312 |
|
| 313 |
subtype Unchecked_Parameter_Restrictions is |
| 314 |
All_Parameter_Restrictions range |
| 315 |
Max_Storage_At_Blocking .. Max_Storage_At_Blocking; |
| 316 |
-- Restrictions with parameters where the compiler cannot ever detect |
| 317 |
-- corresponding compile time usage, so the binder and compiler never |
| 318 |
-- detect violations of any restriction. |
| 319 |
|
| 320 |
------------------------------------- |
| 321 |
-- Restriction Status Declarations -- |
| 322 |
------------------------------------- |
| 323 |
|
| 324 |
-- The following declarations are used to record the current status or |
| 325 |
-- restrictions (for the current unit, or related units, at compile time, |
| 326 |
-- and for all units in a partition at bind time or run time). |
| 327 |
|
| 328 |
type Restriction_Flags is array (All_Restrictions) of Boolean; |
| 329 |
type Restriction_Values is array (All_Parameter_Restrictions) of Natural; |
| 330 |
type Parameter_Flags is array (All_Parameter_Restrictions) of Boolean; |
| 331 |
|
| 332 |
type Restrictions_Info is record |
| 333 |
Set : Restriction_Flags; |
| 334 |
-- An entry is True in the Set array if a restrictions pragma has been |
| 335 |
-- encountered for the given restriction. If the value is True for a |
| 336 |
-- parameter restriction, then the corresponding entry in the Value |
| 337 |
-- array gives the minimum value encountered for any such restriction. |
| 338 |
|
| 339 |
Value : Restriction_Values; |
| 340 |
-- If the entry for a parameter restriction in Set is True (i.e. a |
| 341 |
-- restrictions pragma for the restriction has been encountered), then |
| 342 |
-- the corresponding entry in the Value array is the minimum value |
| 343 |
-- specified by any such restrictions pragma. Note that a restrictions |
| 344 |
-- pragma specifying a value greater than Int'Last is simply ignored. |
| 345 |
|
| 346 |
Violated : Restriction_Flags; |
| 347 |
-- An entry is True in the violations array if the compiler has detected |
| 348 |
-- a violation of the restriction. For a parameter restriction, the |
| 349 |
-- Count and Unknown arrays have additional information. |
| 350 |
|
| 351 |
Count : Restriction_Values; |
| 352 |
-- If an entry for a parameter restriction is True in Violated, the |
| 353 |
-- corresponding entry in the Count array may record additional |
| 354 |
-- information. If the actual minimum count is known (by taking |
| 355 |
-- maximums, or sums, depending on the restriction), it will be |
| 356 |
-- recorded in this array. If not, then the value will remain zero. |
| 357 |
-- The value is also zero for a non-violated restriction. |
| 358 |
|
| 359 |
Unknown : Parameter_Flags; |
| 360 |
-- If an entry for a parameter restriction is True in Violated, the |
| 361 |
-- corresponding entry in the Unknown array may record additional |
| 362 |
-- information. If the actual count is not known by the compiler (but |
| 363 |
-- is known to be non-zero), then the entry in Unknown will be True. |
| 364 |
-- This indicates that the value in Count is not known to be exact, |
| 365 |
-- and the actual violation count may be higher. |
| 366 |
|
| 367 |
-- Note: If Violated (K) is True, then either Count (K) > 0 or |
| 368 |
-- Unknown (K) = True. It is possible for both these to be set. |
| 369 |
-- For example, if Count (K) = 3 and Unknown (K) is True, it means |
| 370 |
-- that the actual violation count is at least 3 but might be higher. |
| 371 |
end record; |
| 372 |
|
| 373 |
No_Restrictions : constant Restrictions_Info := |
| 374 |
(Set => (others => False), |
| 375 |
Value => (others => 0), |
| 376 |
Violated => (others => False), |
| 377 |
Count => (others => 0), |
| 378 |
Unknown => (others => False)); |
| 379 |
-- Used to initialize Restrictions_Info variables |
| 380 |
|
| 381 |
---------------------------------- |
| 382 |
-- Profile Definitions and Data -- |
| 383 |
---------------------------------- |
| 384 |
|
| 385 |
-- Note: to add a profile, modify the following declarations appropriately, |
| 386 |
-- add Name_xxx to Snames, and add a branch to the conditions for pragmas |
| 387 |
-- Profile and Profile_Warnings in the body of Sem_Prag. |
| 388 |
|
| 389 |
type Profile_Name is |
| 390 |
(No_Profile, |
| 391 |
No_Implementation_Extensions, |
| 392 |
Restricted_Tasking, |
| 393 |
Restricted, |
| 394 |
Ravenscar, |
| 395 |
Jorvik, |
| 396 |
GNAT_Extended_Ravenscar, |
| 397 |
GNAT_Ravenscar_EDF); |
| 398 |
-- Names of recognized profiles. No_Profile is used to indicate that a |
| 399 |
-- restriction came from pragma Restrictions[_Warning], as opposed to |
| 400 |
-- pragma Profile[_Warning]. Restricted_Tasking is a non-user profile that |
| 401 |
-- contaings the minimal set of restrictions to trigger the user of the |
| 402 |
-- restricted tasking runtime. Restricted is the corresponding user profile |
| 403 |
-- that also restrict protected types. |
| 404 |
|
| 405 |
subtype Profile_Name_Actual is Profile_Name |
| 406 |
range No_Implementation_Extensions .. Profile_Name'Last; |
| 407 |
-- Actual used profile names |
| 408 |
|
| 409 |
type Profile_Data is record |
| 410 |
Set : Restriction_Flags; |
| 411 |
-- Set to True if given restriction must be set for the profile, and |
| 412 |
-- False if it need not be set (False does not mean that it must not be |
| 413 |
-- set, just that it need not be set). If the flag is True for a |
| 414 |
-- parameter restriction, then the Value array gives the maximum value |
| 415 |
-- permitted by the profile. |
| 416 |
|
| 417 |
Value : Restriction_Values; |
| 418 |
-- An entry in this array is meaningful only if the corresponding flag |
| 419 |
-- in Set is True. In that case, the value in this array is the maximum |
| 420 |
-- value of the parameter permitted by the profile. |
| 421 |
end record; |
| 422 |
|
| 423 |
Profile_Info : constant array (Profile_Name_Actual) of Profile_Data := ( |
| 424 |
|
| 425 |
-- No_Implementation_Extensions profile |
| 426 |
|
| 427 |
No_Implementation_Extensions => |
| 428 |
|
| 429 |
(Set => |
| 430 |
(No_Implementation_Aspect_Specifications => True, |
| 431 |
No_Implementation_Attributes => True, |
| 432 |
No_Implementation_Identifiers => True, |
| 433 |
No_Implementation_Pragmas => True, |
| 434 |
No_Implementation_Units => True, |
| 435 |
others => False), |
| 436 |
|
| 437 |
-- Value settings for Restricted profile (none |
| 438 |
|
| 439 |
Value => |
| 440 |
(others => 0)), |
| 441 |
|
| 442 |
-- Restricted_Tasking Profile |
| 443 |
|
| 444 |
Restricted_Tasking => |
| 445 |
|
| 446 |
-- Restrictions for Restricted_Tasking profile |
| 447 |
|
| 448 |
(Set => |
| 449 |
(No_Abort_Statements => True, |
| 450 |
No_Asynchronous_Control => True, |
| 451 |
No_Dynamic_Attachment => True, |
| 452 |
No_Dynamic_CPU_Assignment => True, |
| 453 |
No_Local_Protected_Objects => True, |
| 454 |
No_Protected_Type_Allocators => True, |
| 455 |
No_Requeue_Statements => True, |
| 456 |
No_Task_Allocators => True, |
| 457 |
No_Task_Attributes_Package => True, |
| 458 |
No_Task_Hierarchy => True, |
| 459 |
No_Terminate_Alternatives => True, |
| 460 |
Max_Asynchronous_Select_Nesting => True, |
| 461 |
Max_Select_Alternatives => True, |
| 462 |
Max_Task_Entries => True, |
| 463 |
others => False), |
| 464 |
|
| 465 |
-- Value settings for Restricted_Tasking profile |
| 466 |
|
| 467 |
Value => |
| 468 |
(Max_Asynchronous_Select_Nesting => 0, |
| 469 |
Max_Select_Alternatives => 0, |
| 470 |
Max_Task_Entries => 0, |
| 471 |
others => 0)), |
| 472 |
|
| 473 |
-- Restricted Profile |
| 474 |
|
| 475 |
Restricted => |
| 476 |
|
| 477 |
-- Restrictions for Restricted profile |
| 478 |
|
| 479 |
(Set => |
| 480 |
(No_Abort_Statements => True, |
| 481 |
No_Asynchronous_Control => True, |
| 482 |
No_Dynamic_Attachment => True, |
| 483 |
No_Dynamic_CPU_Assignment => True, |
| 484 |
No_Dynamic_Priorities => True, |
| 485 |
No_Entry_Queue => True, |
| 486 |
No_Local_Protected_Objects => True, |
| 487 |
No_Protected_Type_Allocators => True, |
| 488 |
No_Requeue_Statements => True, |
| 489 |
No_Task_Allocators => True, |
| 490 |
No_Task_Attributes_Package => True, |
| 491 |
No_Task_Hierarchy => True, |
| 492 |
No_Terminate_Alternatives => True, |
| 493 |
Max_Asynchronous_Select_Nesting => True, |
| 494 |
Max_Protected_Entries => True, |
| 495 |
Max_Select_Alternatives => True, |
| 496 |
Max_Task_Entries => True, |
| 497 |
others => False), |
| 498 |
|
| 499 |
-- Value settings for Restricted profile |
| 500 |
|
| 501 |
Value => |
| 502 |
(Max_Asynchronous_Select_Nesting => 0, |
| 503 |
Max_Protected_Entries => 1, |
| 504 |
Max_Select_Alternatives => 0, |
| 505 |
Max_Task_Entries => 0, |
| 506 |
others => 0)), |
| 507 |
|
| 508 |
-- Ravenscar Profile |
| 509 |
|
| 510 |
-- Note: the table entries here only represent the |
| 511 |
-- required restriction profile for Ravenscar. The |
| 512 |
-- full Ravenscar profile also requires: |
| 513 |
|
| 514 |
-- pragma Dispatching_Policy (FIFO_Within_Priorities); |
| 515 |
-- pragma Locking_Policy (Ceiling_Locking); |
| 516 |
-- pragma Detect_Blocking; |
| 517 |
|
| 518 |
Ravenscar => |
| 519 |
|
| 520 |
-- Restrictions for Ravenscar = Restricted profile .. |
| 521 |
|
| 522 |
(Set => |
| 523 |
(No_Abort_Statements => True, |
| 524 |
No_Asynchronous_Control => True, |
| 525 |
No_Dynamic_Attachment => True, |
| 526 |
No_Dynamic_CPU_Assignment => True, |
| 527 |
No_Dynamic_Priorities => True, |
| 528 |
No_Entry_Queue => True, |
| 529 |
No_Local_Protected_Objects => True, |
| 530 |
No_Protected_Type_Allocators => True, |
| 531 |
No_Requeue_Statements => True, |
| 532 |
No_Task_Allocators => True, |
| 533 |
No_Task_Attributes_Package => True, |
| 534 |
No_Task_Hierarchy => True, |
| 535 |
No_Terminate_Alternatives => True, |
| 536 |
Max_Asynchronous_Select_Nesting => True, |
| 537 |
Max_Protected_Entries => True, |
| 538 |
Max_Select_Alternatives => True, |
| 539 |
Max_Task_Entries => True, |
| 540 |
|
| 541 |
-- plus these additional restrictions: |
| 542 |
|
| 543 |
No_Calendar => True, |
| 544 |
No_Implicit_Heap_Allocations => True, |
| 545 |
No_Local_Timing_Events => True, |
| 546 |
No_Relative_Delay => True, |
| 547 |
No_Select_Statements => True, |
| 548 |
No_Specific_Termination_Handlers => True, |
| 549 |
No_Task_Termination => True, |
| 550 |
Simple_Barriers => True, |
| 551 |
others => False), |
| 552 |
|
| 553 |
-- Value settings for Ravenscar (same as Restricted) |
| 554 |
|
| 555 |
Value => |
| 556 |
(Max_Asynchronous_Select_Nesting => 0, |
| 557 |
Max_Protected_Entries => 1, |
| 558 |
Max_Select_Alternatives => 0, |
| 559 |
Max_Task_Entries => 0, |
| 560 |
others => 0)), |
| 561 |
|
| 562 |
Jorvik | GNAT_Extended_Ravenscar => |
| 563 |
|
| 564 |
-- Restrictions for Jorvik profile, previously known |
| 565 |
-- known as the GNAT_Extended_Ravenscar profile. |
| 566 |
|
| 567 |
-- Note: the table entries here only represent the |
| 568 |
-- required restriction profile for Jorvik. The |
| 569 |
-- full Jorvik profile also requires: |
| 570 |
|
| 571 |
-- pragma Dispatching_Policy (FIFO_Within_Priorities); |
| 572 |
-- pragma Locking_Policy (Ceiling_Locking); |
| 573 |
-- pragma Detect_Blocking; |
| 574 |
|
| 575 |
-- The differences between Ravenscar and Jorvik are |
| 576 |
-- as follows: |
| 577 |
-- 1) Ravenscar includes restriction Simple_Barriers; |
| 578 |
-- Jorvik includes Pure_Barriers instead. |
| 579 |
-- 2) The No_Implicit_Heap_Allocations restriction is |
| 580 |
-- lifted and replaced with the following |
| 581 |
-- restrictions: |
| 582 |
-- No_Implicit_Task_Allocations |
| 583 |
-- No_Implicit_Protected_Object_Allocations |
| 584 |
-- 3) The following 6 restrictions are included in |
| 585 |
-- Ravenscar but not in Jorvik: |
| 586 |
-- No_Implicit_Heap_Allocations |
| 587 |
-- No_Relative_Delay |
| 588 |
-- Max_Entry_Queue_Length => 1 |
| 589 |
-- Max_Protected_Entries => 1 |
| 590 |
-- No_Dependence => Ada.Calendar |
| 591 |
-- No_Dependence => Ada.Synchronous_Barriers |
| 592 |
-- |
| 593 |
-- The last of those 7 (i.e., No_Dep => Ada.Synch_Bars) |
| 594 |
-- is not reflected here (see sem_prag.adb). |
| 595 |
|
| 596 |
(Set => |
| 597 |
(No_Abort_Statements => True, |
| 598 |
No_Asynchronous_Control => True, |
| 599 |
No_Dynamic_Attachment => True, |
| 600 |
No_Dynamic_CPU_Assignment => True, |
| 601 |
No_Dynamic_Priorities => True, |
| 602 |
No_Local_Protected_Objects => True, |
| 603 |
No_Protected_Type_Allocators => True, |
| 604 |
No_Requeue_Statements => True, |
| 605 |
No_Task_Allocators => True, |
| 606 |
No_Task_Attributes_Package => True, |
| 607 |
No_Task_Hierarchy => True, |
| 608 |
No_Terminate_Alternatives => True, |
| 609 |
Max_Asynchronous_Select_Nesting => True, |
| 610 |
Max_Select_Alternatives => True, |
| 611 |
Max_Task_Entries => True, |
| 612 |
|
| 613 |
-- plus these additional restrictions: |
| 614 |
|
| 615 |
No_Implicit_Task_Allocations => True, |
| 616 |
No_Implicit_Protected_Object_Allocations |
| 617 |
=> True, |
| 618 |
No_Local_Timing_Events => True, |
| 619 |
No_Select_Statements => True, |
| 620 |
No_Specific_Termination_Handlers => True, |
| 621 |
No_Task_Termination => True, |
| 622 |
Pure_Barriers => True, |
| 623 |
others => False), |
| 624 |
|
| 625 |
-- Value settings for Ravenscar (same as Restricted) |
| 626 |
|
| 627 |
Value => |
| 628 |
(Max_Asynchronous_Select_Nesting => 0, |
| 629 |
Max_Select_Alternatives => 0, |
| 630 |
Max_Task_Entries => 0, |
| 631 |
others => 0)), |
| 632 |
|
| 633 |
-- GNAT_Ravenscar_EDF Profile |
| 634 |
|
| 635 |
-- Note: the table entries here only represent the |
| 636 |
-- required restriction profile for GNAT_Ravenscar_EDF. |
| 637 |
-- The full GNAT_Ravenscar_EDF profile also requires: |
| 638 |
|
| 639 |
-- pragma Dispatching_Policy (EDF_Across_Priorities); |
| 640 |
-- pragma Locking_Policy (Ceiling_Locking); |
| 641 |
-- pragma Detect_Blocking; |
| 642 |
|
| 643 |
GNAT_Ravenscar_EDF => |
| 644 |
|
| 645 |
-- Restrictions for Ravenscar = Restricted profile .. |
| 646 |
|
| 647 |
(Set => |
| 648 |
(No_Abort_Statements => True, |
| 649 |
No_Asynchronous_Control => True, |
| 650 |
No_Dynamic_Attachment => True, |
| 651 |
No_Dynamic_CPU_Assignment => True, |
| 652 |
No_Dynamic_Priorities => True, |
| 653 |
No_Entry_Queue => True, |
| 654 |
No_Local_Protected_Objects => True, |
| 655 |
No_Protected_Type_Allocators => True, |
| 656 |
No_Requeue_Statements => True, |
| 657 |
No_Task_Allocators => True, |
| 658 |
No_Task_Attributes_Package => True, |
| 659 |
No_Task_Hierarchy => True, |
| 660 |
No_Terminate_Alternatives => True, |
| 661 |
Max_Asynchronous_Select_Nesting => True, |
| 662 |
Max_Protected_Entries => True, |
| 663 |
Max_Select_Alternatives => True, |
| 664 |
Max_Task_Entries => True, |
| 665 |
|
| 666 |
-- plus these additional restrictions: |
| 667 |
|
| 668 |
No_Calendar => True, |
| 669 |
No_Implicit_Heap_Allocations => True, |
| 670 |
No_Local_Timing_Events => True, |
| 671 |
No_Relative_Delay => True, |
| 672 |
No_Select_Statements => True, |
| 673 |
No_Specific_Termination_Handlers => True, |
| 674 |
No_Task_Termination => True, |
| 675 |
Simple_Barriers => True, |
| 676 |
others => False), |
| 677 |
|
| 678 |
-- Value settings for Ravenscar (same as Restricted) |
| 679 |
|
| 680 |
Value => |
| 681 |
(Max_Asynchronous_Select_Nesting => 0, |
| 682 |
Max_Protected_Entries => 1, |
| 683 |
Max_Select_Alternatives => 0, |
| 684 |
Max_Task_Entries => 0, |
| 685 |
others => 0))); |
| 686 |
|
| 687 |
end System.Rident; |