bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: improve clang support (3)


From: Bruno Haible
Subject: Re: improve clang support (3)
Date: Sun, 16 Aug 2020 18:37:43 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-186-generic; KDE/5.18.0; x86_64; ; )

> clang supports __builtin_expect, even on Windows.

Another use of __builtin_expect is here:


2020-08-16  Bruno Haible  <bruno@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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]