]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - nptl/unwind.c
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / nptl / unwind.c
index e8011b648f96ac25e57cb293aaa0e46d587ca304..a0c70d2433f9997dbd39e6c968e8c6b41e42f850 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2016 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>
    and Richard Henderson <rth@redhat.com>, 2003.
    <http://www.gnu.org/licenses/>.  */
 
 #include <setjmp.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 #include "pthreadP.h"
 #include <jmpbuf-unwind.h>
 
-#ifdef HAVE_FORCED_UNWIND
-
 #ifdef _STACK_GROWS_DOWN
 # define FRAME_LEFT(frame, other, adj) \
   ((uintptr_t) frame - adj >= (uintptr_t) other - adj)
@@ -62,7 +61,7 @@ unwind_stop (int version, _Unwind_Action actions,
                                    adj))
     do_longjump = 1;
 
-  if (__builtin_expect (curp != NULL, 0))
+  if (__glibc_unlikely (curp != NULL))
     {
       /* Handle the compatibility stuff.  Execute all handlers
         registered with the old method which would be unwound by this
@@ -103,15 +102,9 @@ unwind_cleanup (_Unwind_Reason_Code reason, struct _Unwind_Exception *exc)
 {
   /* When we get here a C++ catch block didn't rethrow the object.  We
      cannot handle this case and therefore abort.  */
-# define STR_N_LEN(str) str, strlen (str)
-  INTERNAL_SYSCALL_DECL (err);
-  INTERNAL_SYSCALL (write, err, 3, STDERR_FILENO,
-                   STR_N_LEN ("FATAL: exception not rethrown\n"));
-  abort ();
+  __libc_fatal ("FATAL: exception not rethrown\n");
 }
 
-#endif /* have forced unwind */
-
 
 void
 __cleanup_fct_attribute __attribute ((noreturn))
@@ -120,42 +113,12 @@ __pthread_unwind (__pthread_unwind_buf_t *buf)
   struct pthread_unwind_buf *ibuf = (struct pthread_unwind_buf *) buf;
   struct pthread *self = THREAD_SELF;
 
-#ifdef HAVE_FORCED_UNWIND
   /* This is not a catchable exception, so don't provide any details about
      the exception type.  We do need to initialize the field though.  */
   THREAD_SETMEM (self, exc.exception_class, 0);
   THREAD_SETMEM (self, exc.exception_cleanup, &unwind_cleanup);
 
   _Unwind_ForcedUnwind (&self->exc, unwind_stop, ibuf);
-#else
-  /* Handle the compatibility stuff first.  Execute all handlers
-     registered with the old method.  We don't execute them in order,
-     instead, they will run first.  */
-  struct _pthread_cleanup_buffer *oldp = ibuf->priv.data.cleanup;
-  struct _pthread_cleanup_buffer *curp = THREAD_GETMEM (self, cleanup);
-
-  if (curp != oldp)
-    {
-      do
-       {
-         /* Pointer to the next element.  */
-         struct _pthread_cleanup_buffer *nextp = curp->__prev;
-
-         /* Call the handler.  */
-         curp->__routine (curp->__arg);
-
-         /* To the next.  */
-         curp = nextp;
-       }
-      while (curp != oldp);
-
-      /* Mark the current element as handled.  */
-      THREAD_SETMEM (self, cleanup, curp);
-    }
-
-  /* We simply jump to the registered setjmp buffer.  */
-  __libc_unwind_longjmp ((struct __jmp_buf_tag *) ibuf->cancel_jmp_buf, 1);
-#endif
   /* NOTREACHED */
 
   /* We better do not get here.  */