Merge pull request #38 from lorentey/ifdef-away-the-problem

[shims] Only define atomic shims in Swift's Clang Importer
This commit is contained in:
Karoy Lorentey authored and GitHub committed 2021-09-09 11:47:35 -07:00
commit 5b282079cb
1 file changed
+10 -1
+10 -1
View File
@@ -56,8 +56,13 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdatomic.h>
#include <assert.h>
// The atomic primitives are only needed when this is compiled using Swift's
// Clang Importer. This allows us to continue reling on some Clang extensions
// (see https://github.com/apple/swift-atomics/issues/37).
#if defined(__swift__)
# include <stdatomic.h>
#endif
// For now, assume double-wide atomics are available everywhere,
// except on Linux/x86_64, where they need to be manually enabled
@@ -73,6 +78,8 @@
# endif
#endif
#if defined(__swift__)
#define SWIFTATOMIC_INLINE static inline __attribute__((__always_inline__))
#define SWIFTATOMIC_SWIFT_NAME(name) __attribute__((swift_name(#name)))
@@ -348,6 +355,8 @@ SWIFTATOMIC_DEFINE_TYPE(COMPLEX, DoubleWord, _sa_dword, _sa_double_word_ctype)
SWIFTATOMIC_STORAGE_TYPE(DoubleWord, _sa_dword, _sa_double_word_ctype)
#endif
#endif // __swift__
#if ENABLE_DOUBLEWIDE_ATOMICS
extern void _sa_retain_n(void *object, uint32_t n);
extern void _sa_release_n(void *object, uint32_t n);