[libc-commits] [libc] [libc] Allow RPC interface to be compiled with MSVC (PR #190483)
Joseph Huber via libc-commits
libc-commits at lists.llvm.org
Sat Apr 4 14:13:33 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))
----------------
jhuber6 wrote:
That's what I thought but it's used in practice? Though this might be behavior gated behind their extended volatile so I'm not sure if it works in every case https://learn.microsoft.com/en-us/cpp/build/reference/volatile-volatile-keyword-interpretation?view=msvc-170.
I'm going to double check this.
https://github.com/llvm/llvm-project/pull/190483
More information about the libc-commits
mailing list