summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2011-03-25 15:59:03 +0000
committerJosé Fonseca <[email protected]>2011-03-25 16:22:32 +0000
commita81828cb962e747644dd5b479179cd4f55932c1e (patch)
tree0fde13a802e669d84e65196578e8be5310881188 /src
parent7fbe020bbcfeefbb2b6d6d8d0e23bca99bc06bf1 (diff)
mesa: Avoid redefining PUBLIC/USE/likely/unlikely macros.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/compiler.h30
1 files changed, 17 insertions, 13 deletions
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
/**