Skip to content

Commit 0554f47

Browse files
committed
fix wrong attribute ordering in the runtime
This fix might be replaced by something better, e.g. #61476
1 parent 4595185 commit 0554f47

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

include/swift/Runtime/Heap.h

+1-1
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_ATTRIBUTE_FOR_EXPORTS
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

+2-2
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_ATTRIBUTE_FOR_EXPORTS
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_ATTRIBUTE_FOR_EXPORTS
121121
HeapObject* swift_allocEmptyBox();
122122

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

include/swift/Runtime/Metadata.h

+2-2
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_ATTRIBUTE_FOR_EXPORTS
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_ATTRIBUTE_FOR_EXPORTS
326326
ValueMetadata *
327327
swift_allocateGenericValueMetadata(const ValueTypeDescriptor *description,
328328
const void *arguments,

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

+2
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,10 @@
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)
218220

0 commit comments

Comments
 (0)