forked from swiftlang/swift-foundation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_CStdlib.h
168 lines (130 loc) · 3.33 KB
/
_CStdlib.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2022 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
#ifndef FOUNDATION_CSTDLIB
#define FOUNDATION_CSTDLIB
#include "_CShimsTargetConditionals.h"
#if __has_include(<assert.h>)
#include <assert.h>
#endif
#if __has_include(<ctype.h>)
#include <ctype.h>
#endif
#if __has_include(<errno.h>)
#include <errno.h>
#endif
#if __has_include(<fenv.h>)
#include <fenv.h>
#endif
#if __has_include(<float.h>)
#include <float.h>
#endif
#if __has_include(<inttypes.h>)
#include <inttypes.h>
#endif
#if __has_include(<iso646.h>)
#include <iso646.h>
#endif
#if __has_include(<limits.h>)
#include <limits.h>
#endif
#if __has_include(<locale.h>)
#include <locale.h>
#endif
#if __has_include(<math.h>)
#include <math.h>
#endif
#if __has_include(<signal.h>)
/// Guard against including `signal.h` on WASI. The `signal.h` header file
/// itself is available in wasi-libc, but it's just a stub that doesn't actually
/// do anything. And also including it requires a special macro definition
/// (`_WASI_EMULATED_SIGNAL`) and it causes compilation errors without the macro.
# if !TARGET_OS_WASI || defined(_WASI_EMULATED_SIGNAL)
# include <signal.h>
# endif
#endif
#if __has_include(<sys/mman.h>)
/// Similar to `signal.h`, guard against including `sys/mman.h` on WASI unless
/// `_WASI_EMULATED_MMAN` is enabled.
# if !TARGET_OS_WASI || defined(_WASI_EMULATED_MMAN)
# include <sys/mman.h>
# endif
#endif
#if __has_include(<stdalign.h>)
#include <stdalign.h>
#endif
#if __has_include(<stdarg.h>)
#include <stdarg.h>
#endif
#if __has_include(<stdbool.h>)
#include <stdbool.h>
#endif
#if __has_include(<stddef.h>)
#include <stddef.h>
#endif
#if __has_include(<stdint.h>)
#include <stdint.h>
#endif
#if __has_include(<stdio.h>)
#include <stdio.h>
#endif
#if __has_include(<stdlib.h>)
#include <stdlib.h>
#endif
#if __has_include(<stdnoreturn.h>)
#include <stdnoreturn.h>
#endif
#if __has_include(<string.h>)
#include <string.h>
#endif
#if !defined(_WIN32)
#if __has_include(<tgmath.h>)
#include <tgmath.h>
#endif
#endif
#if __has_include(<time.h>)
#include <time.h>
#endif
#if __has_include(<wchar.h>)
#include <wchar.h>
#endif
#if __has_include(<wctype.h>)
#include <wctype.h>
#endif
#if __has_include(<complex.h>)
#include <complex.h>
#endif
#if __has_include(<threads.h>)
#include <threads.h>
#endif
#if __has_include(<uchar.h>)
#include <uchar.h>
#endif
#if __has_include(<stdint.h>)
#include <stdint.h>
#endif
#if __has_include(<tzfile.h>)
#include <tzfile.h>
#else
#if TARGET_OS_MAC || TARGET_OS_LINUX || TARGET_OS_BSD
#ifndef TZDIR
#define TZDIR "/usr/share/zoneinfo/" /* Time zone object file directory */
#endif /* !defined TZDIR */
#ifndef TZDEFAULT
#define TZDEFAULT "/etc/localtime"
#endif /* !defined TZDEFAULT */
#elif TARGET_OS_WINDOWS
/* not required */
#else
#error "possibly define TZDIR and TZDEFAULT for this platform"
#endif /* TARGET_OS_MAC || TARGET_OS_LINUX || TARGET_OS_BSD */
#endif
#endif // FOUNDATION_CSTDLIB