Syntax:
pragma Suppress (Identifier [, [On =>] Name]);
This is a standard pragma, and supports all the check names required in the RM. It is included here because GNAT recognizes some additional check names that are implementation defined (as permitted by the RM):
Alignment_Check
can be used to suppress alignment checks
on addresses used in address clauses. Such checks can also be suppressed
by suppressing range checks, but the specific use of Alignment_Check
allows suppression of alignment checks without suppressing other range checks.
Note that Alignment_Check
is suppressed by default on machines (such as
the x86) with non-strict alignment.
Atomic_Synchronization
can be used to suppress the special memory
synchronization instructions that are normally generated for access to
Atomic
variables to ensure correct synchronization between tasks
that use such variables for synchronization purposes.
Duplicated_Tag_Check
Can be used to suppress the check that is generated
for a duplicated tag value when a tagged type is declared.
Container_Checks
Can be used to suppress all checks within Ada.Containers
and instances of its children, including Tampering_Check.
Tampering_Check
Can be used to suppress tampering check in the containers.
Predicate_Check
can be used to control whether predicate checks are
active. It is applicable only to predicates for which the policy is
Check
. Unlike Assertion_Policy
, which determines if a given
predicate is ignored or checked for the whole program, the use of
Suppress
and Unsuppress
with this check name allows a given
predicate to be turned on and off at specific points in the program.
Validity_Check
can be used specifically to control validity checks.
If Suppress
is used to suppress validity checks, then no validity
checks are performed, including those specified by the appropriate compiler
switch or the Validity_Checks
pragma.
Check_Name
pragma are also allowed.
Note that pragma Suppress gives the compiler permission to omit checks, but does not require the compiler to omit checks. The compiler will generate checks if they are essentially free, even when they are suppressed. In particular, if the compiler can prove that a certain check will necessarily fail, it will generate code to do an unconditional ’raise’, even if checks are suppressed. The compiler warns in this case.
Of course, run-time checks are omitted whenever the compiler can prove that they will not fail, whether or not checks are suppressed.