clang supports __builtin_expect, even on Windows. Most Gnulib modules use the 'builtin-expect' module with its Autoconf test, however, some use the macros from lib/cdefs.h.
2020-08-06 Bruno Haible <br...@clisp.org> Use __builtin_expect with clang everywhere. * lib/cdefs.h (__glibc_unlikely, __glibc_likely): Use the GCC built-in also on clang. diff --git a/lib/cdefs.h b/lib/cdefs.h index 2158379..b034c0b 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