Skip to content

Commit b291707

Browse files
committed
Prefer __GLIBC__ check over individual platforms in Stubs.cpp
1 parent 6845910 commit b291707

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

Sources/_TestingInternals/Stubs.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@
1717
/// include functions here if Swift cannot successfully import and call them
1818
/// otherwise.
1919

20-
#if defined(__linux__) || defined(__FreeBSD__)
2120
#undef _DEFAULT_SOURCE
2221
#define _DEFAULT_SOURCE 1
2322
#undef _GNU_SOURCE
2423
#define _GNU_SOURCE 1
25-
#endif
2624

2725
#include "Stubs.h"
2826

@@ -32,7 +30,7 @@ int swt_pthread_setname_np(pthread_t thread, const char *name) {
3230
}
3331
#endif
3432

35-
#if defined(__linux__) || defined(__FreeBSD__)
33+
#if defined(__GLIBC__)
3634
int swt_posix_spawn_file_actions_addclosefrom_np(posix_spawn_file_actions_t *fileActions, int from) {
3735
int result = 0;
3836

Sources/_TestingInternals/include/Stubs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ static char *_Nullable *_Null_unspecified swt_environ(void) {
118118
SWT_EXTERN int swt_pthread_setname_np(pthread_t thread, const char *name);
119119
#endif
120120

121-
#if defined(__linux__) || defined(__FreeBSD__)
121+
#if defined(__GLIBC__)
122122
/// Close file descriptors above a given value when spawing a new process.
123123
///
124124
/// This symbol is provided because the underlying function was added to glibc

0 commit comments

Comments
 (0)