Skip to content

protect unistd.h inclusion with HAVE_UNISTD_H #339

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ check_include_files("strings.h" HAVE_STRINGS_H)
check_include_files("sys/guarded.h" HAVE_SYS_GUARDED_H)
check_include_files("sys/stat.h" HAVE_SYS_STAT_H)
check_include_files("sys/types.h" HAVE_SYS_TYPES_H)
check_include_files("unistd.h" HAVE_UNISTD_H)
check_include_files("objc/objc-internal.h" HAVE_OBJC)

if(HAVE_MACH)
Expand Down
3 changes: 0 additions & 3 deletions cmake/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,6 @@
/* Define to 1 if you have the <TargetConditionals.h> header file. */
#cmakedefine HAVE_TARGETCONDITIONALS_H

/* Define to 1 if you have the <unistd.h> header file. */
#cmakedefine01 HAVE_UNISTD_H

/* Define to 1 if you have the `_pthread_workqueue_init' function. */
#cmakedefine HAVE__PTHREAD_WORKQUEUE_INIT

Expand Down
2 changes: 1 addition & 1 deletion dispatch/dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <stdint.h>
#include <stdbool.h>
#include <stdarg.h>
#if !defined(HAVE_UNISTD_H) || HAVE_UNISTD_H
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#include <fcntl.h>
Expand Down
2 changes: 1 addition & 1 deletion private/private.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include <mach/mach.h>
#include <mach/message.h>
#endif
#if HAVE_UNISTD_H
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#include <pthread.h>
Expand Down
2 changes: 1 addition & 1 deletion src/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ DISPATCH_EXPORT DISPATCH_NOTHROW void dispatch_atfork_child(void);
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if HAVE_UNISTD_H
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif

Expand Down
2 changes: 2 additions & 0 deletions src/queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,9 @@ libdispatch_init(void)
}

#if DISPATCH_USE_THREAD_LOCAL_STORAGE
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#include <sys/syscall.h>

#ifndef __ANDROID__
Expand Down
2 changes: 2 additions & 0 deletions tests/Foundation/bench.mm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#include <assert.h>
#include <errno.h>
#include <pthread.h>
Expand Down
2 changes: 2 additions & 0 deletions tests/bsdtestharness.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
#include <spawn.h>
#include <stdio.h>
#include <stdlib.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#include <signal.h>
#ifdef __APPLE__
#include <mach/clock_types.h>
Expand Down
2 changes: 2 additions & 0 deletions tests/bsdtests.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#include <errno.h>
#include <sys/errno.h>
#include <sys/wait.h>
Expand Down
2 changes: 2 additions & 0 deletions tests/bsdtests.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
#include <CoreFoundation/CoreFoundation.h>
#endif

#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#include <string.h>
#include <stdint.h>

Expand Down
2 changes: 2 additions & 0 deletions tests/cffd.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@

#include <stdio.h>
#include <stdlib.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#include <string.h>
#include <sys/param.h>
#include <sys/ucred.h>
Expand Down
2 changes: 2 additions & 0 deletions tests/dispatch_after.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@

#include <dispatch/dispatch.h>
#include <stdio.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#include <stdlib.h>
#include <assert.h>
#ifdef __APPLE__
Expand Down
2 changes: 2 additions & 0 deletions tests/dispatch_apply.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@

#include <dispatch/dispatch.h>
#include <stdio.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#include <stdlib.h>
#include <assert.h>
#ifdef __APPLE__
Expand Down
2 changes: 2 additions & 0 deletions tests/dispatch_cascade.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@

#include <stdio.h>
#include <dispatch/dispatch.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#include <stdlib.h>

#include <bsdtests.h>
Expand Down
2 changes: 2 additions & 0 deletions tests/dispatch_concur.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@

#include <dispatch/dispatch.h>
#include <dispatch/private.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
Expand Down
2 changes: 2 additions & 0 deletions tests/dispatch_context_for_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
#include <dispatch/dispatch.h>
#include <stdlib.h>
#include <stdio.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#include <assert.h>

#include <bsdtests.h>
Expand Down
2 changes: 2 additions & 0 deletions tests/dispatch_deadname.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
#include <mach/mach.h>
#endif
#include <stdio.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#include <stdlib.h>
#include <assert.h>

Expand Down
2 changes: 2 additions & 0 deletions tests/dispatch_drift.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
#endif
#include <dispatch/dispatch.h>
#include <sys/time.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#ifdef __APPLE__
Expand Down
2 changes: 2 additions & 0 deletions tests/dispatch_group.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
*/

#include <dispatch/dispatch.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down
2 changes: 2 additions & 0 deletions tests/dispatch_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#include <errno.h>
#include <fts.h>
#ifdef __APPLE__
Expand Down
2 changes: 2 additions & 0 deletions tests/dispatch_io_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@

#include <stdio.h>
#include <stdlib.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#include <errno.h>
#include <netdb.h>
#include <sys/types.h>
Expand Down
2 changes: 2 additions & 0 deletions tests/dispatch_overcommit.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
#include <dispatch/dispatch.h>
#include <dispatch/private.h>
#include <stdio.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#include <stdlib.h>
#include <assert.h>
#ifdef __APPLE__
Expand Down
2 changes: 2 additions & 0 deletions tests/dispatch_priority.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
#include <stdio.h>
#include <dispatch/dispatch.h>
#include <dispatch/private.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#include <stdlib.h>
#include <assert.h>
#ifdef __APPLE__
Expand Down
2 changes: 2 additions & 0 deletions tests/dispatch_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@

#include <dispatch/dispatch.h>
#include <stdio.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#include <stdlib.h>
#include <assert.h>
#include <spawn.h>
Expand Down
2 changes: 2 additions & 0 deletions tests/dispatch_queue_finalizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
*/

#include <dispatch/dispatch.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down
2 changes: 2 additions & 0 deletions tests/dispatch_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#include <errno.h>

#include <dispatch/dispatch.h>
Expand Down
2 changes: 2 additions & 0 deletions tests/dispatch_read2.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#include <errno.h>
#include <fts.h>
#ifdef __APPLE__
Expand Down
2 changes: 2 additions & 0 deletions tests/dispatch_readsync.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
#include <dispatch/dispatch.h>
#include <dispatch/private.h>
#include <stdlib.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#ifdef __ANDROID__
#include <linux/sysctl.h>
#else
Expand Down
2 changes: 2 additions & 0 deletions tests/dispatch_select.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#include <sys/stat.h>
#include <dispatch/dispatch.h>

Expand Down
2 changes: 2 additions & 0 deletions tests/dispatch_sema.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
*/

#include <dispatch/dispatch.h>
#if !USE_WIN32_SEM
#include <pthread.h>
#endif
#include <stdio.h>
#include <assert.h>

Expand Down
2 changes: 2 additions & 0 deletions tests/dispatch_sync_on_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
#include <dispatch/private.h>
#include <stdlib.h>
#include <stdio.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#include <CoreFoundation/CoreFoundation.h>

#include <bsdtests.h>
Expand Down
2 changes: 2 additions & 0 deletions tests/dispatch_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@

#include <stdlib.h>
#include <stdio.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#if __has_include(<sys/event.h>)
#define HAS_SYS_EVENT_H 1
#include <sys/event.h>
Expand Down
2 changes: 2 additions & 0 deletions tests/dispatch_vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
#include <sys/event.h>
#include <stdio.h>
#include <stdlib.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif
#ifdef __APPLE__
#include <libkern/OSAtomic.h>
#endif
Expand Down
2 changes: 2 additions & 0 deletions tests/dispatch_vnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#endif

#include <dispatch/dispatch.h>

Expand Down