From 15824c718bb7fc60d643de2621abdddc82c4bdf8 Mon Sep 17 00:00:00 2001 From: Karoy Lorentey Date: Fri, 7 Jul 2023 12:04:59 -0700 Subject: [PATCH] =?UTF-8?q?[=5FAtomicsShims]=20Don=E2=80=99t=20define=20at?= =?UTF-8?q?omic=20operations=20when=20this=20header=20is=20compiled=20as?= =?UTF-8?q?=20C++?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `_Atomic(_sa_dword)` trips up C++. This is likely due to real issues, but it seems pointless to try to fix it — rather than heroically trying to keep this header working, we can simply force the use of native builtins on Swift 5.9 and later. (I planned to do that anyway, as a major step towards deleting `_AtomicsShims` altogether.) --- Sources/_AtomicsShims/include/_AtomicsShims.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Sources/_AtomicsShims/include/_AtomicsShims.h b/Sources/_AtomicsShims/include/_AtomicsShims.h index 8cddbcb..b5520c2 100644 --- a/Sources/_AtomicsShims/include/_AtomicsShims.h +++ b/Sources/_AtomicsShims/include/_AtomicsShims.h @@ -13,6 +13,8 @@ #ifndef SWIFTATOMIC_HEADER_INCLUDED #define SWIFTATOMIC_HEADER_INCLUDED 1 +#ifndef __cplusplus + #include #include #include @@ -237,4 +239,5 @@ SWIFTATOMIC_DEFINE_TYPE(DoubleWord, _sa_dword) SWIFTATOMIC_SWIFTCC SWIFTATOMIC_SHIMS_EXPORT void _sa_retain_n(void *object, uint32_t n); SWIFTATOMIC_SWIFTCC SWIFTATOMIC_SHIMS_EXPORT void _sa_release_n(void *object, uint32_t n); +#endif // __cplusplus #endif //SWIFTATOMIC_HEADER_INCLUDED