|
15 | 15 |
|
16 | 16 | // stdint.h is provided by Clang, but it dispatches to libc's stdint.h. As a |
17 | 17 | // result, using stdint.h here would pull in Darwin module (which includes |
18 | | -// libc). This creates a dependency cycle, so we can't use stdint.h in |
| 18 | +// libc). This creates a dependency cycle, so we can't use stdint.h in |
19 | 19 | // SwiftShims. |
| 20 | +// On Linux, the story is different. We get the error message |
| 21 | +// "/usr/include/x86_64-linux-gnu/sys/types.h:146:10: error: 'stddef.h' file not |
| 22 | +// found" |
| 23 | +// This is a known Clang/Ubuntu bug. |
20 | 24 |
|
21 | 25 | // Clang has been defining __INTxx_TYPE__ macros for a long time. |
22 | 26 | // __UINTxx_TYPE__ are defined only since Clang 3.5. |
23 | | - |
| 27 | +#if !defined(__APPLE__) && !defined(__linux__) |
| 28 | +#include <stdint.h> |
| 29 | +typedef int64_t __swift_int64_t; |
| 30 | +typedef uint64_t __swift_uint64_t; |
| 31 | +typedef int32_t __swift_int32_t; |
| 32 | +typedef uint32_t __swift_uint32_t; |
| 33 | +typedef int16_t __swift_int16_t; |
| 34 | +typedef uint16_t __swift_uint16_t; |
| 35 | +typedef int8_t __swift_int8_t; |
| 36 | +typedef uint8_t __swift_uint8_t; |
| 37 | +typedef intptr_t __swift_intptr_t; |
| 38 | +typedef uintptr_t __swift_uintptr_t; |
| 39 | +#else |
24 | 40 | typedef __INT64_TYPE__ __swift_int64_t; |
25 | 41 | #ifdef __UINT64_TYPE__ |
26 | 42 | typedef __UINT64_TYPE__ __swift_uint64_t; |
@@ -56,6 +72,6 @@ typedef unsigned __INT8_TYPE__ __swift_uint8_t; |
56 | 72 |
|
57 | 73 | typedef __swift_intn_t(__INTPTR_WIDTH__) __swift_intptr_t; |
58 | 74 | typedef __swift_uintn_t(__INTPTR_WIDTH__) __swift_uintptr_t; |
| 75 | +#endif |
59 | 76 |
|
60 | 77 | #endif // SWIFT_STDLIB_SHIMS_SWIFT_STDINT_H |
61 | | - |
|
0 commit comments