[libc-commits] [libc] [libc] Allow RPC interface to be compiled with MSVC (PR #190483)

Shilei Tian via libc-commits libc-commits at lists.llvm.org
Sat Apr 4 15:13:13 PDT 2026


================
@@ -20,10 +20,24 @@
 
 #include "rpc_util.h"
 
-namespace rpc {
-
 /// Use scoped atomic variants if they are available for the target.
 #if !__has_builtin(__scoped_atomic_load_n)
+#ifdef _MSC_VER // MSVC atomic support.
+#include <intrin.h>
+#define RPC_TYPEOF(x) rpc::remove_reference_t<decltype(x)>
+#define __scoped_atomic_load_n(src, ord, scp)                                  \
+  (*(const volatile RPC_TYPEOF(*(src)) *)(src))
----------------
shiltian wrote:

IIRC volatile can serve as atomic for some compilers

https://github.com/llvm/llvm-project/pull/190483


More information about the libc-commits mailing list