]> 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>
Sun, 6 Jul 2008 13:18:50 +0000 (15:18 +0200)
The unlikely() implementation for gcc 4.x spits out a warning
when a pointer is passed. Add a cast to unsigned long.

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

index 5ef965be7973ad0c4b6d272a89fbff7e3dcdadf7..b737bc915fcd51f2020f9900a27a5a3c6968604e 100644 (file)
@@ -329,7 +329,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 dae7bd54f71ece71e9cd29ef95eb182971433ec7..892f516e52a23f4f597714ee0b1506b7db1ddf83 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