Skip to content

Commit a920e51

Browse files
committed
os: update unix and windows base.h
This adds additional macros from base.h to the windows and unix variants to allow building dispatch on non-Apple targets. This ensures that we have: - `SPI_AVAILABLE` - `SPI_DEPRECATED` - `OS_REFINED_FOR_SWIFT` - `OS_SWIFT_NAME` consistently across all the targets.
1 parent a28a09c commit a920e51

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

os/generic_unix_base.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@
4040
#define API_DEPRECATED_WITH_REPLACEMENT(...)
4141
#endif
4242

43+
#ifndef SPI_AVAILABLE
44+
#define SPI_AVAILABLE(...)
45+
#endif
46+
47+
#ifndef SPI_DEPRECATED
48+
#define SPI_DEPRECATED(...)
49+
#endif
50+
4351
#if __GNUC__
4452
#define OS_EXPECT(x, v) __builtin_expect((x), (v))
4553
#define OS_UNUSED __attribute__((__unused__))

os/generic_win_base.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ typedef void pthread_attr_t;
4646
#define API_DEPRECATED_WITH_REPLACEMENT(...)
4747
#endif
4848

49+
#ifndef SPI_AVAILABLE
50+
#define SPI_AVAILABLE(...)
51+
#endif
52+
53+
#ifndef SPI_DEPRECATED
54+
#define SPI_DEPRECATED(...)
55+
#endif
56+
4957
#if !defined(__has_attribute)
5058
#define __has_attribute(attibute) 0
5159
#endif
@@ -99,6 +107,18 @@ typedef void pthread_attr_t;
99107
#define OS_SWIFT_UNAVAILABLE(msg)
100108
#endif
101109

110+
#if __has_attribute(swift_private)
111+
# define OS_REFINED_FOR_SWIFT __attribute__((__swift_private__))
112+
#else
113+
# define OS_REFINED_FOR_SWIFT
114+
#endif
115+
116+
#if __has_attribute(swift_name)
117+
# define OS_SWIFT_NAME(_name) __attribute__((__swift_name__(#_name)))
118+
#else
119+
# define OS_SWIFT_NAME(_name)
120+
#endif
121+
102122
#define __OS_STRINGIFY(s) #s
103123
#define OS_STRINGIFY(s) __OS_STRINGIFY(s)
104124

0 commit comments

Comments
 (0)