Skip to content

Commit 50439e5

Browse files
authored
Merge pull request #61974 from eeckstein/fix-attribute-ordering
fix wrong attribute ordering in the runtime
2 parents 73e7d4a + 0494db0 commit 50439e5

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

include/swift/Runtime/Heap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace swift {
2929
// Never returns nil. The returned memory is uninitialized.
3030
//
3131
// An "alignment mask" is just the alignment (a power of 2) minus 1.
32-
SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT
32+
SWIFT_EXTERN_C SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT_ATTRIBUTE
3333
void *swift_slowAlloc(size_t bytes, size_t alignMask);
3434

3535
// If the caller cannot promise to zero the object during destruction,

include/swift/Runtime/HeapObject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ struct OpaqueValue;
6161
///
6262
/// POSSIBILITIES: The argument order is fair game. It may be useful
6363
/// to have a variant which guarantees zero-initialized memory.
64-
SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT
64+
SWIFT_EXTERN_C SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT_ATTRIBUTE
6565
HeapObject *swift_allocObject(HeapMetadata const *metadata,
6666
size_t requiredSize,
6767
size_t requiredAlignmentMask);
@@ -117,7 +117,7 @@ BoxPair swift_makeBoxUnique(OpaqueValue *buffer, Metadata const *type,
117117
size_t alignMask);
118118

119119
/// Returns the address of a heap object representing all empty box types.
120-
SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT
120+
SWIFT_EXTERN_C SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT_ATTRIBUTE
121121
HeapObject* swift_allocEmptyBox();
122122

123123
/// Atomically increments the retain count of an object.

include/swift/Runtime/Metadata.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ swift_getGenericMetadata(MetadataRequest request,
313313
/// - installing new v-table entries and overrides; and
314314
/// - registering the class with the runtime under ObjC interop.
315315
/// Most of this work can be achieved by calling swift_initClassMetadata.
316-
SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT
316+
SWIFT_EXTERN_C SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT_ATTRIBUTE
317317
ClassMetadata *
318318
swift_allocateGenericClassMetadata(const ClassDescriptor *description,
319319
const void *arguments,
@@ -322,7 +322,7 @@ swift_allocateGenericClassMetadata(const ClassDescriptor *description,
322322
/// Allocate a generic value metadata object. This is intended to be
323323
/// called by the metadata instantiation function of a generic struct or
324324
/// enum.
325-
SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT
325+
SWIFT_EXTERN_C SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT_ATTRIBUTE
326326
ValueMetadata *
327327
swift_allocateGenericValueMetadata(const ValueTypeDescriptor *description,
328328
const void *arguments,

stdlib/public/SwiftShims/swift/shims/Visibility.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,13 @@
211211
// TODO: use this in shims headers in overlays.
212212
#if defined(__cplusplus)
213213
#define SWIFT_EXPORT_FROM(LIBRARY) extern "C" SWIFT_EXPORT_FROM_ATTRIBUTE(LIBRARY)
214+
#define SWIFT_EXTERN_C extern "C"
214215
#else
215216
#define SWIFT_EXPORT_FROM(LIBRARY) SWIFT_EXPORT_FROM_ATTRIBUTE(LIBRARY)
217+
#define SWIFT_EXTERN_C
216218
#endif
217219
#define SWIFT_RUNTIME_EXPORT SWIFT_EXPORT_FROM(swiftCore)
220+
#define SWIFT_RUNTIME_EXPORT_ATTRIBUTE SWIFT_EXPORT_FROM_ATTRIBUTE(swiftCore)
218221

219222
#if __cplusplus > 201402l && __has_cpp_attribute(fallthrough)
220223
#define SWIFT_FALLTHROUGH [[fallthrough]]

0 commit comments

Comments
 (0)