Skip to content

Commit a795017

Browse files
committed
Fix c.inc _Atomic define for C++ (#1231)
c.inc (AFAICT erroneously) defined _Atomic(t) as `volatile t *`, when it should have just said `volatile t`, when __STDC_VERSION__ was too small. This happens when we’re compiling C++, but in C++11, _Atomic is a define supplied by the STL rather than a keyword supplied by the compiler. Wait though, it gets better: in C++11, _Atomic hooks you into the morass that is stdatomic.h, and ultimately refers everything back to std::atomic<T>. The gory, horrifying details are in libcxx's __atomic/cxx_atomic_impl.h. The tldr is that for our purposes it’s fine to just say volatile and use the normal libc/intrin/atomic.h functions.
1 parent 8e3b361 commit a795017

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libc/integral/c.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
#endif
7575

7676
#if __STDC_VERSION__ + 0 < 201112
77-
#define _Atomic(t) volatile t *
77+
#define _Atomic(t) volatile t
7878
#endif
7979

8080
#ifdef __llvm__

0 commit comments

Comments
 (0)