mirror of
https://github.com/apple/swift-atomics
synced 2026-11-30 05:08:44 +00:00
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:
1 file changed
+10
-1
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user