> clang supports __builtin_expect, even on Windows. Another use of __builtin_expect is here:
2020-08-16 Bruno Haible <br...@clisp.org> avltreehash-list, rbtreehash-list: Optimize also on clang. * lib/gl_anytreehash_list1.h (add_nodes_to_buckets): Use __builtin_expect also on clang. diff --git a/lib/gl_anytreehash_list1.h b/lib/gl_anytreehash_list1.h index aba45d6..88fac00 100644 --- a/lib/gl_anytreehash_list1.h +++ b/lib/gl_anytreehash_list1.h @@ -340,7 +340,7 @@ add_nodes_to_buckets (gl_list_t list) return -1; } /* Tell GCC that the likely return value is 0. */ -#if __GNUC__ >= 3 +#if (__GNUC__ >= 3) || (__clang_major__ >= 4) # define add_nodes_to_buckets(list) \ __builtin_expect ((add_nodes_to_buckets) (list), 0) #endif