Skip to content

Commit 0556c4b

Browse files
committed
Merge pull request #2480 from compnerd/attribute-spelling
stdlib: use the reserved attribute spellings
2 parents b56c15a + 81661fc commit 0556c4b

File tree

11 files changed

+56
-60
lines changed

11 files changed

+56
-60
lines changed

stdlib/public/SDK/Dispatch/Dispatch.mm

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@
1414

1515
#include "swift/Runtime/Config.h"
1616

17-
SWIFT_CC(swift) __attribute__((visibility("hidden")))
18-
extern "C" dispatch_queue_attr_t
17+
SWIFT_CC(swift)
18+
__attribute__((__visibility__("hidden"))) extern "C" dispatch_queue_attr_t
1919
_swift_dispatch_queue_concurrent(void) {
2020
return DISPATCH_QUEUE_CONCURRENT;
2121
}
2222

23-
SWIFT_CC(swift) __attribute__((visibility("hidden")))
24-
extern "C" SWIFT_CC(swift) dispatch_data_t
25-
_swift_dispatch_data_empty(void) {
23+
SWIFT_CC(swift)
24+
__attribute__((__visibility__("hidden"))) extern "C" SWIFT_CC(swift)
25+
dispatch_data_t _swift_dispatch_data_empty(void) {
2626
return dispatch_data_empty;
2727
}
2828

29-
#define SOURCE(t) \
30-
SWIFT_CC(swift) __attribute__((visibility("hidden"))) \
31-
extern "C" dispatch_source_type_t \
32-
_swift_dispatch_source_type_##t(void) { \
33-
return DISPATCH_SOURCE_TYPE_##t; \
29+
#define SOURCE(t) \
30+
SWIFT_CC(swift) \
31+
__attribute__((__visibility__("hidden"))) extern "C" dispatch_source_type_t \
32+
_swift_dispatch_source_type_##t(void) { \
33+
return DISPATCH_SOURCE_TYPE_##t; \
3434
}
3535

3636
SOURCE(DATA_ADD)

stdlib/public/SwiftShims/LibcShims.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,10 @@ __swift_size_t _swift_stdlib_fwrite_stdout(const void *ptr, __swift_size_t size,
4848
__swift_size_t nitems);
4949

5050
// String handling <string.h>
51-
__attribute__((pure))
52-
SWIFT_RUNTIME_STDLIB_INTERFACE
53-
__swift_size_t _swift_stdlib_strlen(const char *s);
51+
__attribute__((__pure__)) SWIFT_RUNTIME_STDLIB_INTERFACE __swift_size_t
52+
_swift_stdlib_strlen(const char *s);
5453

55-
__attribute__((pure))
54+
__attribute__((__pure__))
5655
SWIFT_RUNTIME_STDLIB_INTERFACE
5756
int _swift_stdlib_memcmp(const void *s1, const void *s2, __swift_size_t n);
5857

@@ -66,9 +65,8 @@ SWIFT_RUNTIME_STDLIB_INTERFACE
6665
int _swift_stdlib_close(int fd);
6766

6867
// Non-standard extensions
69-
__attribute__((const))
70-
SWIFT_RUNTIME_STDLIB_INTERFACE
71-
__swift_size_t _swift_stdlib_malloc_size(const void *ptr);
68+
__attribute__((__const__)) SWIFT_RUNTIME_STDLIB_INTERFACE __swift_size_t
69+
_swift_stdlib_malloc_size(const void *ptr);
7270

7371
// Random number <random>
7472
SWIFT_RUNTIME_STDLIB_INTERFACE

stdlib/public/SwiftShims/RefCount.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
#include "SwiftStdint.h"
2121

2222
typedef struct {
23-
__swift_uint32_t refCount __attribute__((unavailable));
23+
__swift_uint32_t refCount __attribute__((__unavailable__));
2424
} StrongRefCount;
2525

2626
typedef struct {
27-
__swift_uint32_t weakRefCount __attribute__((unavailable));
27+
__swift_uint32_t weakRefCount __attribute__((__unavailable__));
2828
} WeakRefCount;
2929

3030
// not __cplusplus

stdlib/public/SwiftShims/UnicodeShims.h

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -58,32 +58,33 @@ extern const __swift_uint16_t *
5858
_swift_stdlib_ExtendedGraphemeClusterNoBoundaryRulesMatrix;
5959

6060
SWIFT_RUNTIME_STDLIB_INTERFACE
61-
__attribute__((pure))
62-
__swift_int32_t _swift_stdlib_unicode_compare_utf16_utf16(
63-
const __swift_uint16_t *Left, __swift_int32_t LeftLength,
64-
const __swift_uint16_t *Right, __swift_int32_t RightLength);
61+
__attribute__((__pure__)) __swift_int32_t
62+
_swift_stdlib_unicode_compare_utf16_utf16(const __swift_uint16_t *Left,
63+
__swift_int32_t LeftLength,
64+
const __swift_uint16_t *Right,
65+
__swift_int32_t RightLength);
6566

6667
SWIFT_RUNTIME_STDLIB_INTERFACE
67-
__attribute__((pure))
68-
__swift_int32_t _swift_stdlib_unicode_compare_utf8_utf16(
69-
const char *Left, __swift_int32_t LeftLength,
70-
const __swift_uint16_t *Right, __swift_int32_t RightLength);
68+
__attribute__((__pure__)) __swift_int32_t
69+
_swift_stdlib_unicode_compare_utf8_utf16(const char *Left,
70+
__swift_int32_t LeftLength,
71+
const __swift_uint16_t *Right,
72+
__swift_int32_t RightLength);
7173

7274
SWIFT_RUNTIME_STDLIB_INTERFACE
73-
__attribute__((pure))
74-
__swift_int32_t _swift_stdlib_unicode_compare_utf8_utf8(
75-
const char *Left, __swift_int32_t LeftLength,
76-
const char *Right, __swift_int32_t RightLength);
75+
__attribute__((__pure__)) __swift_int32_t
76+
_swift_stdlib_unicode_compare_utf8_utf8(const char *Left,
77+
__swift_int32_t LeftLength,
78+
const char *Right,
79+
__swift_int32_t RightLength);
7780

7881
SWIFT_RUNTIME_STDLIB_INTERFACE
79-
__attribute__((pure))
80-
__swift_intptr_t _swift_stdlib_unicode_hash(
81-
const __swift_uint16_t *Str, __swift_int32_t Length);
82+
__attribute__((__pure__)) __swift_intptr_t
83+
_swift_stdlib_unicode_hash(const __swift_uint16_t *Str, __swift_int32_t Length);
8284

8385
SWIFT_RUNTIME_STDLIB_INTERFACE
84-
__attribute__((pure))
85-
__swift_intptr_t _swift_stdlib_unicode_hash_ascii(
86-
const char *Str, __swift_int32_t Length);
86+
__attribute__((__pure__)) __swift_intptr_t
87+
_swift_stdlib_unicode_hash_ascii(const char *Str, __swift_int32_t Length);
8788

8889
SWIFT_RUNTIME_STDLIB_INTERFACE
8990
__swift_int32_t _swift_stdlib_unicode_strToUpper(

stdlib/public/SwiftShims/Visibility.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@
3838

3939
/// Attribute used to export symbols from the runtime.
4040
#if __MACH__
41-
# define SWIFT_RUNTIME_EXPORT __attribute__((visibility("default")))
41+
# define SWIFT_RUNTIME_EXPORT __attribute__((__visibility__("default")))
4242
#elif __ELF__
4343
// Use protected visibility for ELF, since we don't want Swift symbols to be
4444
// interposable. The relative relocations we form to metadata aren't
4545
// valid in ELF shared objects, and leaving them relocatable at load time
4646
// defeats the purpose of the relative references.
47-
# define SWIFT_RUNTIME_EXPORT __attribute__((visibility("protected")))
47+
# define SWIFT_RUNTIME_EXPORT __attribute__((__visibility__("protected")))
4848
#elif __CYGWIN__
4949
# define SWIFT_RUNTIME_EXPORT
5050
#else

stdlib/public/runtime/ErrorObject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ SWIFT_RUNTIME_EXPORT
181181
extern "C" void swift_willThrow(SwiftError *object);
182182
SWIFT_RUNTIME_EXPORT
183183
extern "C" void swift_unexpectedError(SwiftError *object)
184-
__attribute__((noreturn));
184+
__attribute__((__noreturn__));
185185

186186
#if SWIFT_OBJC_INTEROP
187187

stdlib/public/runtime/Errors.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ reportBacktrace(int *count)
160160
extern "C" {
161161
CRASH_REPORTER_CLIENT_HIDDEN
162162
struct crashreporter_annotations_t gCRAnnotations
163-
__attribute__((section("__DATA," CRASHREPORTER_ANNOTATIONS_SECTION))) = {
164-
CRASHREPORTER_ANNOTATIONS_VERSION, 0, 0, 0, 0, 0, 0, 0};
163+
__attribute__((__section__("__DATA," CRASHREPORTER_ANNOTATIONS_SECTION))) = {
164+
CRASHREPORTER_ANNOTATIONS_VERSION, 0, 0, 0, 0, 0, 0, 0};
165165
}
166166

167167
// Report a message to any forthcoming crash log.

stdlib/public/runtime/HeapObject.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,9 @@ OpaqueValue *swift::swift_projectBox(HeapObject *o) {
277277
}
278278

279279
// Forward-declare this, but define it after swift_release.
280-
extern "C" LLVM_LIBRARY_VISIBILITY
281-
void _swift_release_dealloc(HeapObject *object)
282-
SWIFT_CC(RegisterPreservingCC_IMPL)
283-
__attribute__((noinline,used));
284-
280+
extern "C" LLVM_LIBRARY_VISIBILITY void
281+
_swift_release_dealloc(HeapObject *object) SWIFT_CC(RegisterPreservingCC_IMPL)
282+
__attribute__((__noinline__, __used__));
285283

286284
SWIFT_RT_ENTRY_VISIBILITY
287285
extern "C"

stdlib/public/runtime/Leaks.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ struct HeapObject;
2929

3030
SWIFT_RUNTIME_EXPORT
3131
extern "C" void swift_leaks_startTrackingObjects(const char *)
32-
__attribute__((noinline, used));
32+
__attribute__((__noinline__, __used__));
3333
SWIFT_RUNTIME_EXPORT
3434
extern "C" int swift_leaks_stopTrackingObjects(const char *)
35-
__attribute__((noinline, used));
35+
__attribute__((__noinline__, __used__));
3636
SWIFT_RUNTIME_EXPORT
3737
extern "C" void swift_leaks_startTrackingObject(swift::HeapObject *)
38-
__attribute__((noinline, used));
38+
__attribute__((__noinline__, __used__));
3939
SWIFT_RUNTIME_EXPORT
4040
extern "C" void swift_leaks_stopTrackingObject(swift::HeapObject *)
41-
__attribute__((noinline, used));
41+
__attribute__((__noinline__, __used__));
4242

4343
#define SWIFT_LEAKS_START_TRACKING_OBJECT(obj) \
4444
swift_leaks_startTrackingObject(obj)

stdlib/public/runtime/SwiftObject.mm

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
using namespace swift;
4848

4949
#if SWIFT_HAS_ISA_MASKING
50-
OBJC_EXPORT __attribute__((weak_import))
50+
OBJC_EXPORT __attribute__((__weak_import__))
5151
const uintptr_t objc_debug_isa_class_mask;
5252

5353
static uintptr_t computeISAMask() {
@@ -75,9 +75,9 @@ static uintptr_t computeISAMask() {
7575

7676
#if SWIFT_OBJC_INTEROP
7777
struct SwiftObject_s {
78-
void *isa __attribute__((unavailable));
79-
uint32_t strongRefCount __attribute__((unavailable));
80-
uint32_t weakRefCount __attribute__((unavailable));
78+
void *isa __attribute__((__unavailable__));
79+
uint32_t strongRefCount __attribute__((__unavailable__));
80+
uint32_t weakRefCount __attribute__((__unavailable__));
8181
};
8282

8383
static_assert(sizeof(SwiftObject_s) == sizeof(HeapObject),
@@ -88,10 +88,9 @@ static uintptr_t computeISAMask() {
8888
"SwiftObject must be trivially destructible");
8989

9090
#if __has_attribute(objc_root_class)
91-
__attribute__((objc_root_class))
91+
__attribute__((__objc_root_class__))
9292
#endif
93-
SWIFT_RUNTIME_EXPORT
94-
@interface SwiftObject<NSObject> {
93+
SWIFT_RUNTIME_EXPORT @interface SwiftObject<NSObject> {
9594
SwiftObject_s header;
9695
}
9796

0 commit comments

Comments
 (0)