6.5.1 Pragma No_Return
A
pragma
No_Return indicates that a procedure cannot return normally; it may propagate
an exception or loop forever.
Syntax
The form of a
pragma
No_Return, which is a representation pragma (see
13.1),
is as follows:
Legality Rules
Each
procedure_local_name
shall denote one or more procedures or generic procedures; the denoted
entities are
non-returning. The
procedure_local_name
shall not denote a null procedure nor an instance of a generic unit.
A return statement shall not apply to a non-returning
procedure or generic procedure.
A procedure shall be non-returning if it overrides
a dispatching non-returning procedure.
In addition
to the places where Legality Rules normally apply (see
12.3),
this rule applies also in the private part of an instance of a generic
unit.
If a renaming-as-body completes a non-returning procedure
declaration, then the renamed procedure shall be non-returning.
Static Semantics
If a generic procedure is non-returning, then so
are its instances. If a procedure declared within a generic unit is non-returning,
then so are the corresponding copies of that procedure in instances.
Dynamic Semantics
If the body of a non-returning procedure completes
normally, Program_Error is raised at the point of the call.
Examples
procedure Fail(Msg : String); -- raises Fatal_Error exception
pragma No_Return(Fail);
-- Inform compiler and reader that procedure never returns normally