CVS difference for ais/ai-00329.txt
--- ais/ai-00329.txt 2004/03/02 04:45:00 1.4
+++ ais/ai-00329.txt 2004/04/06 19:57:12 1.5
@@ -1,7 +1,9 @@
-!standard B.01.00 (01) 04-03-01 AI95-00329/03
+!standard 6.05.01 (01) 04-03-29 AI95-00329/04
!standard 11.04.01 (04)
-!standard 11.04.01 (05)
+!standard 11.04.01 (14)
!class amendment 03-03-04
+!status Amendment 200Y 04-03-24
+!status ARG Approved 9-0-1 04-03-06
!status work item 03-03-04
!status received 03-03-04
!priority Medium
@@ -10,9 +12,8 @@
!summary
-Pragma No_Return specifies that a procedure never
-returns "normally" but rather always propagates an exception,
-or results in an abort of the calling task.
+Pragma No_Return specifies that a procedure never returns "normally" but rather
+can return only by propagating an exception.
Ada.Exceptions.Raise_Exception is changed to always raise an exception,
and has pragma No_Return apply to it. If Raise_Exception is passed
@@ -57,13 +58,13 @@
6.5.1 Pragma No_Return
- A pragma No_Return indicates that a procedure never returns normally;
- it always propagates an exception.
+ A pragma No_Return indicates that a procedure can return only by propagating
+ an exception.
Syntax
- The form of a pragma No_Return, which is a program unit pragma (see 10.1.5)
- is as follows:
+ The form of a pragma No_Return, which is a program unit pragma (see
+ 10.1.5), is as follows:
pragma No_Return(local_name {, local_name});
@@ -74,11 +75,16 @@
If a pragma No_Return applies to a procedure or a generic procedure, there
shall be no return_statements within the procedure.
+ Static Semantics
+
+ If a pragma No_Return applies to a generic procedure, pragma No_Return
+ applies to all instances of that generic procedure.
+
Dynamic Semantics
- If a pragma No_Return appies to a procedure, then the exception Program_Error
- is raised at the point of the call of the procedure if the procedure body
- completes normally rather than propagating an exception.
+ If a pragma No_Return applies to a procedure, then the exception
+ Program_Error is raised at the point of the call of the procedure if the
+ procedure body completes normally.
Add after 11.4.1(4):
@@ -150,7 +156,7 @@
of view of compile-time warnings, but it would still be OK
if the procedure did in fact return. However, that seemed
like a recipe for implementation complexity, since the compiler
-optimizer is almost being encouraged to assume something that
+optimizer is being encouraged to assume something that
might be false, which is a good way to create havoc.
Hence, we have simply adopted the rule for functions, namely
that Program_Error is raised if a No_Return procedure
@@ -164,8 +170,8 @@
but require that they could not be "reached." However,
we rejected basing legality rules on control flow analysis, since that
would seem to be a dangerous precedent to set at this point,
-since there are almost certainly current Ada compilers that
-at least in some modes don't do any flow analysis.
+since there are current Ada compilers that at least in some modes don't do
+any flow analysis.
Originally we considered allowing No_Return on functions,
but that seemed of little benefit, and outlawing return
@@ -204,7 +210,70 @@
without additional flags. Thus, we considered the incompatibility unacceptable
for Reraise_Occurrence.
+!corrigendum 6.5.1(1)
+
+@dinsc
+A pragma No_Return indicates that a procedure can return only by propagating
+an exception.
+
+@i<@s8<Syntax>>
+
+The form of a pragma No_Return, which is a program unit pragma (see
+10.1.5), is as follows:
+
+@xindent<@b<pragma> No_Return(@i<local_>@fa<name>{, @i<local_>@fa<name>});>
+
+@i<@s8<Legality Rules>>
+
+The pragma shall apply to one or more procedures or generic procedures.
+
+If a pragma No_Return applies to a procedure or a generic procedure, there
+shall be no @fa<return_statement>s within the procedure.
+
+@i<@s8<Static Semantics>>
+
+If a pragma No_Return applies to a generic procedure, pragma No_Return
+applies to all instances of that generic procedure.
+
+@i<@s8<Dynamic Semantics>>
+
+If a pragma No_Return applies to a procedure, then the exception
+Program_Error is raised at the point of the call of the procedure if the
+procedure body completes normally.
+
+!corrigendum 11.4.1(4)
+
+@drepl
+@xcode< @b<procedure> Raise_Exception(E : @b<in> Exception_Id;
+ Message : @b<in> String := "");
+ @b<function> Exception_Message(X : Exception_Occurrence) @b<return> String;
+ @b<procedure> Reraise_Occurrence(X : @b<in> Exception_Occurrence);>
+@dby
+@xcode< @b<procedure> Raise_Exception(E : @b<in> Exception_Id;
+ Message : @b<in> String := "");
+ @b<pragma> No_Return(Raise_Exception);
+ @b<function> Exception_Message(X : Exception_Occurrence) @b<return> String;
+ @b<procedure> Reraise_Occurrence(X : @b<in> Exception_Occurrence);>
+
+!corrigendum 11.4.1(14)
+
+@drepl
+Raise_Exception and Reraise_Occurrence have no effect in the case of Null_Id or
+Null_Occurrence. Exception_Message, Exception_Identity, Exception_Name, and
+Exception_Information raise Constraint_Error for a Null_Id or Null_Occurrence.
+@dby
+Reraise_Occurrence has no effect in the case of Null_Occurrence.
+Raise_Exception, Exception_Message, Exception_Identity, Exception_Name, and
+Exception_Information raise Constraint_Error for a Null_Id or Null_Occurrence.
+
!ACATS test
+
+Create an ACATS C-Test to check that a procedure with No_Return raises
+Program_Error if it reaches the end of the body.
+Create an ACATS B-Test to check that explicit return statements are
+illegal in a No_Return procedure.
+Create an ACATS C-Test to check that an instance of a generic procedure with
+No_Return raises Program_Error if it reaches the end of the body.
!appendix
Questions? Ask the ACAA Technical Agent