Hi Greg,
I'm not an expert on atomics, but I tried v8-0001 on macOS arm64 with
-Duse_stdatomic=yes. The full meson suite passes. Two things came up.
1. The header has a C++23 branch, and that branch fails to build
when an extension includes it inside extern "C", which is the usual
way:
extern "C" {
#include "postgres.h"
#include "storage/lwlock.h"
}
clang 17 failed with "templates must have C++ linkage".
2. pg_atomic_test_set_flag_impl uses atomic_fetch_and_explicit(). On
x86 clang turns that into a lock cmpxchg loop, while master uses a
single xchg.
Maybe use atomic_exchange_explicit(ptr, 0, memory_order_acquire) ?
Thanks,
Shihao