]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUILD] silent a warning in unlikely() with gcc 4.x
authorWilly Tarreau <w@1wt.eu>
Sun, 6 Jul 2008 13:18:50 +0000 (15:18 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 2 Sep 2008 08:49:43 +0000 (10:49 +0200)
The unlikely() implementation for gcc 4.x spits out a warning
when a pointer is passed. Add a cast to unsigned long.
(cherry picked from commit 75875a7c8c7348e90e373c007bafdedcc6253ab4)

include/common/ebtree.h
include/common/standard.h

index 1a5ce86501ca18fc3398fefa29dc120f343f3200..38cd0b533a0734e9923dfcfc0c5c792c00595571 100644 (file)
@@ -322,7 +322,7 @@ static inline int fls64(unsigned long long x)
  * only work with ints and booleans though.
  */
 #define likely(x) (x)
-#define unlikely(x) (__builtin_expect((x), 0))
+#define unlikely(x) (__builtin_expect((unsigned long)(x), 0))
 #endif
 #endif
 
index a120f56bd46db38c020cf3d32cf4296fd1bb91ec..2a2c8f66c301254772ded0fe438ee818675af964 100644 (file)
@@ -61,7 +61,7 @@
  * only work with ints and booleans though.
  */
 #define likely(x) (x)
-#define unlikely(x) (__builtin_expect((x), 0))
+#define unlikely(x) (__builtin_expect((unsigned long)(x), 0))
 #endif
 #endif