Index: source/common/putilimp.h |
diff --git a/source/common/putilimp.h b/source/common/putilimp.h |
index e3da3409742e19081f77015beba93984c1ee39a7..90bae929f41461acf5f40f1a7570e508438adc10 100644 |
--- a/source/common/putilimp.h |
+++ b/source/common/putilimp.h |
@@ -1,7 +1,7 @@ |
/* |
****************************************************************************** |
* |
-* Copyright (C) 1997-2014, International Business Machines |
+* Copyright (C) 1997-2015, International Business Machines |
* Corporation and others. All Rights Reserved. |
* |
****************************************************************************** |
@@ -229,6 +229,26 @@ typedef size_t uintptr_t; |
#endif |
+/** |
+ * \def U_HAVE_CLANG_ATOMICS |
+ * Defines whether Clang c11 style built-in atomics are avaialable. |
+ * These are used in preference to gcc atomics when both are available. |
+ */ |
+#ifdef U_HAVE_CLANG_ATOMICS |
+ /* Use the predefined value. */ |
+#elif !defined(__clang__) |
+# define U_HAVE_CLANG_ATOMICS 0 |
+#else |
+#if __has_builtin(__c11_atomic_load) && \ |
+ __has_builtin(__c11_atomic_store) && \ |
+ __has_builtin(__c11_atomic_fetch_add) && \ |
+ __has_builtin(__c11_atomic_fetch_sub) |
+# define U_HAVE_CLANG_ATOMICS 1 |
+#else |
+# define U_HAVE_CLANG_ATOMICS 0 |
+#endif |
+#endif |
+ |
/*===========================================================================*/ |
/** @{ Code alignment */ |
/*===========================================================================*/ |