mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-22 06:59:01 -06:00
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.
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user