Ada Programming/Aspects/No Return

with No_Return

Description
Specifying the aspect No_Return indicates that a procedure cannot return normally; it may raise an exception, loop forever, or terminate the program.

A non-returning procedure may not contain any return statements. If a non-returning procedure implicitly returns (by reaching the end of its statement sequence), Program_Error will be raised at the point of call.

On the call site, this enables detection of dead code and suppression of warnings about missing return statements or missing assignment to variables.

Example
P ( … ) No_Return; Q (x : … ) Cond P ( … ); Some_Thing_Else; x := … ; ; Q;

Portability
The aspect No_Return was introduced in Ada 2012. It is the replacement for pragma No_Return which was introduced in Ada 2005.

Wikibook

 * Ada Programming
 * Ada Programming/Aspects
 * Ada Programming/Subprograms