From a54b15df8704cbe52581cbecb7509cbcd147493a Mon Sep 17 00:00:00 2001 From: Ben Barham Date: Tue, 29 Nov 2022 10:56:01 -0800 Subject: [PATCH] Revert "fix wrong attribute ordering in the runtime" This reverts commit 0494db062aa9ebc102ac066b9eeb0c878fc6bb12 as it was a workaround for a Clang bug that is now fixed (see https://reviews.llvm.org/D137979). --- include/swift/Runtime/Heap.h | 2 +- include/swift/Runtime/HeapObject.h | 4 ++-- include/swift/Runtime/Metadata.h | 4 ++-- stdlib/public/SwiftShims/swift/shims/Visibility.h | 3 --- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/include/swift/Runtime/Heap.h b/include/swift/Runtime/Heap.h index c9c6cbff10a77..4b7f50fb0899a 100644 --- a/include/swift/Runtime/Heap.h +++ b/include/swift/Runtime/Heap.h @@ -29,7 +29,7 @@ namespace swift { // Never returns nil. The returned memory is uninitialized. // // An "alignment mask" is just the alignment (a power of 2) minus 1. -SWIFT_EXTERN_C SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT_ATTRIBUTE +SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT void *swift_slowAlloc(size_t bytes, size_t alignMask); // If the caller cannot promise to zero the object during destruction, diff --git a/include/swift/Runtime/HeapObject.h b/include/swift/Runtime/HeapObject.h index 62c178285d2a9..c0de2f46ff2de 100644 --- a/include/swift/Runtime/HeapObject.h +++ b/include/swift/Runtime/HeapObject.h @@ -61,7 +61,7 @@ struct OpaqueValue; /// /// POSSIBILITIES: The argument order is fair game. It may be useful /// to have a variant which guarantees zero-initialized memory. -SWIFT_EXTERN_C SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT_ATTRIBUTE +SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT HeapObject *swift_allocObject(HeapMetadata const *metadata, size_t requiredSize, size_t requiredAlignmentMask); @@ -117,7 +117,7 @@ BoxPair swift_makeBoxUnique(OpaqueValue *buffer, Metadata const *type, size_t alignMask); /// Returns the address of a heap object representing all empty box types. -SWIFT_EXTERN_C SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT_ATTRIBUTE +SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT HeapObject* swift_allocEmptyBox(); /// Atomically increments the retain count of an object. diff --git a/include/swift/Runtime/Metadata.h b/include/swift/Runtime/Metadata.h index edc55608e454a..9114d7462ccc4 100644 --- a/include/swift/Runtime/Metadata.h +++ b/include/swift/Runtime/Metadata.h @@ -313,7 +313,7 @@ swift_getGenericMetadata(MetadataRequest request, /// - installing new v-table entries and overrides; and /// - registering the class with the runtime under ObjC interop. /// Most of this work can be achieved by calling swift_initClassMetadata. -SWIFT_EXTERN_C SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT_ATTRIBUTE +SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT ClassMetadata * swift_allocateGenericClassMetadata(const ClassDescriptor *description, const void *arguments, @@ -322,7 +322,7 @@ swift_allocateGenericClassMetadata(const ClassDescriptor *description, /// Allocate a generic value metadata object. This is intended to be /// called by the metadata instantiation function of a generic struct or /// enum. -SWIFT_EXTERN_C SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT_ATTRIBUTE +SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT ValueMetadata * swift_allocateGenericValueMetadata(const ValueTypeDescriptor *description, const void *arguments, diff --git a/stdlib/public/SwiftShims/swift/shims/Visibility.h b/stdlib/public/SwiftShims/swift/shims/Visibility.h index 5792a455ff048..ce7a478a28174 100644 --- a/stdlib/public/SwiftShims/swift/shims/Visibility.h +++ b/stdlib/public/SwiftShims/swift/shims/Visibility.h @@ -217,13 +217,10 @@ // TODO: use this in shims headers in overlays. #if defined(__cplusplus) #define SWIFT_EXPORT_FROM(LIBRARY) extern "C" SWIFT_EXPORT_FROM_ATTRIBUTE(LIBRARY) -#define SWIFT_EXTERN_C extern "C" #else #define SWIFT_EXPORT_FROM(LIBRARY) SWIFT_EXPORT_FROM_ATTRIBUTE(LIBRARY) -#define SWIFT_EXTERN_C #endif #define SWIFT_RUNTIME_EXPORT SWIFT_EXPORT_FROM(swiftCore) -#define SWIFT_RUNTIME_EXPORT_ATTRIBUTE SWIFT_EXPORT_FROM_ATTRIBUTE(swiftCore) #if __cplusplus > 201402l && __has_cpp_attribute(fallthrough) #define SWIFT_FALLTHROUGH [[fallthrough]]