Annotated Ada Reference ManualLegal Information
Contents   Index   References   Search   Previous   Next 

 J.10 Specific Suppression of Checks

1/2
{AI95-00224-01} Pragma Suppress can be used to suppress checks on specific entities. 

Syntax

2/2
{AI95-00224-01} The form of a specific Suppress pragma is as follows: 
3/2
  pragma Suppress(identifier, [On =>] name);

Legality Rules

4/2
{AI95-00224-01} The identifier shall be the name of a check (see 11.5). The name shall statically denote some entity.
5/2
{AI95-00224-01} For a specific Suppress pragma that is immediately within a package_specification, the name shall denote an entity (or several overloaded subprograms) declared immediately within the package_specification.

Static Semantics

6/2
{AI95-00224-01} A specific Suppress pragma applies to the named check from the place of the pragma to the end of the innermost enclosing declarative region, or, if the pragma is given in a package_specification, to the end of the scope of the named entity. The pragma applies only to the named entity, or, for a subtype, on objects and values of its type. A specific Suppress pragma suppresses the named check for any entities to which it applies (see 11.5). Which checks are associated with a specific entity is not defined by this International Standard.
6.a/2
Discussion: The language doesn't specify exactly which entities control whether a check is performed. For example, in 
6.b
pragma Suppress (Range_Check, On => A);
A := B;
6.c
whether or not the range check is performed is not specified. The compiler may require that checks are suppressed on B or on the type of A in order to omit the range check.

Implementation Permissions

7/2
{AI95-00224-01} An implementation is allowed to place restrictions on specific Suppress pragmas.
NOTES
8/2
3  {AI95-00224-01} An implementation may support a similar On parameter on pragma Unsuppress (see 11.5). 

Wording Changes from Ada 95

8.a/2
{AI95-00224-01} This clause is new. This feature was moved here because it is important for pragma Unsuppress that there be an unambiguous meaning for each checking pragma. For instance, in the example
8.b
pragma Suppress (Range_Check);
pragma Unsuppress (Range_Check, On => A);
A := B;
8.c
the user needs to be able to depend on the range check being made on the assignment. But a compiler survey showed that the interpretation of this feature varied widely; trying to define this carefully was likely to cause a lot of user and implementer pain. Thus the feature was moved here, to emphasize that its use is not portable. 

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