summaryrefslogtreecommitdiff
path: root/src/lib/eina/eina_types.h
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-10-05 16:27:46 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-10-05 19:40:50 +0900
commit119e35b79127c7688d8782635fbe1a9642a851bc (patch)
tree0cdccdfb7198570d18350a50b27bc8856753fc58 /src/lib/eina/eina_types.h
parent17ac58a081a05f6e96b248f80c007e67d1f4ff44 (diff)
eina: Fix compilation with clang
It's not because the bug with __builtin_prefetch is inside clang/llvm that we must break the build for people who prefer it over gcc. As soon as a non-broken version is out, the ifdef must be either removed (and ask people to update their clang install) or add a version check based on __clang_xxx__. Compilation tested with clang 3.8.1 and gcc 6.2.1.
Diffstat (limited to 'src/lib/eina/eina_types.h')
-rw-r--r--src/lib/eina/eina_types.h40
1 files changed, 24 insertions, 16 deletions
diff --git a/src/lib/eina/eina_types.h b/src/lib/eina/eina_types.h
index 139dafaf54..fc01c69de8 100644
--- a/src/lib/eina/eina_types.h
+++ b/src/lib/eina/eina_types.h
@@ -193,10 +193,18 @@
193# define EINA_UNLIKELY(exp) __builtin_expect((exp), 0) 193# define EINA_UNLIKELY(exp) __builtin_expect((exp), 0)
194# define EINA_LIKELY(exp) __builtin_expect((exp), 1) 194# define EINA_LIKELY(exp) __builtin_expect((exp), 1)
195# define EINA_SENTINEL __attribute__((__sentinel__)) 195# define EINA_SENTINEL __attribute__((__sentinel__))
196# define EINA_PREFETCH(arg) __builtin_prefetch(arg) 196# ifndef __clang__
197# define EINA_PREFETCH_WRITE(arg) __builtin_prefetch(arg, 1) 197# define EINA_PREFETCH(arg) __builtin_prefetch(arg)
198# define EINA_PREFETCH_NOCACHE(arg) __builtin_prefetch(arg, 0, 0) 198# define EINA_PREFETCH_WRITE(arg) __builtin_prefetch(arg, 1)
199# define EINA_PREFETCH_NOCACHE_WRITE(arg) __builtin_prefetch(arg, 1, 0) 199# define EINA_PREFETCH_NOCACHE(arg) __builtin_prefetch(arg, 0, 0)
200# define EINA_PREFETCH_NOCACHE_WRITE(arg) __builtin_prefetch(arg, 1, 0)
201# else
202/* LLVM Clang workaround (crash on compilation) */
203# define EINA_PREFETCH(arg) ((void) (arg))
204# define EINA_PREFETCH_WRITE(arg) ((void) (arg))
205# define EINA_PREFETCH_NOCACHE(arg) ((void) (arg))
206# define EINA_PREFETCH_NOCACHE_WRITE(arg) ((void) (arg))
207# endif
200# else 208# else
201# define EINA_PRINTF(fmt, arg) 209# define EINA_PRINTF(fmt, arg)
202# define EINA_SCANF(fmt, arg) 210# define EINA_SCANF(fmt, arg)
@@ -206,10 +214,10 @@
206# define EINA_UNLIKELY(exp) exp 214# define EINA_UNLIKELY(exp) exp
207# define EINA_LIKELY(exp) exp 215# define EINA_LIKELY(exp) exp
208# define EINA_SENTINEL 216# define EINA_SENTINEL
209# define EINA_PREFETCH(arg) 217# define EINA_PREFETCH(arg) ((void) (arg))
210# define EINA_PREFETCH_WRITE(arg) 218# define EINA_PREFETCH_WRITE(arg) ((void) (arg))
211# define EINA_PREFETCH_NOCACHE(arg) 219# define EINA_PREFETCH_NOCACHE(arg) ((void) (arg))
212# define EINA_PREFETCH_NOCACHE_WRITE(arg) 220# define EINA_PREFETCH_NOCACHE_WRITE(arg) ((void) (arg))
213# endif 221# endif
214 222
215#elif defined(_MSC_VER) 223#elif defined(_MSC_VER)
@@ -231,10 +239,10 @@
231# define EINA_UNLIKELY(exp) exp 239# define EINA_UNLIKELY(exp) exp
232# define EINA_LIKELY(exp) exp 240# define EINA_LIKELY(exp) exp
233# define EINA_SENTINEL 241# define EINA_SENTINEL
234# define EINA_PREFETCH(arg) 242# define EINA_PREFETCH(arg) ((void) (arg))
235# define EINA_PREFETCH_WRITE(arg) 243# define EINA_PREFETCH_WRITE(arg) ((void) (arg))
236# define EINA_PREFETCH_NOCACHE(arg) 244# define EINA_PREFETCH_NOCACHE(arg) ((void) (arg))
237# define EINA_PREFETCH_NOCACHE_WRITE(arg) 245# define EINA_PREFETCH_NOCACHE_WRITE(arg) ((void) (arg))
238 246
239#elif defined(__SUNPRO_C) 247#elif defined(__SUNPRO_C)
240# define EINA_UNUSED 248# define EINA_UNUSED
@@ -260,10 +268,10 @@
260# define EINA_UNLIKELY(exp) exp 268# define EINA_UNLIKELY(exp) exp
261# define EINA_LIKELY(exp) exp 269# define EINA_LIKELY(exp) exp
262# define EINA_SENTINEL 270# define EINA_SENTINEL
263# define EINA_PREFETCH(arg) 271# define EINA_PREFETCH(arg) ((void) (arg))
264# define EINA_PREFETCH_WRITE(arg) 272# define EINA_PREFETCH_WRITE(arg) ((void) (arg))
265# define EINA_PREFETCH_NOCACHE(arg) 273# define EINA_PREFETCH_NOCACHE(arg) ((void) (arg))
266# define EINA_PREFETCH_NOCACHE_WRITE(arg) 274# define EINA_PREFETCH_NOCACHE_WRITE(arg) ((void) (arg))
267 275
268#else /* ! __GNUC__ && ! _MSC_VER && ! __SUNPRO_C */ 276#else /* ! __GNUC__ && ! _MSC_VER && ! __SUNPRO_C */
269 277