-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Bruce Korb on 12/14/2006 7:37 PM:
> Hi,
> 
> After today's little discussion about it not being portable to capture
> the return value from [sig]setjmp(), I've modified the signal handlers
> to stash the signal number in a global before doing the long jump.
> I think C compilers ought to get fixed, but okay I don't get to go
> whack them around for being dumb.  This release is supposed to have
> all the signal handling issues fixed:

Nope, you still have some setjmp errors.

2006-12-15  Eric Blake  <[EMAIL PROTECTED]>

        * config/misc.def (setjmp, sigsetjmp): Follow POSIX rules for
        [sig]setjmp.
        * agen5/tpProcess.c (doStdoutTemplate, processTemplate): Likewise.

- --
Life is short - so eat dessert first!

Eric Blake             [EMAIL PROTECTED]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFgumb84KuGfSFAYARAkkvAJ4h7KJlEN9BHYWFaM+IkIuRo1xD7QCeJJ+B
LgnTSsRUA5sASARXfTmFDOU=
=//AN
-----END PGP SIGNATURE-----
diff -rup autogen-5.8.8pre7-orig/agen5/tpProcess.c 
autogen-5.8.8pre7/agen5/tpProcess.c
--- autogen-5.8.8pre7-orig/agen5/tpProcess.c    2006-12-15 09:10:30.540125000 
-0700
+++ autogen-5.8.8pre7/agen5/tpProcess.c 2006-12-15 10:05:59.383875000 -0700
@@ -1,4 +1,3 @@
-
 /*
  *  agTempl.c
  *  $Id: tpProcess.c,v 4.14 2006/12/10 19:41:26 bkorb Exp $
@@ -97,14 +96,13 @@ static void
 doStdoutTemplate( tTemplate* pTF )
 {
     tSCC zNoSfx[] = "* NONE *";
-    tSCC zBadR[]  = "%sBogus return from setjmp:  %d\n";
-    int  jmpcode  = setjmp( fileAbort );
+    tSCC zBadR[]  = "%sBogus return from setjmp\n";
     SCM  res;
     tCC* pzRes;
 
     pzLastScheme = NULL; /* We cannot be in Scheme processing */
 
-    switch (jmpcode) {
+    switch (setjmp (fileAbort)) {
     case SUCCESS:
         break;
 
@@ -118,10 +116,10 @@ doStdoutTemplate( tTemplate* pTF )
 
     default:
         if (*pzOopsPrefix != NUL) {
-            fprintf( stdout, zBadR, pzOopsPrefix, jmpcode );
+            fprintf( stdout, zBadR, pzOopsPrefix );
             pzOopsPrefix = zNil;
         } else {
-            fprintf( pfTrace, zBadR+2, jmpcode );
+            fprintf( pfTrace, zBadR+2 );
         }
 
     case FAILURE:
@@ -185,7 +183,6 @@ processTemplate( tTemplate* pTF )
 
     for (;;) {
         tOutSpec*  pOS    = pOutSpecList;
-        int        jumpCd = setjmp( fileAbort );
 
         /*
          * We cannot be in Scheme processing.  We've either just started
@@ -198,7 +195,8 @@ processTemplate( tTemplate* pTF )
         /*
          *  HOW was that we got here?
          */
-        if (jumpCd == SUCCESS) {
+        switch (setjmp( fileAbort )) {
+        case SUCCESS:
             /*
              *  Set the output file name buffer.
              *  It may get switched inside openOutFile.
@@ -216,14 +214,23 @@ processTemplate( tTemplate* pTF )
             do  {
                 closeOutput( AG_FALSE );  /* keep output */
             } while (pCurFp->pPrev != NULL);
-        }
+            break;
 
-        else {
-            if ((jumpCd != PROBLEM) && (jumpCd != FAILURE)) {
-                fprintf( pfTrace, "%sBogus return from setjmp:  %d\n",
-                         pzOopsPrefix, jumpCd );
-                pzOopsPrefix = zNil;
-            }
+        case PROBLEM:
+            /*
+             *  We got here by a long jump.  Close/purge the open files.
+             */
+            do  {
+                closeOutput( AG_TRUE );  /* discard output */
+            } while (pCurFp->pPrev != NULL);
+            break;
+
+        default:
+            fprintf( pfTrace, "%sBogus return from setjmp\n",
+                     pzOopsPrefix );
+            pzOopsPrefix = zNil;
+            /* fall through */
+        case FAILURE:
 
             /*
              *  We got here by a long jump.  Close/purge the open files.
@@ -235,10 +242,8 @@ processTemplate( tTemplate* pTF )
             /*
              *  On failure (or unknown jump type), we quit the program, too.
              */
-            if (jumpCd != PROBLEM) {
-                procState = PROC_STATE_ABORTING;
-                exit( EXIT_FAILURE );
-            }
+            procState = PROC_STATE_ABORTING;
+            exit( EXIT_FAILURE );
         }
 
         /*
diff -rup autogen-5.8.8pre7-orig/config/misc.def 
autogen-5.8.8pre7/config/misc.def
--- autogen-5.8.8pre7-orig/config/misc.def      2006-12-15 09:10:31.258875000 
-0700
+++ autogen-5.8.8pre7/config/misc.def   2006-12-15 09:47:12.337000000 -0700
@@ -72,7 +72,9 @@ test   = {
   code     = <<- _EOCode_
        #include <setjmp.h>
        jmp_buf bf;
-       return setjmp(&bf);
+       if (setjmp(bf))
+         return 0;
+       return 0;
        _EOCode_;
   action = {
     act-type = script;
@@ -87,7 +89,9 @@ test   = {
   code     = <<- _EOCode_
        #include <setjmp.h>
        sigjmp_buf bf;
-       return sigsetjmp(bf,0);
+       if (sigsetjmp(bf,0))
+         return 0;
+       return 0;
        _EOCode_;
   action = {
     act-type = script;
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Autogen-users mailing list
Autogen-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/autogen-users

Reply via email to