_interlockedexchange64 is not defined in clang/LLVM for Windows
In u_atomic.h, the following code fails to build on clang/LLVM for Windows 15.0.1:
#define PIPE_NATIVE_ATOMIC_XCHG
#define p_atomic_xchg(_v, _new) (\
sizeof *(_v) == sizeof(char) ? _InterlockedExchange8 ((char *) (_v), (char) (_new)) : \
sizeof *(_v) == sizeof(short) ? _InterlockedExchange16((short *) (_v), (short) (_new)) : \
sizeof *(_v) == sizeof(long) ? _InterlockedExchange ((long *) (_v), (long) (_new)) : \
sizeof *(_v) == sizeof(__int64) ? _interlockedexchange64((__int64 *)(_v), (__int64)(_new)) : \
(assert(!"should not get here"), 0))
#endif
Specifically, _interlockedexchange64
is not a known function and so fails to build.
..\src\4c402af263-2906988cbb\src\util/simple_mtx.h(112,14): warning: call to undeclared function '_interlockedexchange64'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
c = p_atomic_xchg(&mtx->val, 2);
^
..\src\4c402af263-2906988cbb\src\util/u_atomic.h(200,38): note: expanded from macro 'p_atomic_xchg'
sizeof *(_v) == sizeof(__int64) ? _interlockedexchange64((__int64 *)(_v), (__int64)(_new)) : \
^
In file included from ../src/4c402af263-2906988cbb/src/mapi/stub.c:34:
..\src\4c402af263-2906988cbb\src\util/simple_mtx.h(129,8): warning: call to undeclared function '_interlockedexchangeadd64'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
c = p_atomic_fetch_add(&mtx->val, -1);
^
..\src\4c402af263-2906988cbb\src\util/u_atomic.h(179,38): note: expanded from macro 'p_atomic_fetch_add'
sizeof *(_v) == sizeof(__int64) ? _interlockedexchangeadd64((__int64 *)(_v), (_i)) : \
It does build correctly if you make it _InterlockedExchange64
instead.