Parcourir la source

Only use __builtin_expect with GCC. Thanks to Jonathan Adamczewski for
reporting this issue!

Cédric Augonnet il y a 14 ans
Parent
commit
7a076ccf58
1 fichiers modifiés avec 4 ajouts et 2 suppressions
  1. 4 2
      include/starpu_util.h

+ 4 - 2
include/starpu_util.h

@@ -46,12 +46,14 @@ extern "C" {
 
 #define STARPU_ABORT()		abort()
 
-#define STARPU_UNLIKELY(expr)          (__builtin_expect(!!(expr),0))
-#define STARPU_LIKELY(expr)            (__builtin_expect(!!(expr),1))
 
 #ifdef __GNUC__
+#  define STARPU_UNLIKELY(expr)          (__builtin_expect(!!(expr),0))
+#  define STARPU_LIKELY(expr)            (__builtin_expect(!!(expr),1))
 #  define STARPU_ATTRIBUTE_UNUSED                  __attribute__((unused))
 #else
+#  define STARPU_UNLIKELY(expr)          (expr)
+#  define STARPU_LIKELY(expr)            (expr)
 #  define STARPU_ATTRIBUTE_UNUSED                  
 #endif