Skip to content

Commit bd8115e

Browse files
committed
_sa_retain_n/_sa_release_n: Use C calling convention in package builds
1 parent cd142fd commit bd8115e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Sources/_AtomicsShims/include/_AtomicsShims.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,16 @@ SWIFTATOMIC_DEFINE_TYPE(DoubleWord, _sa_dword)
235235

236236
#endif //!defined(ATOMICS_NATIVE_BUILTINS) && defined(__swift__) && !defined(__cplusplus)
237237

238+
#if SWIFTATOMIC_SINGLE_MODULE
239+
// In the single-module configuration, declare _sa_retain_n/_sa_release_n with
240+
// the Swift calling convention, so that they can be easily picked up with
241+
// @_silgen_name'd declarations.
242+
// FIXME: Use @_cdecl("name") once we can switch to a compiler that has it.
238243
SWIFTATOMIC_SWIFTCC SWIFTATOMIC_SHIMS_EXPORT void _sa_retain_n(void *object, uint32_t n);
239244
SWIFTATOMIC_SWIFTCC SWIFTATOMIC_SHIMS_EXPORT void _sa_release_n(void *object, uint32_t n);
245+
#else
246+
SWIFTATOMIC_SHIMS_EXPORT void _sa_retain_n(void *object, uint32_t n);
247+
SWIFTATOMIC_SHIMS_EXPORT void _sa_release_n(void *object, uint32_t n);
248+
#endif
240249

241250
#endif //SWIFTATOMIC_HEADER_INCLUDED

0 commit comments

Comments
 (0)