Ada Reference ManualLegal Information
Contents   Index   References   Search   Previous   Next 

6.5.1 Pragma No_Return

1/2
A pragma No_Return indicates that a procedure cannot return normally; it may propagate an exception or loop forever. 

Syntax

2/2
The form of a pragma No_Return, which is a representation pragma (see 13.1), is as follows: 
3/2
  pragma No_Return(procedure_local_name{, procedure_local_name});

Legality Rules

4/2
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.
5/2
A return statement shall not apply to a non-returning procedure or generic procedure.
6/2
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.
7/2
If a renaming-as-body completes a non-returning procedure declaration, then the renamed procedure shall be non-returning.

Static Semantics

8/2
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

9/2
If the body of a non-returning procedure completes normally, Program_Error is raised at the point of the call.

Examples

10/2
procedure Fail(Msg : String);  -- raises Fatal_Error exception
pragma No_Return(Fail);
   -- Inform compiler and reader that procedure never returns normally

Contents   Index   References   Search   Previous   Next 
Ada-Europe Sponsored by Ada-Europe