From: José Fonseca Date: Fri, 25 Mar 2011 15:59:03 +0000 (+0000) Subject: mesa: Avoid redefining PUBLIC/USE/likely/unlikely macros. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a81828cb962e747644dd5b479179cd4f55932c1e;p=mesa.git mesa: Avoid redefining PUBLIC/USE/likely/unlikely macros. --- diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h index 5557a3b5cb5..e17fd0ff6fd 100644 --- a/src/mesa/main/compiler.h +++ b/src/mesa/main/compiler.h @@ -171,12 +171,14 @@ extern "C" { * We also need to define a USED attribute, so the optimizer doesn't * inline a static function that we later use in an alias. - ajax */ -#if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) -# define PUBLIC __attribute__((visibility("default"))) -# define USED __attribute__((used)) -#else -# define PUBLIC -# define USED +#ifndef PUBLIC +# if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) +# define PUBLIC __attribute__((visibility("default"))) +# define USED __attribute__((used)) +# else +# define PUBLIC +# define USED +# endif #endif @@ -195,15 +197,17 @@ extern "C" { * __builtin_expect macros */ #if !defined(__GNUC__) -# define __builtin_expect(x, y) x +# define __builtin_expect(x, y) (x) #endif -#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 +# 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) +# endif #endif /**