From: Bruno Haible Date: Thu, 6 Aug 2020 18:34:29 +0000 (+0200) Subject: Use __builtin_expect with clang everywhere. X-Git-Tag: v1.0~3816 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=49d09f516890fb21df7bead33ffbf8a7dfe6ddff;p=gnulib.git Use __builtin_expect with clang everywhere. * lib/cdefs.h (__glibc_unlikely, __glibc_likely): Use the GCC built-in also on clang. --- diff --git a/ChangeLog b/ChangeLog index bd05d1f7c0..b988961038 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2020-08-06 Bruno Haible + + 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 Use __builtin_ctz{,l,ll} and __builtin_ffs{,l,ll} with clang everywhere. diff --git a/lib/cdefs.h b/lib/cdefs.h index 2158379554..b034c0bdfd 100644 --- a/lib/cdefs.h +++ b/lib/cdefs.h @@ -401,7 +401,7 @@ # 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