Next: , Previous: Pragma Check_Name, Up: Implementation Defined Pragmas


Pragma Check_Policy

Syntax:

     pragma Check_Policy
      ([Name   =>] Identifier,
       [Policy =>] POLICY_IDENTIFIER);
     
     POLICY_IDENTIFIER ::= ON | OFF | CHECK | DISABLE | IGNORE

This pragma is similar to the predefined pragma Assertion_Policy, except that it controls sets of named assertions introduced using the Check pragmas. It can be used as a configuration pragma or (unlike Assertion_Policy) can be used within a declarative part, in which case it controls the status to the end of the corresponding construct (in a manner identical to pragma Suppress).

The identifier given as the first argument corresponds to a name used in associated Check pragmas. For example, if the pragma:

     pragma Check_Policy (Critical_Error, OFF);

is given, then subsequent Check pragmas whose first argument is also Critical_Error will be disabled. The special identifier Assertion controls the behavior of normal assertions (thus a pragma Check_Policy with this identifier is similar to the normal Assertion_Policy pragma except that it can appear within a declarative part).

The special identifiers Precondition and Postcondition control the status of preconditions and postconditions given as pragmas. If a Precondition pragma is encountered, it is ignored if turned off by a Check_Policy specifying that Precondition checks are Off or Ignored. Similarly use of the name Postcondition controls whether Postcondition pragmas are recognized. Note that preconditions and postconditions given as aspects are controlled differently, either by the Assertion_Policy pragma or by the Check_Policy pragma with identifier Assertion.

The check policy is OFF to turn off corresponding checks, and ON to turn on corresponding checks. The default for a set of checks for which no Check_Policy is given is OFF unless the compiler switch -gnata is given, which turns on all checks by default.

The check policy settings CHECK and IGNORE are also recognized as synonyms for ON and OFF. These synonyms are provided for compatibility with the standard Assertion_Policy pragma.

The implementation defined policy DISABLE is like OFF except that it completely disables semantic checking of the argument to the corresponding class of pragmas. This may be useful when the pragma arguments reference subprograms in a with'ed package which is replaced by a dummy package for the final build.