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

Pragma Assertion_Policy


     pragma Assertion_Policy (CHECK | DISABLE | IGNORE);

This is a standard Ada 2005 pragma that is available as an implementation-defined pragma in earlier versions of Ada.

If the argument is CHECK, then assertions are enabled. If the argument is IGNORE, then assertions are ignored. This pragma overrides the effect of the -gnata switch on the command line.

Assertions are of three kinds:

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

Note: this is a standard language-defined pragma in versions of Ada from 2005 on. In GNAT, it is implemented in all versions of Ada, and the DISABLE policy is an implementation-defined addition.