From 3ff2c1d9b8d6492de3f4624f42617464efefd7b1 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sun, 6 Jul 2008 15:18:50 +0200 Subject: [PATCH] [BUILD] silent a warning in unlikely() with gcc 4.x 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 | 2 +- include/common/standard.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/common/ebtree.h b/include/common/ebtree.h index 1a5ce8650..38cd0b533 100644 --- a/include/common/ebtree.h +++ b/include/common/ebtree.h @@ -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 diff --git a/include/common/standard.h b/include/common/standard.h index a120f56bd..2a2c8f66c 100644 --- a/include/common/standard.h +++ b/include/common/standard.h @@ -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