CVS difference for ais/ai-00329.txt

Differences between 1.1 and version 1.2
Log of other versions for file ais/ai-00329.txt

--- ais/ai-00329.txt	2003/06/18 00:03:48	1.1
+++ ais/ai-00329.txt	2004/03/02 01:54:58	1.2
@@ -1,4 +1,4 @@
-!standard B.01.00      (01)                            03-06-23  AI95-00329/01
+!standard B.01.00      (01)                            04-03-0129 AI95-00329/03
 !standard 11.04.01     (04)
 !standard 11.04.01     (05)
 !class amendment 03-03-04
@@ -40,7 +40,7 @@
 
 !proposal
 
-    pragma No_Return(local_name {, local_name);
+    pragma No_Return(local_name {, local_name});
 
 This pragma is a program unit pragma, and is modeled after the
 Inline pragma, and has similar syntax, name resolution, and legality
@@ -64,7 +64,43 @@
 
 !wording
 
+Add new clause:
 
+  6.5.1 Pragma No_Return
+
+  A pragma No_Return indicates that a procedure never returns normally;
+  it always propagates an exception.
+
+                     Syntax
+
+    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});
+
+                     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 return_statements within the 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.
+
+Add after 11.4.1(4):
+
+      pragma No_Return(Raise_Exception);
+
+Modify 11.4.1(14) as follows:
+
+  [Raise_Exception and] Reraise_Occurrence [have] {has} no effect in the case
+  of [Null_Id or] Null_Occurrence.  {Raise_Exception,} Exception_Message, ...
+
+
 !example
 
     procedure Fatal_Error(Msg : String);
@@ -137,7 +173,7 @@
 to violate this, but this clearly should be erroneous.)
 
 We also considered rules that would allow return statements,
-but require that they could not be "reached."  However,
+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
@@ -160,8 +196,7 @@
 can generalize the warning to apply to No_Return procedures
 as well, so the safety provided by the GNAT rule can be preserved
 presuming GNAT users take warnings seriously. (We guess
-they do in that GNAT has a "treat warnings as errors"
-flag.)
+they do in that GNAT has a "treat warnings as errors" flag.)
 
 Optional addition:
 
@@ -192,6 +227,14 @@
         procedure Raise_Exception( ... );
         procedure Reraise_Occurrence( ... );
    end Ada.Exceptions.No_Return;
+
+
+We have made this pragma apply to Ada.Exceptions.Raise_Exception. This
+requires a (slightly) incompatible change, as Raise_Exception is defined
+in Ada 95 to have no effect if the argument is Null_Id. But this is an
+odd definition - when you call Raise_Exception, you really want it to raise
+an exception. Thus, we've changed it to raise Constraint_Error when passed
+Null_Id.
 
 
 !ACATS test

Questions? Ask the ACAA Technical Agent