]> Savannah Git Hosting - gnulib.git/commitdiff
Use __builtin_expect with clang everywhere.
authorBruno Haible <bruno@clisp.org>
Thu, 6 Aug 2020 18:34:29 +0000 (20:34 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 6 Aug 2020 18:34:29 +0000 (20:34 +0200)
* lib/cdefs.h (__glibc_unlikely, __glibc_likely): Use the GCC built-in
also on clang.

ChangeLog
lib/cdefs.h

index bd05d1f7c044c6f4c432bf1f2eec7564ee97d44c..b988961038f1255cd5c3418699d57948ea215f9c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-08-06  Bruno Haible  <bruno@clisp.org>
+
+       Use __builtin_expect with clang everywhere.
+       * lib/cdefs.h (__glibc_unlikely, __glibc_likely): Use the GCC built-in
+       also on clang.
+
 2020-08-05  Bruno Haible  <bruno@clisp.org>
 
        Use __builtin_ctz{,l,ll} and __builtin_ffs{,l,ll} with clang everywhere.
index 21583795548c131e06fe35b0dfb60d3344bf05a0..b034c0bdfd0d70d338df75d53be25bba68b00be8 100644 (file)
 # endif
 #endif
 
-#if __GNUC__ >= 3
+#if (__GNUC__ >= 3) || (__clang_major__ >= 4)
 # define __glibc_unlikely(cond)        __builtin_expect ((cond), 0)
 # define __glibc_likely(cond)  __builtin_expect ((cond), 1)
 #else