Next: Pragma Comment, Previous: Pragma Check_Name, Up: Implementation Defined Pragmas
pragma Check_Policy ([Name =>] Identifier, POLICY_IDENTIFIER); POLICY_IDENTIFIER ::= On | Off | Check | 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 Assert
pragmas (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. 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.
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.