Next: , Previous: , Up: Implementation Defined Pragmas   [Contents][Index]


2.24 Pragma Check

Syntax:

pragma Check (
     [Name    =>] CHECK_KIND,
     [Check   =>] Boolean_EXPRESSION
  [, [Message =>] string_EXPRESSION] );

CHECK_KIND ::= IDENTIFIER           |
               Pre'Class            |
               Post'Class           |
               Type_Invariant'Class |
               Invariant'Class

This pragma is similar to the predefined pragma Assert except that an extra identifier argument is present. In conjunction with pragma Check_Policy, this can be used to define groups of assertions that can be independently controlled. The identifier Assertion is special, it refers to the normal set of pragma Assert statements.

Checks introduced by this pragma are normally deactivated by default. They can be activated either by the command line option `-gnata', which turns on all checks, or individually controlled using pragma Check_Policy.

The identifiers Assertions and Statement_Assertions are not permitted as check kinds, since this would cause confusion with the use of these identifiers in Assertion_Policy and Check_Policy pragmas, where they are used to refer to sets of assertions.