Skip to content

Commit bb34e2a

Browse files
committed
Fix attribute fallout from new refcount representation
1 parent df4b775 commit bb34e2a

File tree

5 files changed

+29
-15
lines changed

5 files changed

+29
-15
lines changed

include/swift/Runtime/Config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#ifndef SWIFT_RUNTIME_CONFIG_H
1818
#define SWIFT_RUNTIME_CONFIG_H
1919

20+
#include "llvm/Support/Compiler.h"
21+
2022
/// Does the current Swift platform support "unbridged" interoperation
2123
/// with Objective-C? If so, the implementations of various types must
2224
/// implicitly handle Objective-C pointers.

stdlib/public/SwiftShims/LibcShims.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,35 +91,35 @@ __swift_uint32_t
9191
_swift_stdlib_cxx11_mt19937_uniform(__swift_uint32_t upper_bound);
9292

9393
// Math library functions
94-
static inline __attribute__((always_inline))
94+
static inline SWIFT_ALWAYS_INLINE
9595
float _swift_stdlib_remainderf(float _self, float _other) {
9696
return __builtin_remainderf(_self, _other);
9797
}
9898

99-
static inline __attribute__((always_inline))
99+
static inline SWIFT_ALWAYS_INLINE
100100
float _swift_stdlib_squareRootf(float _self) {
101101
return __builtin_sqrt(_self);
102102
}
103103

104-
static inline __attribute__((always_inline))
104+
static inline SWIFT_ALWAYS_INLINE
105105
double _swift_stdlib_remainder(double _self, double _other) {
106106
return __builtin_remainder(_self, _other);
107107
}
108108

109-
static inline __attribute__((always_inline))
109+
static inline SWIFT_ALWAYS_INLINE
110110
double _swift_stdlib_squareRoot(double _self) {
111111
return __builtin_sqrt(_self);
112112
}
113113

114114
// TODO: Remove horrible workaround when importer does Float80 <-> long double.
115115
#if (defined __i386__ || defined __x86_64__) && !defined _MSC_VER
116-
static inline __attribute__((always_inline))
116+
static inline SWIFT_ALWAYS_INLINE
117117
void _swift_stdlib_remainderl(void *_self, const void *_other) {
118118
long double *_f80self = (long double *)_self;
119119
*_f80self = __builtin_remainderl(*_f80self, *(const long double *)_other);
120120
}
121121

122-
static inline __attribute__((always_inline))
122+
static inline SWIFT_ALWAYS_INLINE
123123
void _swift_stdlib_squareRootl(void *_self) {
124124
long double *_f80self = (long double *)_self;
125125
*_f80self = __builtin_sqrtl(*_f80self);
@@ -135,4 +135,3 @@ void _swift_stdlib_squareRootl(void *_self) {
135135
#endif
136136

137137
#endif // SWIFT_STDLIB_SHIMS_LIBCSHIMS_H
138-

stdlib/public/SwiftShims/RefCount.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#ifndef SWIFT_STDLIB_SHIMS_REFCOUNT_H
1313
#define SWIFT_STDLIB_SHIMS_REFCOUNT_H
1414

15+
#include "Visibility.h"
16+
1517
#if !defined(__cplusplus)
1618

1719
// These definitions are placeholders for importing into Swift.
@@ -20,7 +22,7 @@
2022
#include "SwiftStdint.h"
2123

2224
typedef struct {
23-
__swift_uint64_t refCounts __attribute__((__unavailable__));
25+
__swift_uint64_t refCounts SWIFT_ATTRIBUTE_UNAVAILABLE;
2426
} InlineRefCounts;
2527

2628
// not __cplusplus
@@ -191,10 +193,9 @@ namespace swift {
191193
}
192194

193195
// FIXME: HACK: copied from HeapObject.cpp
194-
extern "C" LLVM_LIBRARY_VISIBILITY void
195-
_swift_release_dealloc(swift::HeapObject *object)
196-
SWIFT_CC(RegisterPreservingCC_IMPL)
197-
__attribute__((__noinline__, __used__));
196+
extern "C" LLVM_LIBRARY_VISIBILITY LLVM_ATTRIBUTE_NOINLINE LLVM_ATTRIBUTE_USED
197+
void _swift_release_dealloc(swift::HeapObject *object)
198+
SWIFT_CC(RegisterPreservingCC_IMPL);
198199

199200
namespace swift {
200201

stdlib/public/SwiftShims/UnicodeShims.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,21 @@ const __swift_uint16_t *
6363
_swift_stdlib_ExtendedGraphemeClusterNoBoundaryRulesMatrix;
6464

6565
SWIFT_RUNTIME_STDLIB_INTERFACE
66-
__attribute__((__pure__)) __swift_int32_t
66+
SWIFT_READONLY __swift_int32_t
6767
_swift_stdlib_unicode_compare_utf16_utf16(const __swift_uint16_t *Left,
6868
__swift_int32_t LeftLength,
6969
const __swift_uint16_t *Right,
7070
__swift_int32_t RightLength);
7171

7272
SWIFT_RUNTIME_STDLIB_INTERFACE
73-
__attribute__((__pure__)) __swift_int32_t
73+
SWIFT_READONLY __swift_int32_t
7474
_swift_stdlib_unicode_compare_utf8_utf16(const unsigned char *Left,
7575
__swift_int32_t LeftLength,
7676
const __swift_uint16_t *Right,
7777
__swift_int32_t RightLength);
7878

7979
SWIFT_RUNTIME_STDLIB_INTERFACE
80-
__attribute__((__pure__)) __swift_int32_t
80+
SWIFT_READONLY __swift_int32_t
8181
_swift_stdlib_unicode_compare_utf8_utf8(const unsigned char *Left,
8282
__swift_int32_t LeftLength,
8383
const unsigned char *Right,

stdlib/public/SwiftShims/Visibility.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,18 @@
5656
#define SWIFT_READNONE
5757
#endif
5858

59+
#if __has_attribute(always_inline)
60+
#define SWIFT_ALWAYS_INLINE __attribute__((always_inline))
61+
#else
62+
#define SWIFT_ALWAYS_INLINE
63+
#endif
64+
65+
#if __has_attribute(unavailable)
66+
#define SWIFT_ATTRIBUTE_UNAVAILABLE __attribute__((__unavailable__))
67+
#else
68+
#define SWIFT_ATTRIBUTE_UNAVAILABLE
69+
#endif
70+
5971
// TODO: support using shims headers in overlays by parameterizing
6072
// SWIFT_RUNTIME_EXPORT on the library it's exported from, then setting
6173
// protected vs. default based on the current value of __SWIFT_CURRENT_DYLIB.

0 commit comments

Comments
 (0)