OLD | NEW |
1 diff --git a/source/common/putilimp.h b/source/common/putilimp.h | 1 diff --git a/source/common/putilimp.h b/source/common/putilimp.h |
2 index e3da340..430e697 100644 | 2 index e3da340..90bae92 100644 |
3 --- a/source/common/putilimp.h | 3 --- a/source/common/putilimp.h |
4 +++ b/source/common/putilimp.h | 4 +++ b/source/common/putilimp.h |
5 @@ -1,7 +1,7 @@ | 5 @@ -1,7 +1,7 @@ |
6 /* | 6 /* |
7 ****************************************************************************** | 7 ****************************************************************************** |
8 * | 8 * |
9 -* Copyright (C) 1997-2014, International Business Machines | 9 -* Copyright (C) 1997-2014, International Business Machines |
10 +* Copyright (C) 1997-2015, International Business Machines | 10 +* Copyright (C) 1997-2015, International Business Machines |
11 * Corporation and others. All Rights Reserved. | 11 * Corporation and others. All Rights Reserved. |
12 * | 12 * |
13 ****************************************************************************** | 13 ****************************************************************************** |
14 @@ -229,6 +229,23 @@ typedef size_t uintptr_t; | 14 @@ -229,6 +229,26 @@ typedef size_t uintptr_t; |
15 #endif | 15 #endif |
16 | 16 |
17 | 17 |
18 +/** | 18 +/** |
19 + * \def U_HAVE_CLANG_ATOMICS | 19 + * \def U_HAVE_CLANG_ATOMICS |
20 + * Defines whether Clang c11 style built-in atomics are avaialable. | 20 + * Defines whether Clang c11 style built-in atomics are avaialable. |
21 + * These are used in preference to gcc atomics when both are available. | 21 + * These are used in preference to gcc atomics when both are available. |
22 + */ | 22 + */ |
23 +#ifdef U_HAVE_CLANG_ATOMICS | 23 +#ifdef U_HAVE_CLANG_ATOMICS |
24 + /* Use the predefined value. */ | 24 + /* Use the predefined value. */ |
25 +#elif defined(__clang__) && \ | 25 +#elif !defined(__clang__) |
26 + __has_builtin(__c11_atomic_load) && \ | 26 +# define U_HAVE_CLANG_ATOMICS 0 |
27 + __has_builtin(__c11_atomic_store) && \ | 27 +#else |
28 + __has_builtin(__c11_atomic_fetch_add) && \ | 28 +#if __has_builtin(__c11_atomic_load) && \ |
29 + __has_builtin(__c11_atomic_fetch_sub) | 29 + __has_builtin(__c11_atomic_store) && \ |
| 30 + __has_builtin(__c11_atomic_fetch_add) && \ |
| 31 + __has_builtin(__c11_atomic_fetch_sub) |
30 +# define U_HAVE_CLANG_ATOMICS 1 | 32 +# define U_HAVE_CLANG_ATOMICS 1 |
31 +#else | 33 +#else |
32 +# define U_HAVE_CLANG_ATOMICS 0 | 34 +# define U_HAVE_CLANG_ATOMICS 0 |
33 +#endif | 35 +#endif |
| 36 +#endif |
34 + | 37 + |
35 /*===========================================================================*/ | 38 /*===========================================================================*/ |
36 /** @{ Code alignment */ | 39 /** @{ Code alignment */ |
37 /*===========================================================================*/ | 40 /*===========================================================================*/ |
38 diff --git a/source/common/umutex.cpp b/source/common/umutex.cpp | 41 diff --git a/source/common/umutex.cpp b/source/common/umutex.cpp |
39 index 0c1fdc8..581f2b9 100644 | 42 index 0c1fdc8..581f2b9 100644 |
40 --- a/source/common/umutex.cpp | 43 --- a/source/common/umutex.cpp |
41 +++ b/source/common/umutex.cpp | 44 +++ b/source/common/umutex.cpp |
42 @@ -349,8 +349,8 @@ umtx_atomic_dec(u_atomic_int32_t *p) { | 45 @@ -349,8 +349,8 @@ umtx_atomic_dec(u_atomic_int32_t *p) { |
43 | 46 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 + | 101 + |
99 +inline int32_t umtx_atomic_dec(u_atomic_int32_t *var) { | 102 +inline int32_t umtx_atomic_dec(u_atomic_int32_t *var) { |
100 + return __c11_atomic_fetch_sub(var, 1, __ATOMIC_SEQ_CST) - 1; | 103 + return __c11_atomic_fetch_sub(var, 1, __ATOMIC_SEQ_CST) - 1; |
101 +} | 104 +} |
102 +U_NAMESPACE_END | 105 +U_NAMESPACE_END |
103 + | 106 + |
104 + | 107 + |
105 #elif U_HAVE_GCC_ATOMICS | 108 #elif U_HAVE_GCC_ATOMICS |
106 /* | 109 /* |
107 * gcc atomic ops. These are available on several other compilers as well. | 110 * gcc atomic ops. These are available on several other compilers as well. |
OLD | NEW |