>From 2ffa18f1cb4322246c083f3b8fe8202fe4dfe466 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 8 Jun 2010 10:01:19 +0200 Subject: [PATCH 1/2] move system file inclusions to src/private.h and testing/system.h --- src/internal.h | 60 ------------------------------------- src/private.h | 57 +++++++++++++++++++++++++++++++++++ testing/bench.mm | 14 +-------- testing/dispatch_after.c | 5 +-- testing/dispatch_api.c | 4 +-- testing/dispatch_apply.c | 7 +---- testing/dispatch_c99.c | 3 +- testing/dispatch_cascade.c | 5 +-- testing/dispatch_cffd.c | 15 +-------- testing/dispatch_debug.c | 6 +--- testing/dispatch_drift.c | 6 +--- testing/dispatch_group.c | 7 +---- testing/dispatch_pingpong.c | 3 +- testing/dispatch_priority.c | 6 +--- testing/dispatch_proc.c | 7 +---- testing/dispatch_read.c | 8 +---- testing/dispatch_readsync.c | 7 +---- testing/dispatch_sema.c | 5 +-- testing/dispatch_starfish.c | 4 +-- testing/dispatch_test.c | 10 +----- testing/dispatch_timer_bit31.c | 7 +---- testing/dispatch_timer_bit63.c | 7 +---- testing/dispatch_timer_set_time.c | 6 +--- testing/fd_stress.c | 11 +------ testing/harness.c | 7 +---- testing/queue_finalizer.c | 8 +---- testing/summarize.c | 5 +-- testing/system.h | 47 +++++++++++++++++++++++++++++ 28 files changed, 129 insertions(+), 208 deletions(-) create mode 100644 testing/system.h diff --git a/src/internal.h b/src/internal.h index c72e827..1789bc9 100644 --- a/src/internal.h +++ b/src/internal.h @@ -60,66 +60,6 @@ #endif -#if HAVE_LIBKERN_OSCROSSENDIAN_H -#include -#endif -#if HAVE_LIBKERN_OSATOMIC_H -#include -#endif -#if HAVE_MACH -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#endif /* HAVE_MACH */ -#if HAVE_MALLOC_MALLOC_H -#include -#endif -#include -#include -#include -#if HAVE_SYS_SYSCTL_H -#include -#endif -#include -#include -#include - -#ifdef __BLOCKS__ -#include -#include -#endif /* __BLOCKS__ */ - -#include -#include -#include -#include -#include -#if USE_POSIX_SEM -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#if HAVE_UNISTD_H -#include -#endif - #define DISPATCH_NOINLINE __attribute__((noinline)) // workaround 6368156 diff --git a/src/private.h b/src/private.h index dcdf968..17875e2 100644 --- a/src/private.h +++ b/src/private.h @@ -40,6 +40,63 @@ #endif #include +#if HAVE_LIBKERN_OSCROSSENDIAN_H +#include +#endif +#if HAVE_LIBKERN_OSATOMIC_H +#include +#endif +#if HAVE_MACH +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif /* HAVE_MACH */ +#if HAVE_MALLOC_MALLOC_H +#include +#endif +#include +#include +#include +#if HAVE_SYS_SYSCTL_H +#include +#endif +#include +#include +#include + +#ifdef __BLOCKS__ +#include +#include +#endif /* __BLOCKS__ */ + +#include +#include +#include +#include +#include +#if USE_POSIX_SEM +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include + #ifndef __DISPATCH_BUILDING_DISPATCH__ #include_next diff --git a/testing/bench.mm b/testing/bench.mm index bb34671..c6d24a0 100644 --- a/testing/bench.mm +++ b/testing/bench.mm @@ -20,21 +20,9 @@ #include #include -#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef __BLOCKS__ -#include -#endif +#include "system.h" #include #include diff --git a/testing/dispatch_after.c b/testing/dispatch_after.c index c8b0f3f..f706401 100644 --- a/testing/dispatch_after.c +++ b/testing/dispatch_after.c @@ -20,11 +20,8 @@ #include "config/config.h" +#include "system.h" #include -#include -#include -#include -#include #include "dispatch_test.h" #include diff --git a/testing/dispatch_api.c b/testing/dispatch_api.c index 77b7f96..cc33972 100644 --- a/testing/dispatch_api.c +++ b/testing/dispatch_api.c @@ -20,10 +20,8 @@ #include "config/config.h" -#include - +#include "system.h" #include - #include "dispatch_test.h" void diff --git a/testing/dispatch_apply.c b/testing/dispatch_apply.c index 45c5f17..ad26594 100644 --- a/testing/dispatch_apply.c +++ b/testing/dispatch_apply.c @@ -22,12 +22,7 @@ #include #include "src/hw_shims.h" - -#include -#include -#include -#include - +#include "system.h" #include "dispatch_test.h" int diff --git a/testing/dispatch_c99.c b/testing/dispatch_c99.c index 4ab43cc..e2dbcdb 100644 --- a/testing/dispatch_c99.c +++ b/testing/dispatch_c99.c @@ -21,8 +21,7 @@ #include "config/config.h" #include -#include - +#include "system.h" #include "dispatch_test.h" void diff --git a/testing/dispatch_cascade.c b/testing/dispatch_cascade.c index 91eecfb..d21c7f9 100644 --- a/testing/dispatch_cascade.c +++ b/testing/dispatch_cascade.c @@ -20,11 +20,8 @@ #include "config/config.h" -#include #include -#include -#include - +#include "system.h" #include "dispatch_test.h" int done = 0; diff --git a/testing/dispatch_cffd.c b/testing/dispatch_cffd.c index 3b46fc9..4758f2a 100644 --- a/testing/dispatch_cffd.c +++ b/testing/dispatch_cffd.c @@ -21,20 +21,7 @@ #include "config/config.h" #include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - +#include "system.h" #include #include "dispatch_test.h" diff --git a/testing/dispatch_debug.c b/testing/dispatch_debug.c index a0add94..e77d63e 100644 --- a/testing/dispatch_debug.c +++ b/testing/dispatch_debug.c @@ -20,12 +20,8 @@ #include "config/config.h" -#include -#include -#include - +#include "system.h" #include - #include "dispatch_test.h" int diff --git a/testing/dispatch_drift.c b/testing/dispatch_drift.c index 490e961..0f0d3c4 100644 --- a/testing/dispatch_drift.c +++ b/testing/dispatch_drift.c @@ -21,11 +21,7 @@ #include "config/config.h" #include -#include -#include -#include -#include -#include +#include "system.h" #include "dispatch_test.h" // diff --git a/testing/dispatch_group.c b/testing/dispatch_group.c index 64e66d8..0ea0366 100644 --- a/testing/dispatch_group.c +++ b/testing/dispatch_group.c @@ -21,12 +21,7 @@ #include "config/config.h" #include -#include -#include -#include -#include -#include - +#include "system.h" #include "dispatch_test.h" #ifndef NSEC_PER_SEC diff --git a/testing/dispatch_pingpong.c b/testing/dispatch_pingpong.c index f999ecd..3c94255 100644 --- a/testing/dispatch_pingpong.c +++ b/testing/dispatch_pingpong.c @@ -21,8 +21,7 @@ #include "config/config.h" #include -#include - +#include "system.h" #include "dispatch_test.h" uint32_t count = 0; diff --git a/testing/dispatch_priority.c b/testing/dispatch_priority.c index 0034bfa..6876471 100644 --- a/testing/dispatch_priority.c +++ b/testing/dispatch_priority.c @@ -19,14 +19,10 @@ */ #include "config/config.h" - -#include #include #define __DISPATCH_INDIRECT__ #include "src/queue_private.h" -#include -#include -#include +#include "system.h" #if HAVE_TARGETCONDITIONALS_H #include #endif diff --git a/testing/dispatch_proc.c b/testing/dispatch_proc.c index 1764a65..cfce3e0 100644 --- a/testing/dispatch_proc.c +++ b/testing/dispatch_proc.c @@ -21,12 +21,7 @@ #include "config/config.h" #include -#include -#include -#include -#include -#include -#include +#include "system.h" #include #include "dispatch_test.h" diff --git a/testing/dispatch_read.c b/testing/dispatch_read.c index 7d1a8e6..e32945b 100644 --- a/testing/dispatch_read.c +++ b/testing/dispatch_read.c @@ -21,13 +21,7 @@ #include "config/config.h" #include -#include -#include -#include -#include -#include -#include - +#include "system.h" #include #include "dispatch_test.h" diff --git a/testing/dispatch_readsync.c b/testing/dispatch_readsync.c index 0b5facd..f0a584c 100644 --- a/testing/dispatch_readsync.c +++ b/testing/dispatch_readsync.c @@ -23,12 +23,7 @@ #include #define __DISPATCH_INDIRECT__ #include "src/queue_private.h" -#include -#include -#include -#include -#include - +#include "system.h" #include "dispatch_test.h" #define LAPS 10000 diff --git a/testing/dispatch_sema.c b/testing/dispatch_sema.c index 24e0b62..aeab495 100644 --- a/testing/dispatch_sema.c +++ b/testing/dispatch_sema.c @@ -21,10 +21,7 @@ #include "config/config.h" #include -#include -#include -#include - +#include "system.h" #include "dispatch_test.h" #define LAPS 10000 diff --git a/testing/dispatch_starfish.c b/testing/dispatch_starfish.c index a2b965a..4946093 100644 --- a/testing/dispatch_starfish.c +++ b/testing/dispatch_starfish.c @@ -22,9 +22,7 @@ #include #include "src/internal.h" -#include -#include -#include +#include "system.h" #if HAVE_TARGETCONDITIONALS_H #include #endif diff --git a/testing/dispatch_test.c b/testing/dispatch_test.c index 859d5a2..574d6dd 100644 --- a/testing/dispatch_test.c +++ b/testing/dispatch_test.c @@ -1,16 +1,8 @@ #include "config/config.h" #include -#include - -#include -#include -#include -#include -#include +#include "system.h" #include -#include - #include "dispatch_test.h" #define _test_print(_file, _line, _desc, \ diff --git a/testing/dispatch_timer_bit31.c b/testing/dispatch_timer_bit31.c index e326cdb..6c09bab 100644 --- a/testing/dispatch_timer_bit31.c +++ b/testing/dispatch_timer_bit31.c @@ -19,12 +19,7 @@ */ #include "config/config.h" - -#include -#include -#include -#include - +#include "system.h" #include #include "dispatch_test.h" diff --git a/testing/dispatch_timer_bit63.c b/testing/dispatch_timer_bit63.c index f4fe1d5..e03fe14 100644 --- a/testing/dispatch_timer_bit63.c +++ b/testing/dispatch_timer_bit63.c @@ -19,12 +19,7 @@ */ #include "config/config.h" - -#include -#include -#include -#include - +#include "system.h" #include #include "dispatch_test.h" diff --git a/testing/dispatch_timer_set_time.c b/testing/dispatch_timer_set_time.c index b15330d..b1e075c 100644 --- a/testing/dispatch_timer_set_time.c +++ b/testing/dispatch_timer_set_time.c @@ -1,9 +1,5 @@ #include "config/config.h" - -#include -#include -#include -#include +#include "system.h" #define __DISPATCH_INDIRECT__ #include "src/internal.h" diff --git a/testing/fd_stress.c b/testing/fd_stress.c index a4b1ce2..ee977f2 100644 --- a/testing/fd_stress.c +++ b/testing/fd_stress.c @@ -27,17 +27,8 @@ #include "config/config.h" #include - -#include +#include "system.h" #include -#include -#include -#include -#include -#include -#include -#include -#include static inline size_t max(size_t a, size_t b) { return (a > b) ? a : b; diff --git a/testing/harness.c b/testing/harness.c index 594b901..4c23d21 100644 --- a/testing/harness.c +++ b/testing/harness.c @@ -21,12 +21,7 @@ #include "config/config.h" #include -#include -#include -#include -#include -#include -#include +#include "system.h" #include #include "dispatch_test.h" diff --git a/testing/queue_finalizer.c b/testing/queue_finalizer.c index 950fa73..4f3e232 100644 --- a/testing/queue_finalizer.c +++ b/testing/queue_finalizer.c @@ -21,13 +21,7 @@ #include "config/config.h" #include - -#include -#include -#include -#include -#include - +#include "system.h" #include "dispatch_test.h" void *ctxt_magic; diff --git a/testing/summarize.c b/testing/summarize.c index 549e733..4fb4e6f 100644 --- a/testing/summarize.c +++ b/testing/summarize.c @@ -19,10 +19,7 @@ */ #include "config/config.h" - -#include -#include -#include +#include "system.h" int has_prefix(const char* str, const char* prefix) { diff --git a/testing/system.h b/testing/system.h new file mode 100644 index 0000000..65b9653 --- /dev/null +++ b/testing/system.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2010 Apple Inc. All rights reserved. + * + * @APPLE_APACHE_LICENSE_HEADER_START@ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @APPLE_APACHE_LICENSE_HEADER_END@ + */ + +#ifndef DISPATCH_TEST_SYSTEM_H +#define DISPATCH_TEST_SYSTEM_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef __BLOCKS__ +#include +#endif + +#endif -- 1.7.0.1 >From 5a085595bf7b65ed384477b0251c84e6acbb157d Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 8 Jun 2010 10:02:11 +0200 Subject: [PATCH 2/2] work around usage of __block in glibc's unistd.h --- src/private.h | 2 ++ testing/system.h | 2 ++ 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/src/private.h b/src/private.h index 17875e2..5b1ce7e 100644 --- a/src/private.h +++ b/src/private.h @@ -33,7 +33,9 @@ #include #endif #if HAVE_UNISTD_H +#define __block __libc_block #include +#undef __block #endif #if HAVE_SYS_CDEFS_H #include diff --git a/testing/system.h b/testing/system.h index 65b9653..49656db 100644 --- a/testing/system.h +++ b/testing/system.h @@ -28,7 +28,9 @@ #include #include #include +#define __block __libc_block #include +#undef __block #include #include #include -- 1.7.0.1