10.1.5 Pragmas and Program Units
Name Resolution Rules
{
AI12-0417-1}
Certain
pragmas are
defined to be program unit pragmas. A name
given as the argument of a program unit pragma shall resolve to denote
the declarations or renamings of one or more program units that occur
immediately within the declarative region or compilation
in which the pragma
immediately occurs, or it shall resolve to denote the declaration of
the immediately enclosing program unit (if any); the pragma
applies to the denoted program unit(s). If there are no names
given as arguments, the pragma
applies to the immediately enclosing program unit.
Ramification: The
fact that this is a Name Resolution Rule means that the pragma
will not apply to declarations from outer declarative regions.
Legality Rules
{
AI12-0417-1}
A program unit pragma shall appear in one of these
places:
{
8652/0033}
{
AI95-00136-01}
Immediately within the visible part of a program
unit and before any nested declaration (but not within a generic formal
part), in which case the argument, if any, shall be a direct_name
that denotes the immediately enclosing program unit declaration.
Ramification: The
argument is optional in this case.
{
AI05-0132-1}
{
AI12-0417-1}
Certain
program unit pragmas are defined to be library unit pragmas. If
a library unit pragma applies to a program unit, the program unit shall
be a library unit.
Static Semantics
{
8652/0034}
{
AI95-00041-01}
{
AI12-0417-1}
A library unit pragma that applies to a generic
unit does not apply to its instances, unless a specific rule for the
pragma specifies the contrary.
Post-Compilation Rules
Implementation Permissions
{
AI95-00212-01}
An implementation may require that configuration pragmas that select
partition-wide or system-wide options be compiled when the environment
contains no
library_items
other than those of the predefined environment. In this case, the implementation
shall still accept configuration pragmas in individual compilations that
confirm the initially selected partition-wide or system-wide options.
Implementation Advice
{
8652/0034}
{
AI95-00041-01}
{
AI12-0417-1}
When applied to a generic unit, a program unit
pragma that is not a library unit pragma should apply to each instance
of the generic unit for which there is not an overriding pragma applied
directly to the instance.
This paragraph
was deleted.Implementation Advice:
When applied to a generic unit, a program
unit pragma that is not a library unit pragma should apply to each instance
of the generic unit for which there is not an overriding pragma applied
directly to the instance.
Wording Changes from Ada 95
This paragraph
was deleted.{
8652/0033}
{
AI95-00136-01}
{
AI12-0417-1}
Corrigendum: The wording was corrected to
ensure that a program unit pragma cannot appear in private parts or generic
formal parts.
This paragraph
was deleted.{
8652/0034}
{
AI95-00041-01}
{
AI12-0417-1}
Corrigendum: The wording was clarified to
explain the meaning of program unit and library unit pragmas in generic
units.
This paragraph
was deleted.{
AI12-0417-1}
The Implementation Advice added by the Corrigendum
was moved, as it was not in the normal order. (This changes the paragraph
number.) It originally was directly after the new Static Semantics rule.
{
AI95-00212-01}
The permission to place restrictions was clarified to:
Ensure that it applies only to partition-wide
configuration pragmas, not ones like Assertion_Policy (see
11.4.2),
which can be different in different units; and
Ensure that confirming pragmas are always
allowed.
Wording Changes from Ada 2005
This paragraph
was deleted.{
AI05-0132-1}
{
AI12-0417-1}
Correction: A library unit pragma must apply
directly to a library unit, even if no name is given in the pragma.
Wording Changes from Ada 2012
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe