File: Includes.h

package info (click to toggle)
swiftlang 6.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,532 kB
  • sloc: cpp: 9,901,743; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (154 lines) | stat: -rw-r--r-- 3,629 bytes parent folder | download
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
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2023 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 Swift project authors
//

#if !defined(SWT_INCLUDES_H)
#define SWT_INCLUDES_H

/// This header includes other headers (either those from the C standard library
/// or platform-specific headers) that are used by the testing library.
///
/// Include any headers here from the C standard library that are needed by the
/// testing library. Because the C standard library cannot be directly imported
/// into Swift without introducing a module dependency (and because the name of
/// that module varies on a platform-by-platform basis), we instead include C
/// standard library headers _à la carte_. Symbols from these headers are then
/// imported into Swift when a Swift file imports the `_TestingInternals` module.
///
/// Also include any platform-specific headers here that are needed by the
/// testing library.
///
/// - Note: Avoid including headers that aren't actually used.

#include <errno.h>
#include <inttypes.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 __has_include(<signal.h>) && !defined(__wasi__)
#include <signal.h>
#endif
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#if __has_include(<unistd.h>)
#include <unistd.h>
#endif

#if __has_include(<fcntl.h>)
#include <fcntl.h>
#elif __has_include(<sys/fcntl.h>)
#include <sys/fcntl.h>
#endif

#if __has_include(<sys/resource.h>) && !defined(__wasi__)
#include <sys/resource.h>
#endif

#if __has_include(<sys/stat.h>)
#include <sys/stat.h>
#endif

#if __has_include(<sys/sysctl.h>) && !defined(__linux__)
#include <sys/sysctl.h>
#endif

#if __has_include(<sys/wait.h>)
#include <sys/wait.h>
#endif

#if __has_include(<sys/utsname.h>)
#include <sys/utsname.h>
#endif

#if __has_include(<execinfo.h>)
#include <execinfo.h>
#endif

#if __has_include(<pthread.h>)
#include <pthread.h>
#endif

#if __has_include(<pty.h>)
#include <pty.h>
#endif

#if __has_include(<pwd.h>)
#include <pwd.h>
#endif

#if __has_include(<limits.h>)
#include <limits.h>
#endif

#if __has_include(<spawn.h>)
#include <spawn.h>
#endif

#if __has_include(<crt_externs.h>)
#include <crt_externs.h>
#endif

#if __has_include(<libgen.h>)
#include <libgen.h>
#endif

#if __has_include(<dlfcn.h>)
#include <dlfcn.h>
#endif

#if __has_include(<sysexits.h>)
#include <sysexits.h>
#endif

// MARK: - Platform-specific includes

#if defined(__APPLE__)
#if !SWT_NO_MACH_PORTS
#include <mach/mach_init.h>
#include <mach/task.h>
#endif

#if !SWT_NO_LIBDISPATCH
#include <dispatch/dispatch.h>
#endif
#endif

#if defined(_WIN32)
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <Windows.h>
#include <ntstatus.h>
#include <Psapi.h>
#endif

#if defined(__wasi__)
#if __has_include(<wasi/libc-environ.h>)
#include <wasi/libc-environ.h>
#endif

#if __has_include(<wasi/version.h>)
#include <wasi/version.h>
#endif
#endif

#if defined(__ANDROID__)
#if defined(__swift__)
// The linux/stat header is private in the Android modulemap.
#pragma clang module import posix_filesystem.linux_stat
#endif
#include <sys/system_properties.h>
#endif

#endif