develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r34413 - in trunk: include/parrot src

From:
petdance
Date:
December 26, 2008 23:40
Subject:
[svn:parrot] r34413 - in trunk: include/parrot src
Message ID:
20081227074044.CA29CCBA12@x12.develooper.com
Author: petdance
Date: Fri Dec 26 23:40:44 2008
New Revision: 34413

Modified:
   trunk/include/parrot/exceptions.h
   trunk/src/exceptions.c

Log:
die_from_exception cannot return

Modified: trunk/include/parrot/exceptions.h
==============================================================================
--- trunk/include/parrot/exceptions.h	(original)
+++ trunk/include/parrot/exceptions.h	Fri Dec 26 23:40:44 2008
@@ -209,6 +209,11 @@
         __attribute__nonnull__(4);
 
 PARROT_DOES_NOT_RETURN
+void die_from_exception(PARROT_INTERP, ARGIN(PMC *exception))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2);
+
+PARROT_DOES_NOT_RETURN
 void do_panic(
     NULLOK_INTERP,
     ARGIN_NULLOK(const char *message),

Modified: trunk/src/exceptions.c
==============================================================================
--- trunk/src/exceptions.c	(original)
+++ trunk/src/exceptions.c	Fri Dec 26 23:40:44 2008
@@ -40,12 +40,6 @@
         __attribute__nonnull__(1)
         __attribute__nonnull__(3);
 
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static PMC * die_from_exception(PARROT_INTERP, ARGIN(PMC *exception))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
 PARROT_CAN_RETURN_NULL
 static opcode_t * pass_exception_args(PARROT_INTERP,
     ARGIN(const char *sig),
@@ -89,7 +83,7 @@
 
 /*
 
-=item C<static PMC * die_from_exception>
+=item C<void die_from_exception>
 
 Print a stack trace for C<exception>, a message if there is one, and then exit.
 
@@ -97,9 +91,8 @@
 
 */
 
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static PMC *
+PARROT_DOES_NOT_RETURN
+void
 die_from_exception(PARROT_INTERP, ARGIN(PMC *exception))
 {
     STRING * const message     = VTABLE_get_string(interp, exception);
@@ -194,9 +187,8 @@
     if (PMC_IS_NULL(handler)) {
         STRING * const message     = VTABLE_get_string(interp, exception);
         const INTVAL   severity    = VTABLE_get_integer_keyed_str(interp, exception, CONST_STRING(interp, "severity"));
-        PMC *dead;
         if (severity < EXCEPT_error) {
-            PMC *resume = VTABLE_get_attr_str(interp, exception, CONST_STRING(interp, "resume"));
+            PMC * const resume = VTABLE_get_attr_str(interp, exception, CONST_STRING(interp, "resume"));
             if (string_equal(interp, message, CONST_STRING(interp, "")) == 1) {
                 Parrot_io_eprintf(interp, "%S\n", message);
             }
@@ -212,7 +204,7 @@
                 return VTABLE_invoke(interp, resume, NULL);
             }
         }
-        dead = die_from_exception(interp, exception);
+        die_from_exception(interp, exception);
     }
 
     address    = VTABLE_invoke(interp, handler, dest);
@@ -253,9 +245,10 @@
         ARGIN(const char *format), va_list arglist)
 {
     /* Make and set exception message. */
-    STRING *msg = strchr(format, '%') ?
-        Parrot_vsprintf_c(interp, format, arglist) :
-        string_make(interp, format, strlen(format), NULL, 0);
+    STRING * const msg =
+        strchr(format, '%')
+            ? Parrot_vsprintf_c(interp, format, arglist)
+            : string_make(interp, format, strlen(format), NULL, 0);
 
     return Parrot_ex_build_exception(interp, EXCEPT_error, ex_type, msg);
 }
@@ -292,7 +285,7 @@
     RunProfile * const profile      = interp->profile;
     Parrot_runloop    *return_point = interp->current_runloop;
     if (PMC_IS_NULL(handler)) {
-        PMC *dead = die_from_exception(interp, exception);
+        die_from_exception(interp, exception);
     }
 
     /* If profiling, remember end time of lastop and generate entry for



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About