From b99e111f42cbe469075c90c522918a56f932915f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven=20Dee=20=28J=C5=8Dshin=29?= Date: Mon, 17 Jun 2024 20:17:48 -0700 Subject: [PATCH] Fix c.inc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit c.inc (as far as I can tell erroneously) would define `_Atomic(t)` to be `vloatile t *` instead of just `volatile t` if `__STDC_VERSION__` didn't say at least C11. This branch gets taken if we’re compiling C++; however in C++11 `_Atomic` is a library define, not a language keyword. Moreover it is defined in ``, which is a morass that ultimately sets up everything to refer back to `std::atomic`. The gory details are in `third_party/libcxx/__atomic/cxx_atomic_impl.h`. For our purposes it seems to be enough to just have our data be volatile and use the libc/intrin/atomic.h functions on them. --- libc/integral/c.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/integral/c.inc b/libc/integral/c.inc index 301cca916..1a25488b3 100644 --- a/libc/integral/c.inc +++ b/libc/integral/c.inc @@ -74,7 +74,7 @@ #endif #if __STDC_VERSION__ + 0 < 201112 -#define _Atomic(t) volatile t * +#define _Atomic(t) volatile t #endif #ifdef __llvm__