H.7 Extensions to Global and Global'Class Aspects
In addition to the entities specified in
6.1.2,
the Global aspect may be specified for a subtype (including a formal
subtype), formal package, formal subprogram, and formal object of an
anonymous access-to-subprogram type.
Syntax
The following additional
syntax is provided to override the mode of a formal parameter to reflect
indirect effects on variables reachable from the formal parameter by
one or more access-value dereferences:
Name Resolution Rules
The
object_name
that is associated with an
overriding mode shall resolve to statically
denote a formal object, or a formal parameter of the associated entity.
Static Semantics
The presence of the reserved word overriding
in a global mode indicates that the specification is overriding the mode
of a formal parameter with another mode to reflect the overall effect
of an invocation of the callable entity on the state associated with
the corresponding actual parameter.
As described in
6.1.2,
the following rules are defined in terms of operations that are performed
by or on behalf of an entity.
The Global aspect for a subtype identifies the global
variables that can be referenced during default initialization, adjustment
as part of assignment, finalization of an object of the subtype, or conversion
to the subtype, including the evaluation of any assertion expressions
that apply. If not specified for the first subtype of a derived type,
the aspect defaults to that of the ancestor subtype; if not specified
for a nonderived composite first subtype the aspect defaults to that
of the enclosing library unit; if not specified for a nonderived elementary
first subtype (or scalar base subtype), the aspect defaults to
null
in the absence of a predicate (or when the predicate is statically True),
and to that of the enclosing library unit otherwise. If not specified
for a nonfirst subtype
S, the Global aspect defaults to that of
the subtype identified in the
subtype_indication
defining
S.
The Global'Class aspect may be specified for the
first subtype of a tagged type T, indicating an upper bound on
the Global aspect of any descendant of T. If not specified, it
defaults to Unspecified.
Legality Rules
For a tagged subtype T, each mode of its Global
aspect shall identify a subset of the variables identified either by
the corresponding mode, or by the in out mode, of the Global'Class
aspect of the first subtype of any ancestor of T.
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe