pragma Propagate_Exceptions (subprogram_LOCAL_NAME);
This pragma indicates that the given entity, which is the name of an
imported foreign-language subprogram may receive an Ada exception,
and that the exception should be propagated. It is relevant only if
zero cost exception handling is in use, and is thus never needed if
setjmp implementation of
exceptions is used (although it is harmless to use it in such cases).
The implementation of fast exceptions always properly propagates
exceptions through Ada code, as described in the Ada Reference Manual.
However, this manual is silent about the propagation of exceptions
through foreign code. For example, consider the
P3 are in Ada, but
P2 is in C.
P3 raises an Ada exception. The question is whether or not
it will be propagated through
P2 and can be handled in
setjmp implementation of exceptions,
the answer is always yes. For some targets on which zero cost exception
handling is implemented, the answer is also always yes. However, there
are some targets, notably in the current version all x86 architecture
targets, in which the answer is that such propagation does not
happen automatically. If such propagation is required on these
targets, it is mandatory to use
name all foreign language routines through which Ada exceptions
may be propagated.