… | |
… | |
98 | #define ECB_GCC_VERSION(major,minor) (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))) |
98 | #define ECB_GCC_VERSION(major,minor) (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))) |
99 | #endif |
99 | #endif |
100 | |
100 | |
101 | #define ECB_CLANG_VERSION(major,minor) (__clang_major__ > (major) || (__clang_major__ == (major) && __clang_minor__ >= (minor))) |
101 | #define ECB_CLANG_VERSION(major,minor) (__clang_major__ > (major) || (__clang_major__ == (major) && __clang_minor__ >= (minor))) |
102 | |
102 | |
103 | #if __clang__ && defined(__has_builtin) |
103 | #if __clang__ && defined __has_builtin |
104 | #define ECB_CLANG_BUILTIN(x) __has_builtin(x) |
104 | #define ECB_CLANG_BUILTIN(x) __has_builtin (x) |
105 | #else |
105 | #else |
106 | #define ECB_CLANG_BUILTIN(x) 0 |
106 | #define ECB_CLANG_BUILTIN(x) 0 |
107 | #endif |
107 | #endif |
108 | |
108 | |
109 | #if __clang__ && defined(__has_extension) |
109 | #if __clang__ && defined __has_extension |
110 | #define ECB_CLANG_EXTENSION(x) __has_extension(x) |
110 | #define ECB_CLANG_EXTENSION(x) __has_extension (x) |
111 | #else |
111 | #else |
112 | #define ECB_CLANG_EXTENSION(x) 0 |
112 | #define ECB_CLANG_EXTENSION(x) 0 |
113 | #endif |
113 | #endif |
114 | |
114 | |
115 | #define ECB_CPP (__cplusplus+0) |
115 | #define ECB_CPP (__cplusplus+0) |
… | |
… | |
335 | #define ecb_prefetch(addr,rw,locality) |
335 | #define ecb_prefetch(addr,rw,locality) |
336 | #endif |
336 | #endif |
337 | |
337 | |
338 | /* no emulation for ecb_decltype */ |
338 | /* no emulation for ecb_decltype */ |
339 | #if ECB_CPP11 |
339 | #if ECB_CPP11 |
|
|
340 | // older implementations might have problems with decltype(x)::type, work around it |
|
|
341 | template<class T> struct ecb_decltype_t { typedef T type; }; |
340 | #define ecb_decltype(x) decltype (x) |
342 | #define ecb_decltype(x) ecb_decltype_t<decltype (x)>::type |
341 | #elif ECB_GCC_VERSION(3,0) || ECB_CLANG_VERSION(2,8) |
343 | #elif ECB_GCC_VERSION(3,0) || ECB_CLANG_VERSION(2,8) |
342 | #define ecb_decltype(x) __typeof__ (x) |
344 | #define ecb_decltype(x) __typeof__ (x) |
343 | #endif |
345 | #endif |
344 | |
346 | |
345 | #if _MSC_VER >= 1300 |
347 | #if _MSC_VER >= 1300 |
… | |
… | |
351 | #define ecb_noinline ecb_attribute ((__noinline__)) |
353 | #define ecb_noinline ecb_attribute ((__noinline__)) |
352 | #define ecb_unused ecb_attribute ((__unused__)) |
354 | #define ecb_unused ecb_attribute ((__unused__)) |
353 | #define ecb_const ecb_attribute ((__const__)) |
355 | #define ecb_const ecb_attribute ((__const__)) |
354 | #define ecb_pure ecb_attribute ((__pure__)) |
356 | #define ecb_pure ecb_attribute ((__pure__)) |
355 | |
357 | |
356 | /* http://msdn.microsoft.com/en-us/library/k6ktzx3s.aspx __declspec(noreturn) */ |
358 | /* TODO http://msdn.microsoft.com/en-us/library/k6ktzx3s.aspx __declspec(noreturn) */ |
357 | #if ECB_C11 |
359 | #if ECB_C11 || __IBMC_NORETURN |
|
|
360 | /* http://pic.dhe.ibm.com/infocenter/compbg/v121v141/topic/com.ibm.xlcpp121.bg.doc/language_ref/noreturn.html */ |
358 | #define ecb_noreturn _Noreturn |
361 | #define ecb_noreturn _Noreturn |
359 | #else |
362 | #else |
360 | #define ecb_noreturn ecb_attribute ((__noreturn__)) |
363 | #define ecb_noreturn ecb_attribute ((__noreturn__)) |
361 | #endif |
364 | #endif |
362 | |
365 | |