Mesa (master): gallium: Avoid redefinition of likely/ unlikely macros on non gcc compilers.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Fri Mar 25 16:23:06 UTC 2011


Module: Mesa
Branch: master
Commit: 5858abec6efd01d6d190d9116ff803c096bc279b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5858abec6efd01d6d190d9116ff803c096bc279b

Author: José Fonseca <jfonseca at vmware.com>
Date:   Fri Mar 25 11:37:24 2011 +0000

gallium: Avoid redefinition of likely/unlikely macros on non gcc compilers.

---

 src/gallium/include/pipe/p_compiler.h |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h
index 3441db6..8c788f4 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
 
 




More information about the mesa-commit mailing list