Skip to content

Commit 9295346

Browse files
authored
Merge pull request #339 from compnerd/unistd
protect unistd.h inclusion with HAVE_UNISTD_H
2 parents b5ec5d8 + 40bf583 commit 9295346

34 files changed

+61
-7
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ check_include_files("strings.h" HAVE_STRINGS_H)
221221
check_include_files("sys/guarded.h" HAVE_SYS_GUARDED_H)
222222
check_include_files("sys/stat.h" HAVE_SYS_STAT_H)
223223
check_include_files("sys/types.h" HAVE_SYS_TYPES_H)
224-
check_include_files("unistd.h" HAVE_UNISTD_H)
225224
check_include_files("objc/objc-internal.h" HAVE_OBJC)
226225

227226
if(HAVE_MACH)

cmake/config.h.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,6 @@
192192
/* Define to 1 if you have the <TargetConditionals.h> header file. */
193193
#cmakedefine HAVE_TARGETCONDITIONALS_H
194194

195-
/* Define to 1 if you have the <unistd.h> header file. */
196-
#cmakedefine01 HAVE_UNISTD_H
197-
198195
/* Define to 1 if you have the `_pthread_workqueue_init' function. */
199196
#cmakedefine HAVE__PTHREAD_WORKQUEUE_INIT
200197

dispatch/dispatch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#include <stdint.h>
3636
#include <stdbool.h>
3737
#include <stdarg.h>
38-
#if !defined(HAVE_UNISTD_H) || HAVE_UNISTD_H
38+
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
3939
#include <unistd.h>
4040
#endif
4141
#include <fcntl.h>

private/private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#include <mach/mach.h>
4242
#include <mach/message.h>
4343
#endif
44-
#if HAVE_UNISTD_H
44+
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
4545
#include <unistd.h>
4646
#endif
4747
#include <pthread.h>

src/internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ DISPATCH_EXPORT DISPATCH_NOTHROW void dispatch_atfork_child(void);
285285
#include <stdio.h>
286286
#include <stdlib.h>
287287
#include <string.h>
288-
#if HAVE_UNISTD_H
288+
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
289289
#include <unistd.h>
290290
#endif
291291

src/queue.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,9 @@ libdispatch_init(void)
903903
}
904904

905905
#if DISPATCH_USE_THREAD_LOCAL_STORAGE
906+
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
906907
#include <unistd.h>
908+
#endif
907909
#include <sys/syscall.h>
908910

909911
#ifndef __ANDROID__

tests/Foundation/bench.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
#include <stdlib.h>
3232
#include <stdint.h>
3333
#include <stdbool.h>
34+
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
3435
#include <unistd.h>
36+
#endif
3537
#include <assert.h>
3638
#include <errno.h>
3739
#include <pthread.h>

tests/bsdtestharness.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
#include <spawn.h>
2424
#include <stdio.h>
2525
#include <stdlib.h>
26+
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
2627
#include <unistd.h>
28+
#endif
2729
#include <signal.h>
2830
#ifdef __APPLE__
2931
#include <mach/clock_types.h>

tests/bsdtests.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
#include <stdarg.h>
2626
#include <stdio.h>
2727
#include <stdlib.h>
28+
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
2829
#include <unistd.h>
30+
#endif
2931
#include <errno.h>
3032
#include <sys/errno.h>
3133
#include <sys/wait.h>

tests/bsdtests.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@
4141
#include <CoreFoundation/CoreFoundation.h>
4242
#endif
4343

44+
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
4445
#include <unistd.h>
46+
#endif
4547
#include <string.h>
4648
#include <stdint.h>
4749

0 commit comments

Comments
 (0)