Annotated Ada Reference Manual (Ada 202y Draft 1)Legal Information
Contents   Index   References   Search   Previous   Next 

13.12 Pragma Restrictions and Pragma Profile

1/3
{AI05-0246-1} [A pragma Restrictions expresses the user's intent to abide by certain restrictions. A pragma Profile expresses the user's intent to abide by a set of Restrictions or other specified run-time policies. These may facilitate the construction of simpler run-time environments.] 

Syntax

2
The form of a pragma Restrictions is as follows: 
3
  pragma Restrictions(restriction{, restriction});
4/2
{AI95-00381-01} restriction ::= restriction_identifier
    | restriction_parameter_identifier => restriction_parameter_argument
4.1/2
{AI95-00381-01} restriction_parameter_argument ::= name | expression

Name Resolution Rules

5
Unless otherwise specified for a particular restriction, the expression is expected to be of any integer type. 

Legality Rules

6
Unless otherwise specified for a particular restriction, the expression shall be static, and its value shall be nonnegative. 
7.a/3
This paragraph was deleted.
Paragraph 7 was deleted.

Post-Compilation Rules

8/3
{AI05-0013-1} A pragma Restrictions is a configuration pragma. If a pragma Restrictions applies to any compilation unit included in the partition, this may impose either (or both) of two kinds of requirements, as specified for the particular restriction:
8.1/3
{AI05-0013-1} A restriction may impose requirements on some or all of the units comprising the partition. Unless otherwise specified for a particular restriction, such a requirement applies to all of the units comprising the partition and is enforced via a post-compilation check.
8.2/3
{AI05-0013-1} A restriction may impose requirements on the run-time behavior of the program, as indicated by the specification of run-time behavior associated with a violation of the requirement.
8.a.1/3
Ramification: In this latter case, there is no post-compilation check needed for the requirement. 
8.3/1
 {8652/0042} {AI95-00130-01} For the purpose of checking whether a partition contains constructs that violate any restriction (unless specified otherwise for a particular restriction):
8.4/1
{8652/0042} {AI95-00130-01} Generic instances are logically expanded at the point of instantiation;
8.5/1
{8652/0042} {AI95-00130-01} If an object of a type is declared or allocated and not explicitly initialized, then all expressions appearing in the definition for the type and any of its ancestors are presumed to be used;
8.6/1
{8652/0042} {AI95-00130-01} A default_expression for a formal parameter or a generic formal object is considered to be used if and only if the corresponding actual parameter is not provided in a given call or instantiation. 

Implementation Permissions

8.7/3
 {AI05-0269-1} An implementation may provide implementation-defined restrictions; the identifier for an implementation-defined restriction shall differ from those of the language-defined restrictions. 
8.a.2/3
Implementation defined: Implementation-defined restrictions allowed in a pragma Restrictions.
9
An implementation may place limitations on the values of the expression that are supported, and limitations on the supported combinations of restrictions. The consequences of violating such limitations are implementation defined. 
9.a
Implementation defined: The consequences of violating limitations on Restrictions pragmas.
9.b
Ramification: Such limitations may be enforced at compile time or at run time. Alternatively, the implementation is allowed to declare violations of the restrictions to be erroneous, and not enforce them at all. 
9.1/1
 {8652/0042} {AI95-00130-01} An implementation is permitted to omit restriction checks for code that is recognized at compile time to be unreachable and for which no code is generated.
9.2/1
 {8652/0043} {AI95-00190-01} Whenever enforcement of a restriction is not required prior to execution, an implementation may nevertheless enforce the restriction prior to execution of a partition to which the restriction applies, provided that every execution of the partition would violate the restriction. 

Syntax

10/3
{AI95-00249-01} {AI05-0246-1} The form of a pragma Profile is as follows: 
11/3
  pragma Profile (profile_identifier {, profile_pragma_argument_association});

Legality Rules

12/3
{AI95-00249-01} {AI05-0246-1} The profile_identifier shall be the name of a usage profile. The semantics of any profile_pragma_argument_associations are defined by the usage profile specified by the profile_identifier.

Static Semantics

13/3
{AI95-00249-01} {AI05-0246-1} A profile is equivalent to the set of configuration pragmas that is defined for each usage profile. 

Post-Compilation Rules

14/3
{AI95-00249-01} A pragma Profile is a configuration pragma. There may be more than one pragma Profile for a partition. 

Implementation Permissions

15/3
{AI05-0269-1} An implementation may provide implementation-defined usage profiles; the identifier for an implementation-defined usage profile shall differ from those of the language-defined usage profiles.
15.a.1/3
Implementation defined: Implementation-defined usage profiles allowed in a pragma Profile.
16/2
NOTE 1   {AI95-00347-01} Restrictions intended to facilitate the construction of efficient tasking run-time systems are defined in D.7. Restrictions intended for use when constructing high integrity systems are defined in H.4.
17
NOTE 2   An implementation has to enforce the restrictions in cases where enforcement is required, even if it chooses not to take advantage of the restrictions in terms of efficiency. 
17.a
Discussion: It is not the intent that an implementation will support a different run-time system for every possible combination of restrictions. An implementation might support only two run-time systems, and document a set of restrictions that is sufficient to allow use of the more efficient and safe one. 

Extensions to Ada 83

17.b
Pragma Restrictions is new to Ada 95. 

Extensions to Ada 95

17.c/3
{AI95-00249-01} {AI05-0246-1} Pragma Profile is new; it was moved here by Ada 2012 and renamed to a "usage profile" but was otherwise unchanged. 

Wording Changes from Ada 95

17.d/2
{8652/0042} {AI95-00130-01} Corrigendum: Corrected the wording so that restrictions are checked inside of generic instantiations and in default expressions. Since not making these checks would violate the purpose of restrictions, we are not documenting this as an incompatibility.
17.e/2
{8652/0043} {AI95-00190-01} Corrigendum: Added a permission that restrictions can be enforced at compile-time. While this is technically incompatible, documenting it as such would be unnecessarily alarming - there should not be any programs depending on the runtime failure of restrictions.
17.f/2
{AI95-00381-01} The syntax of a restriction_parameter_argument has been defined to better support restriction No_Dependence (see 13.12.1).

Wording Changes from Ada 2005

17.g/3
{AI05-0013-1} Correction: When restrictions are checked has been clarified.

Contents   Index   References   Search   Previous   Next 
Ada-Europe Ada 2005 and 2012 Editions sponsored in part by Ada-Europe