From 2b6f8759f768e846b02baee170ea667c119bd2dc Mon Sep 17 00:00:00 2001
From: Greg Burd <greg@burd.me>
Date: Fri, 20 Mar 2026 10:39:04 -0400
Subject: [PATCH v3 1/5] Enable Visual Studio's stdatomic.h support

Add /experimental:c11atomics flag for MSVC builds to enable
C11 standard atomics support. This is required for MSVC 2022
to use <stdatomic.h>.
---
 meson.build | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/meson.build b/meson.build
index 0a181909fab..caa11b42c33 100644
--- a/meson.build
+++ b/meson.build
@@ -673,6 +673,10 @@ if have_cxx and not cxx.compiles(cxx11_test, name: 'C++11')
   endif
 endif
 
+# XXX Should test whether <stdatomic.h> works without this
+if cc.get_id() == 'msvc'
+  cflags += '/experimental:c11atomics'
+endif
 
 postgres_inc = [include_directories(postgres_inc_d)]
 test_lib_d = postgres_lib_d
-- 
2.51.2

