summaryrefslogtreecommitdiff
path: root/ev.c
diff options
context:
space:
mode:
authorEmanuele Giaquinta <exg@gentoo.org>2015-04-01 06:57:41 +0000
committerEmanuele Giaquinta <exg@gentoo.org>2015-04-01 06:57:41 +0000
commit33ad8a2c56cfdaa98de9e0e188d8ce227047d4ce (patch)
treed7886b68e09a20f6e4247faea9d6afc9acf3c058 /ev.c
parent0682668768a1666edc0b77659e1094e24626220a (diff)
downloadlibev-33ad8a2c56cfdaa98de9e0e188d8ce227047d4ce.tar.gz
libev-33ad8a2c56cfdaa98de9e0e188d8ce227047d4ce.zip
ecb upgrade.
Diffstat (limited to 'ev.c')
-rw-r--r--ev.c37
1 files changed, 29 insertions, 8 deletions
diff --git a/ev.c b/ev.c
index b92ac15..7cdcb44 100644
--- a/ev.c
+++ b/ev.c
@@ -568,8 +568,11 @@ struct signalfd_siginfo
#endif
#endif
+#define ECB_GCC_AMD64 (__amd64 || __amd64__ || __x86_64 || __x86_64__)
+#define ECB_MSVC_AMD64 (_M_AMD64 || _M_X64)
+
/* work around x32 idiocy by defining proper macros */
-#if __amd64 || __x86_64 || _M_AMD64 || _M_X64
+#if ECB_GCC_AMD64 || ECB_MSVC_AMD64
#if _ILP32
#define ECB_AMD64_X32 1
#else
@@ -647,7 +650,7 @@ struct signalfd_siginfo
#define ECB_MEMORY_FENCE __asm__ __volatile__ ("lock; orb $0, -1(%%esp)" : : : "memory")
#define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("" : : : "memory")
#define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("")
- #elif __amd64 || __amd64__ || __x86_64 || __x86_64__
+ #elif ECB_GCC_AMD64
#define ECB_MEMORY_FENCE __asm__ __volatile__ ("mfence" : : : "memory")
#define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("" : : : "memory")
#define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("")
@@ -796,6 +799,7 @@ typedef int ecb_bool;
#define ECB_CONCAT(a, b) ECB_CONCAT_(a, b)
#define ECB_STRINGIFY_(a) # a
#define ECB_STRINGIFY(a) ECB_STRINGIFY_(a)
+#define ECB_STRINGIFY_EXPR(expr) ((expr), ECB_STRINGIFY_ (expr))
#define ecb_function_ ecb_inline
@@ -842,15 +846,32 @@ typedef int ecb_bool;
#define ecb_deprecated ecb_attribute ((__deprecated__))
#endif
-#define ecb_noinline ecb_attribute ((__noinline__))
+#if __MSC_VER >= 1500
+ #define ecb_deprecated_message(msg) __declspec (deprecated (msg))
+#elif ECB_GCC_VERSION(4,5)
+ #define ecb_deprecated_message(msg) ecb_attribute ((__deprecated__ (msg))
+#else
+ #define ecb_deprecated_message(msg) ecb_deprecated
+#endif
+
+#if _MSC_VER >= 1400
+ #define ecb_noinline __declspec (noinline)
+#else
+ #define ecb_noinline ecb_attribute ((__noinline__))
+#endif
+
#define ecb_unused ecb_attribute ((__unused__))
#define ecb_const ecb_attribute ((__const__))
#define ecb_pure ecb_attribute ((__pure__))
-/* TODO http://msdn.microsoft.com/en-us/library/k6ktzx3s.aspx __declspec(noreturn) */
#if ECB_C11 || __IBMC_NORETURN
/* http://pic.dhe.ibm.com/infocenter/compbg/v121v141/topic/com.ibm.xlcpp121.bg.doc/language_ref/noreturn.html */
#define ecb_noreturn _Noreturn
+#elif ECB_CPP11
+ #define ecb_noreturn [[noreturn]]
+#elif _MSC_VER >= 1200
+ /* http://msdn.microsoft.com/en-us/library/k6ktzx3s.aspx */
+ #define ecb_noreturn __declspec (noreturn)
#else
#define ecb_noreturn ecb_attribute ((__noreturn__))
#endif
@@ -1067,7 +1088,7 @@ ecb_byteorder_helper (void)
/* the reason why we have this horrible preprocessor mess */
/* is to avoid it in all cases, at least on common architectures */
/* or when using a recent enough gcc version (>= 4.6) */
-#if __i386 || __i386__ || _M_X86 || __amd64 || __amd64__ || _M_X64
+#if ((__i386 || __i386__) && !__VOS__) || _M_IX86 || ECB_GCC_AMD64 || ECB_MSVC_AMD64
return 0x44;
#elif __BYTE_ORDER__ && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
return 0x44;
@@ -1128,7 +1149,7 @@ ecb_inline ecb_const ecb_bool ecb_little_endian (void) { return ecb_byteorder_he
/* the only noteworthy exception is ancient armle, which uses order 43218765 */
#if 0 \
|| __i386 || __i386__ \
- || __amd64 || __amd64__ || __x86_64 || __x86_64__ \
+ || ECB_GCC_AMD64 \
|| __powerpc__ || __ppc__ || __powerpc64__ || __ppc64__ \
|| defined __s390__ || defined __s390x__ \
|| defined __mips__ \
@@ -1138,7 +1159,7 @@ ecb_inline ecb_const ecb_bool ecb_little_endian (void) { return ecb_byteorder_he
|| defined __m68k__ \
|| defined __m88k__ \
|| defined __sh__ \
- || defined _M_IX86 || defined _M_AMD64 || defined _M_IA64 \
+ || defined _M_IX86 || defined ECB_MSVC_AMD64 || defined _M_IA64 \
|| (defined __arm__ && (defined __ARM_EABI__ || defined __EABI__ || defined __VFP_FP__ || defined _WIN32_WCE || defined __ANDROID__)) \
|| defined __aarch64__
#define ECB_STDFP 1
@@ -1167,7 +1188,7 @@ ecb_inline ecb_const ecb_bool ecb_little_endian (void) { return ecb_byteorder_he
#if ECB_C99 || _XOPEN_VERSION >= 600 || _POSIX_VERSION >= 200112L
#define ecb_ldexpf(x,e) ldexpf ((x), (e))
#else
- #define ecb_ldexpf(x,e) (float) ldexp ((x), (e))
+ #define ecb_ldexpf(x,e) (float) ldexp ((float) (x), (e))
#endif
/* converts an ieee half/binary16 to a float */