Skip to content

Commit

Permalink
[shims] Make retain_n/release_n shims header-only.
Browse files Browse the repository at this point in the history
Resolves issue apple#8.
  • Loading branch information
lorentey committed Oct 7, 2020
1 parent c6b1ed7 commit 45fa32a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
3 changes: 1 addition & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ let package = Package(
.target(name: "_AtomicsShims"),
.target(
name: "Atomics",
dependencies: ["_AtomicsShims"],
path: "Sources/Atomics"
dependencies: ["_AtomicsShims"]
),
.testTarget(
name: "AtomicsTests",
Expand Down
11 changes: 9 additions & 2 deletions Sources/_AtomicsShims/include/_AtomicsShims.h
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,14 @@ SWIFTATOMIC_DEFINE_TYPE(COMPLEX, DoubleWord, _sa_dword, uint64_t)
#error "Unsupported intptr_t bit width"
#endif // __INTPTR_WIDTH

extern void _sa_retain_n(void *object, uint32_t n);
extern void _sa_release_n(void *object, uint32_t n);
static inline void _sa_retain_n(void *object, uint32_t n) {
extern void *swift_retain_n(void *object, uint32_t n);
swift_retain_n(object, n);
}

static inline void _sa_release_n(void *object, uint32_t n) {
extern void swift_release_n(void *object, uint32_t n);
swift_release_n(object, n);
}

#endif //SWIFTATOMIC_HEADER_INCLUDED
12 changes: 3 additions & 9 deletions Sources/_AtomicsShims/src/_AtomicsShims.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@

#include "_AtomicsShims.h"

void _sa_retain_n(void *object, uint32_t n) {
extern void *swift_retain_n(void *object, uint32_t n);
swift_retain_n(object, n);
}

void _sa_release_n(void *object, uint32_t n) {
extern void swift_release_n(void *object, uint32_t n);
swift_release_n(object, n);
}
// Note: This file intentionally doesn't contain any actual defintions;
// it only exists to satisfy SPM's requirement that each C target include at
// least one .c file.

0 comments on commit 45fa32a

Please sign in to comment.