summaryrefslogtreecommitdiffstats
path: root/Utilities
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-04-07 11:39:38 (GMT)
committerBrad King <brad.king@kitware.com>2020-04-07 11:47:47 (GMT)
commit02a28f1d4451839abfc38e0c437cda438811172f (patch)
tree4ea836a692d0ea9f4a0d1f9d3978234fd4f3b09b /Utilities
parent82a06d5cb46bea0e87fdeed35ab023099f649621 (diff)
downloadCMake-02a28f1d4451839abfc38e0c437cda438811172f.zip
CMake-02a28f1d4451839abfc38e0c437cda438811172f.tar.gz
CMake-02a28f1d4451839abfc38e0c437cda438811172f.tar.bz2
libuv: Restore compilation with XLClang 16.1 on AIX
libuv upstream commit `4a972bf0` (aix: Fix broken cmpxchgi() XL C++ specialization., 2019-09-06, v1.32.0~5) broke compilation with this compiler. According to https://www.ibm.com/support/knowledgecenter/SSGH3R_16.1.0/com.ibm.xlcpp161.aix.doc/migrate/migrate_to_xlclang.html XLClang 16.1 for AIX does not support `__sync_val_compare_and_swap`. The documentation suggests using C++11 atomic operations instead, but this is C code. For now fall back to the non-atomic equivalent used before so we can at least compile. Add a FIXME comment for this.
Diffstat (limited to 'Utilities')
-rw-r--r--Utilities/cmlibuv/src/unix/atomic-ops.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/Utilities/cmlibuv/src/unix/atomic-ops.h b/Utilities/cmlibuv/src/unix/atomic-ops.h
index bc37c0d..7efed02 100644
--- a/Utilities/cmlibuv/src/unix/atomic-ops.h
+++ b/Utilities/cmlibuv/src/unix/atomic-ops.h
@@ -36,6 +36,12 @@ UV_UNUSED(static int cmpxchgi(int* ptr, int oldval, int newval)) {
: "r" (newval), "0" (oldval)
: "memory");
return out;
+#elif defined(_AIX) && defined(__ibmxl__)
+ /* FIXME: This is not actually atomic but XLClang 16.1 for AIX
+ does not provide __sync_val_compare_and_swap or an equivalent.
+ Its documentation suggests using C++11 atomics but this is C. */
+ __compare_and_swap((volatile int*)ptr, &oldval, newval);
+ return oldval;
#elif defined(__MVS__)
unsigned int op4;
if (__plo_CSST(ptr, (unsigned int*) &oldval, newval,