about summary refs log tree commit diff
path: root/nptl/sysdeps/unix
diff options
context:
space:
mode:
authorOndřej Bílka <neleai@seznam.cz>2014-02-10 14:45:42 +0100
committerOndřej Bílka <neleai@seznam.cz>2014-02-10 15:07:12 +0100
commita1ffb40e32741f992c743e7b16c061fefa3747ac (patch)
tree246a29a87b26cfd5d07b17070f85eb3785018de9 /nptl/sysdeps/unix
parent1448f3244714a9dabb5240ec18b094f100887d5c (diff)
downloadglibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.tar.gz
glibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.tar.xz
glibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.zip
Use glibc_likely instead __builtin_expect.
Diffstat (limited to 'nptl/sysdeps/unix')
-rw-r--r--nptl/sysdeps/unix/sysv/linux/getpid.c6
-rw-r--r--nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.c6
-rw-r--r--nptl/sysdeps/unix/sysv/linux/mq_notify.c4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/pt-raise.c2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/pthread_kill.c2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/pthread_setaffinity.c2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/pthread_sigqueue.c2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/raise.c2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h10
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h10
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/pthread_barrier_destroy.c2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/pthread_barrier_init.c2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/sem_init.c4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/timer_create.c2
15 files changed, 30 insertions, 30 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/getpid.c b/nptl/sysdeps/unix/sysv/linux/getpid.c
index f806f2ff87..937b1d4e11 100644
--- a/nptl/sysdeps/unix/sysv/linux/getpid.c
+++ b/nptl/sysdeps/unix/sysv/linux/getpid.c
@@ -27,10 +27,10 @@ static inline __attribute__((always_inline)) pid_t really_getpid (pid_t oldval);
 static inline __attribute__((always_inline)) pid_t
 really_getpid (pid_t oldval)
 {
-  if (__builtin_expect (oldval == 0, 1))
+  if (__glibc_likely (oldval == 0))
     {
       pid_t selftid = THREAD_GETMEM (THREAD_SELF, tid);
-      if (__builtin_expect (selftid != 0, 1))
+      if (__glibc_likely (selftid != 0))
 	return selftid;
     }
 
@@ -53,7 +53,7 @@ __getpid (void)
   pid_t result = INTERNAL_SYSCALL (getpid, err, 0);
 #else
   pid_t result = THREAD_GETMEM (THREAD_SELF, pid);
-  if (__builtin_expect (result <= 0, 0))
+  if (__glibc_unlikely (result <= 0))
     result = really_getpid (result);
 #endif
   return result;
diff --git a/nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.c b/nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.c
index 5c9ada18a0..c894b1ecda 100644
--- a/nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.c
+++ b/nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.c
@@ -35,7 +35,7 @@ __lll_robust_lock_wait (int *futex, int private)
 
   do
     {
-      if (__builtin_expect (oldval & FUTEX_OWNER_DIED, 0))
+      if (__glibc_unlikely (oldval & FUTEX_OWNER_DIED))
 	return oldval;
 
       int newval = oldval | FUTEX_WAITERS;
@@ -72,7 +72,7 @@ __lll_robust_timedlock_wait (int *futex, const struct timespec *abstime,
 
   /* Work around the fact that the kernel rejects negative timeout values
      despite them being valid.  */
-  if (__builtin_expect (abstime->tv_sec < 0, 0))
+  if (__glibc_unlikely (abstime->tv_sec < 0))
     return ETIMEDOUT;
 
   do
@@ -100,7 +100,7 @@ __lll_robust_timedlock_wait (int *futex, const struct timespec *abstime,
 #endif
 
       /* Wait.  */
-      if (__builtin_expect (oldval & FUTEX_OWNER_DIED, 0))
+      if (__glibc_unlikely (oldval & FUTEX_OWNER_DIED))
 	return oldval;
 
       int newval = oldval | FUTEX_WAITERS;
diff --git a/nptl/sysdeps/unix/sysv/linux/mq_notify.c b/nptl/sysdeps/unix/sysv/linux/mq_notify.c
index 0d20919667..3138ad2c3c 100644
--- a/nptl/sysdeps/unix/sysv/linux/mq_notify.c
+++ b/nptl/sysdeps/unix/sysv/linux/mq_notify.c
@@ -266,7 +266,7 @@ mq_notify (mqd_t mqdes, const struct sigevent *notification)
 
   /* If we cannot create the netlink socket we cannot provide
      SIGEV_THREAD support.  */
-  if (__builtin_expect (netlink_socket == -1, 0))
+  if (__glibc_unlikely (netlink_socket == -1))
     {
       __set_errno (ENOSYS);
       return -1;
@@ -299,7 +299,7 @@ mq_notify (mqd_t mqdes, const struct sigevent *notification)
   int retval = INLINE_SYSCALL (mq_notify, 2, mqdes, &se);
 
   /* If it failed, free the allocated memory.  */
-  if (__builtin_expect (retval != 0, 0))
+  if (__glibc_unlikely (retval != 0))
     free (data.attr);
 
   return retval;
diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
index fe856708a4..ab92c3fc8f 100644
--- a/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
@@ -306,7 +306,7 @@ extern int __lll_robust_timedlock_wait
   ((void) ({								      \
     int *__futex = &(lock);						      \
     int __val = atomic_exchange_rel (__futex, 0);			      \
-    if (__builtin_expect (__val > 1, 0))				      \
+    if (__glibc_unlikely (__val > 1))					      \
       lll_futex_wake (__futex, 1, private);				      \
   }))
 
@@ -314,7 +314,7 @@ extern int __lll_robust_timedlock_wait
   ((void) ({								      \
     int *__futex = &(lock);						      \
     int __val = atomic_exchange_rel (__futex, 0);			      \
-    if (__builtin_expect (__val & FUTEX_WAITERS, 0))			      \
+    if (__glibc_unlikely (__val & FUTEX_WAITERS))			      \
       lll_futex_wake (__futex, 1, private);				      \
   }))
 
diff --git a/nptl/sysdeps/unix/sysv/linux/pt-raise.c b/nptl/sysdeps/unix/sysv/linux/pt-raise.c
index 68059db8db..74762b749b 100644
--- a/nptl/sysdeps/unix/sysv/linux/pt-raise.c
+++ b/nptl/sysdeps/unix/sysv/linux/pt-raise.c
@@ -31,7 +31,7 @@ raise (sig)
      fork function temporarily invalidated the PID field.  Adjust for
      that.  */
   pid_t pid = THREAD_GETMEM (THREAD_SELF, pid);
-  if (__builtin_expect (pid < 0, 0))
+  if (__glibc_unlikely (pid < 0))
     pid = -pid;
 
   return INLINE_SYSCALL (tgkill, 3, pid, THREAD_GETMEM (THREAD_SELF, tid),
diff --git a/nptl/sysdeps/unix/sysv/linux/pthread_kill.c b/nptl/sysdeps/unix/sysv/linux/pthread_kill.c
index 43e5c02b37..f8957ae17c 100644
--- a/nptl/sysdeps/unix/sysv/linux/pthread_kill.c
+++ b/nptl/sysdeps/unix/sysv/linux/pthread_kill.c
@@ -40,7 +40,7 @@ __pthread_kill (threadid, signo)
      if a thread exits between ESRCH test and tgkill, we might return
      EINVAL, because pd->tid would be cleared by the kernel.  */
   pid_t tid = atomic_forced_read (pd->tid);
-  if (__builtin_expect (tid <= 0, 0))
+  if (__glibc_unlikely (tid <= 0))
     /* Not a valid thread handle.  */
     return ESRCH;
 
diff --git a/nptl/sysdeps/unix/sysv/linux/pthread_setaffinity.c b/nptl/sysdeps/unix/sysv/linux/pthread_setaffinity.c
index 288d73f8c8..874cf4b578 100644
--- a/nptl/sysdeps/unix/sysv/linux/pthread_setaffinity.c
+++ b/nptl/sysdeps/unix/sysv/linux/pthread_setaffinity.c
@@ -61,7 +61,7 @@ __pthread_setaffinity_new (pthread_t th, size_t cpusetsize,
   INTERNAL_SYSCALL_DECL (err);
   int res;
 
-  if (__builtin_expect (__kernel_cpumask_size == 0, 0))
+  if (__glibc_unlikely (__kernel_cpumask_size == 0))
     {
       res = __determine_cpumask_size (pd->tid);
       if (res != 0)
diff --git a/nptl/sysdeps/unix/sysv/linux/pthread_sigqueue.c b/nptl/sysdeps/unix/sysv/linux/pthread_sigqueue.c
index 9c3e73cdea..8dee3a69d2 100644
--- a/nptl/sysdeps/unix/sysv/linux/pthread_sigqueue.c
+++ b/nptl/sysdeps/unix/sysv/linux/pthread_sigqueue.c
@@ -44,7 +44,7 @@ pthread_sigqueue (threadid, signo, value)
      if a thread exits between ESRCH test and tgkill, we might return
      EINVAL, because pd->tid would be cleared by the kernel.  */
   pid_t tid = atomic_forced_read (pd->tid);
-  if (__builtin_expect (tid <= 0, 0))
+  if (__glibc_unlikely (tid <= 0))
     /* Not a valid thread handle.  */
     return ESRCH;
 
diff --git a/nptl/sysdeps/unix/sysv/linux/raise.c b/nptl/sysdeps/unix/sysv/linux/raise.c
index 321d9c3543..67c9b1f23e 100644
--- a/nptl/sysdeps/unix/sysv/linux/raise.c
+++ b/nptl/sysdeps/unix/sysv/linux/raise.c
@@ -50,7 +50,7 @@ raise (sig)
     /* raise is an async-safe function.  It could be called while the
        fork/vfork function temporarily invalidated the PID field.  Adjust for
        that.  */
-    if (__builtin_expect (pid <= 0, 0))
+    if (__glibc_unlikely (pid <= 0))
       pid = (pid & INT_MAX) == 0 ? selftid : -pid;
 
   return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
diff --git a/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h
index 80dc90543b..864dcbccc0 100644
--- a/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h
@@ -233,7 +233,7 @@ static inline void
 __attribute__ ((always_inline))
 __lll_lock (int *futex, int private)
 {
-  if (__builtin_expect (atomic_compare_and_exchange_bool_acq (futex, 1, 0), 0))
+  if (__glibc_unlikely (atomic_compare_and_exchange_bool_acq (futex, 1, 0)))
     {
       if (__builtin_constant_p (private) && private == LLL_PRIVATE)
 	__lll_lock_wait_private (futex);
@@ -260,7 +260,7 @@ static inline void
 __attribute__ ((always_inline))
 __lll_cond_lock (int *futex, int private)
 {
-  if (__builtin_expect (atomic_compare_and_exchange_bool_acq (futex, 2, 0), 0))
+  if (__glibc_unlikely (atomic_compare_and_exchange_bool_acq (futex, 2, 0)))
     __lll_lock_wait (futex, private);
 }
 #define lll_cond_lock(futex, private) __lll_cond_lock (&(futex), private)
@@ -278,7 +278,7 @@ __attribute__ ((always_inline))
 __lll_timedlock (int *futex, const struct timespec *abstime, int private)
 {
   int result = 0;
-  if (__builtin_expect (atomic_compare_and_exchange_bool_acq (futex, 1, 0), 0))
+  if (__glibc_unlikely (atomic_compare_and_exchange_bool_acq (futex, 1, 0)))
     result = __lll_timedlock_wait (futex, abstime, private);
   return result;
 }
@@ -307,7 +307,7 @@ __lll_robust_timedlock (int *futex, const struct timespec *abstime,
        int *__futexp = (futex);						      \
 									      \
        lll_compare_and_swap (__futexp, __oldval, __newval, "slr %2,%2");      \
-       if (__builtin_expect (__oldval > 1, 0))				      \
+       if (__glibc_unlikely (__oldval > 1))				      \
 	 lll_futex_wake (__futexp, 1, private);				      \
     })
 #define lll_unlock(futex, private) __lll_unlock(&(futex), private)
@@ -320,7 +320,7 @@ __lll_robust_timedlock (int *futex, const struct timespec *abstime,
        int *__futexp = (futex);						      \
 									      \
        lll_compare_and_swap (__futexp, __oldval, __newval, "slr %2,%2");      \
-       if (__builtin_expect (__oldval & FUTEX_WAITERS, 0))		      \
+       if (__glibc_unlikely (__oldval & FUTEX_WAITERS))			      \
 	 lll_futex_wake (__futexp, 1, private);				      \
     })
 #define lll_robust_unlock(futex, private) \
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h
index d851d74542..d4ed7a9bd7 100644
--- a/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h
@@ -223,7 +223,7 @@ __lll_lock (int *futex, int private)
 {
   int val = atomic_compare_and_exchange_val_24_acq (futex, 1, 0);
 
-  if (__builtin_expect (val != 0, 0))
+  if (__glibc_unlikely (val != 0))
     {
       if (__builtin_constant_p (private) && private == LLL_PRIVATE)
 	__lll_lock_wait_private (futex);
@@ -251,7 +251,7 @@ __lll_cond_lock (int *futex, int private)
 {
   int val = atomic_compare_and_exchange_val_24_acq (futex, 2, 0);
 
-  if (__builtin_expect (val != 0, 0))
+  if (__glibc_unlikely (val != 0))
     __lll_lock_wait (futex, private);
 }
 #define lll_cond_lock(futex, private) __lll_cond_lock (&(futex), private)
@@ -272,7 +272,7 @@ __lll_timedlock (int *futex, const struct timespec *abstime, int private)
   int val = atomic_compare_and_exchange_val_24_acq (futex, 1, 0);
   int result = 0;
 
-  if (__builtin_expect (val != 0, 0))
+  if (__glibc_unlikely (val != 0))
     result = __lll_timedlock_wait (futex, abstime, private);
   return result;
 }
@@ -296,7 +296,7 @@ __lll_robust_timedlock (int *futex, const struct timespec *abstime,
   ((void) ({								      \
     int *__futex = &(lock);						      \
     int __val = atomic_exchange_24_rel (__futex, 0);			      \
-    if (__builtin_expect (__val > 1, 0))				      \
+    if (__glibc_unlikely (__val > 1))					      \
       lll_futex_wake (__futex, 1, private);				      \
   }))
 
@@ -304,7 +304,7 @@ __lll_robust_timedlock (int *futex, const struct timespec *abstime,
   ((void) ({								      \
     int *__futex = &(lock);						      \
     int __val = atomic_exchange_rel (__futex, 0);			      \
-    if (__builtin_expect (__val & FUTEX_WAITERS, 0))			      \
+    if (__glibc_unlikely (__val & FUTEX_WAITERS))			      \
       lll_futex_wake (__futex, 1, private);				      \
   }))
 
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/pthread_barrier_destroy.c b/nptl/sysdeps/unix/sysv/linux/sparc/pthread_barrier_destroy.c
index 4ce7871fbd..2221a27e22 100644
--- a/nptl/sysdeps/unix/sysv/linux/sparc/pthread_barrier_destroy.c
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/pthread_barrier_destroy.c
@@ -33,7 +33,7 @@ pthread_barrier_destroy (barrier)
 
   lll_lock (ibarrier->b.lock, private);
 
-  if (__builtin_expect (ibarrier->b.left == ibarrier->b.init_count, 1))
+  if (__glibc_likely (ibarrier->b.left == ibarrier->b.init_count))
     /* The barrier is not used anymore.  */
     result = 0;
   else
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/pthread_barrier_init.c b/nptl/sysdeps/unix/sysv/linux/sparc/pthread_barrier_init.c
index 9bc7a05333..6af686361d 100644
--- a/nptl/sysdeps/unix/sysv/linux/sparc/pthread_barrier_init.c
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/pthread_barrier_init.c
@@ -28,7 +28,7 @@ pthread_barrier_init (barrier, attr, count)
 {
   union sparc_pthread_barrier *ibarrier;
 
-  if (__builtin_expect (count == 0, 0))
+  if (__glibc_unlikely (count == 0))
     return EINVAL;
 
   struct pthread_barrierattr *iattr = (struct pthread_barrierattr *) attr;
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sem_init.c b/nptl/sysdeps/unix/sysv/linux/sparc/sem_init.c
index d415366f4c..cbefdc4823 100644
--- a/nptl/sysdeps/unix/sysv/linux/sparc/sem_init.c
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/sem_init.c
@@ -32,7 +32,7 @@ __new_sem_init (sem, pshared, value)
      unsigned int value;
 {
   /* Parameter sanity check.  */
-  if (__builtin_expect (value > SEM_VALUE_MAX, 0))
+  if (__glibc_unlikely (value > SEM_VALUE_MAX))
     {
       __set_errno (EINVAL);
       return -1;
@@ -66,7 +66,7 @@ __old_sem_init (sem, pshared, value)
      unsigned int value;
 {
   /* Parameter sanity check.  */
-  if (__builtin_expect (value > SEM_VALUE_MAX, 0))
+  if (__glibc_unlikely (value > SEM_VALUE_MAX))
     {
       __set_errno (EINVAL);
       return -1;
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/timer_create.c b/nptl/sysdeps/unix/sysv/linux/x86_64/timer_create.c
index e46eef426c..7624f2cdb2 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/timer_create.c
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/timer_create.c
@@ -50,7 +50,7 @@ __timer_create_old (clockid_t clock_id, struct sigevent *evp, int *timerid)
 	    break;
 	  }
 
-      if (__builtin_expect (i == OLD_TIMER_MAX, 0))
+      if (__glibc_unlikely (i == OLD_TIMER_MAX))
 	{
 	  /* No free slot.  */
 	  (void) __timer_delete_new (newp);