]> sourceware.org Git - glibc.git/commitdiff
Wrap __builtin_expect in pthread.h
authorSiddhesh Poyarekar <siddhesh@redhat.com>
Mon, 4 Jun 2012 06:11:24 +0000 (11:41 +0530)
committerSiddhesh Poyarekar <siddhesh@redhat.com>
Mon, 4 Jun 2012 06:23:57 +0000 (11:53 +0530)
[BZ #14188]
This fixes compilation of programs using pthread_cleanup_push built
with non-gcc compilers and older gcc compilers.

ChangeLog
misc/sys/cdefs.h
nptl/ChangeLog
nptl/sysdeps/pthread/pthread.h

index e207e4e9e5d7331834d0d39c77209623bbfe8a53..365ff82978c556b052d1fb23fb2a472caf45c633 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-06-04  Siddhesh Poyarekar  <siddhesh@redhat.com>
+           Jakub Jelinek  <jakub@redhat.com>
+
+       [BZ #14188]
+       * misc/sys/cdefs.h (__glibc_unlikely): New macro to wrap cases
+       where __builtin_expect is unavailable.
+
 2012-06-03  David S. Miller  <davem@davemloft.net>
 
        * stdlib/longlong.h: Updated from GCC.
index f4e96dbe6a65ffcc2e0516df164cbd2c8fbdf9cd..b94147efe8c5bbba718cb2f9d5911a92414864b6 100644 (file)
 # endif
 #endif
 
+#if __GNUC__ >= 3
+# define __glibc_unlikely(cond) __builtin_expect((cond), 0)
+#else
+# define __glibc_unlikely(cond) (cond)
+#endif
+
 #include <bits/wordsize.h>
 
 #if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
index f96646784e0e766d61485b1661208bbf416f884e..2bc35857f1aec19b73e6d3880d5df80320748fb8 100644 (file)
@@ -1,3 +1,12 @@
+2012-06-04  Siddhesh Poyarekar  <siddhesh@redhat.com>
+           Jakub Jelinek  <jakub@redhat.com>
+
+       [BZ #14188]
+       * sysdeps/pthread/pthread.h
+       [!(defined __GNUC__ && defined __EXCEPTIONS)]
+       (pthread_cleanup_push, pthread_cleanup_push_defer_np): Use
+       __libc_unlikely instead of __builtin_expect.
+
 2012-05-30  H.J. Lu  <hongjiu.lu@intel.com>
 
        [BZ #14117]
index 88c7c257aefbb56871acc2410e91fa143e01b781..246c1a0cd58afb45d9ac7d810351613d8fd3fb49 100644 (file)
@@ -659,7 +659,7 @@ __pthread_cleanup_routine (struct __pthread_cleanup_frame *__frame)
     void *__cancel_arg = (arg);                                                      \
     int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *)     \
                                        __cancel_buf.__cancel_jmp_buf, 0);    \
-    if (__builtin_expect (__not_first_call, 0))                                      \
+    if (__glibc_unlikely (__not_first_call))                                 \
       {                                                                              \
        __cancel_routine (__cancel_arg);                                      \
        __pthread_unwind_next (&__cancel_buf);                                \
@@ -694,7 +694,7 @@ extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf)
     void *__cancel_arg = (arg);                                                      \
     int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *)     \
                                        __cancel_buf.__cancel_jmp_buf, 0);    \
-    if (__builtin_expect (__not_first_call, 0))                                      \
+    if (__glibc_unlikely (__not_first_call))                         \
       {                                                                              \
        __cancel_routine (__cancel_arg);                                      \
        __pthread_unwind_next (&__cancel_buf);                                \
This page took 0.12493 seconds and 5 git commands to generate.