Go to the first, previous, next, last section, table of contents.


10.2.1 Elaboration Control

  1. This subclause defines pragmas that help control the elaboration order of library_items.

    Syntax

  2. The form of a pragma Preelaborate is as follows:
  3. pragma Preelaborate[(library_unit_name)];
    
    1. A pragma Preelaborate is a library unit pragma.

Legality Rules

  1. An elaborable construct is preelaborable unless its elaboration performs any of the following actions:
    1. The execution of a statement other than a null_statement.
    2. A call to a subprogram other than a static function.
    3. The evaluation of a primary that is a name of an object, unless the name is a static expression, or statically denotes a discriminant of an enclosing type.
    4. The creation of a default-initialized object (including a component) of a descendant of a private type, private extension, controlled type, task type, or protected type with entry_declarations; similarly the evaluation of an extension_aggregate with an ancestor subtype_mark denoting a subtype of such a type.

  1. A generic body is preelaborable only if elaboration of a corresponding instance body would not perform any such actions, presuming that the actual for each formal private type (or extension) is a private type (or extension), and the actual for each formal subprogram is a user-defined subprogram.
  2. If a pragma Preelaborate (or pragma Pure -- see below) applies to a library unit, then it is preelaborated. If a library unit is preelaborated, then its declaration, if any, and body, if any, are elaborated prior to all non-preelaborated library_items of the partition. All compilation units of a preelaborated library unit shall be preelaborable. In addition to the places where Legality Rules normally apply, See section 12.3 Generic Instantiation, this rule applies also in the private part of an instance of a generic unit. In addition, all compilation units of a preelaborated library unit shall depend semantically only on compilation units of other preelaborated library units.

    Implementation Advice

  3. In an implementation, a type declared in a preelaborated package should have the same representation in every elaboration of a given version of the package, whether the elaborations occur in distinct executions of the same program, or in executions of distinct programs or partitions that include the given version.

    Syntax

  4. The form of a pragma Pure is as follows:
  5. pragma Pure[(library_unit_name)];
    
    1. A pragma Pure is a library unit pragma.

      Legality Rules

  1. A pure library_item is a preelaborable library_item that does not contain the declaration of any variable or named access type, except within a subprogram, generic subprogram, task unit, or protected unit.
  2. A pragma Pure is used to declare that a library unit is pure. If a pragma Pure applies to a library unit, then its compilation units shall be pure, and they shall depend semantically only on compilation units of other library units that are declared pure.

    Implementation Permissions

  3. If a library unit is declared pure, then the implementation is permitted to omit a call on a library-level subprogram of the library unit if the results are not needed after the call. Similarly, it may omit such a call and simply reuse the results produced by an earlier call on the same subprogram, provided that none of the parameters are of a limited type, and the addresses and values of all by-reference actual parameters, and the values of all by-copy-in actual parameters, are the same as they were at the earlier call. This permission applies even if the subprogram produces other side effects when called.

    Syntax

  4. The form of a pragma Elaborate, Elaborate_All, or Elaborate_Body is as follows:
  5. pragma Elaborate(library_unit_name{, library_unit_name});
    
  6. pragma Elaborate_All(library_unit_name{, library_unit_name});
    
  7. pragma Elaborate_Body[(library_unit_name)];
    
    1. A pragma Elaborate or Elaborate_All is only allowed within a context_clause.
    2. A pragma Elaborate_Body is a library unit pragma.

Legality Rules

  1. If a pragma Elaborate_Body applies to a declaration, then the declaration requires a completion (a body).

    Static Semantics

  2. A pragma Elaborate specifies that the body of the named library unit is elaborated before the current library_item. A pragma Elaborate_All specifies that each library_item that is needed by the named library unit declaration is elaborated before the current library_item. A pragma Elaborate_Body specifies that the body of the library unit is elaborated immediately after its declaration.

    NOTES

  3. (12) A preelaborated library unit is allowed to have non-preelaborable children.
  4. (13) A library unit that is declared pure is allowed to have impure children.


Go to the first, previous, next, last section, table of contents.