From: José Fonseca Date: Fri, 25 Mar 2011 11:37:24 +0000 (+0000) Subject: gallium: Avoid redefinition of likely/unlikely macros on non gcc compilers. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5858abec6efd01d6d190d9116ff803c096bc279b;p=mesa.git gallium: Avoid redefinition of likely/unlikely macros on non gcc compilers. --- diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h index 3441db685ce..8c788f4bb0e 100644 --- a/src/gallium/include/pipe/p_compiler.h +++ b/src/gallium/include/pipe/p_compiler.h @@ -292,12 +292,14 @@ void _ReadWriteBarrier(void); * Note that profile guided optimization can offer better results, but * needs an appropriate coverage suite and does not inform human readers. */ -#ifdef __GNUC__ -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) -#else -#define likely(x) !!(x) -#define unlikely(x) !!(x) +#ifndef likely +# if defined(__GNUC__) +# define likely(x) __builtin_expect(!!(x), 1) +# define unlikely(x) __builtin_expect(!!(x), 0) +# else +# define likely(x) (x) +# define unlikely(x) (x) +# endif #endif