Solaris portability, dispatch.h - PATCH [4/6]
Added the checking for cdefs.h that does not exist on all platforms, also added the __BEGIN_DECLS here as they are usually from cdefs.h and are not available on Solaris. Perhaps this should be broken out to a DISPATCH_SHIMS_CDEFS instead? Joakim octo.tbricks.com:gcd/trunk/dispatch> svn diff Index: dispatch.h =================================================================== --- dispatch.h (revision 140) +++ dispatch.h (working copy) @@ -25,7 +25,20 @@ #include <Availability.h> #include <TargetConditionals.h> #endif +#if HAVE_SYS_CDEFS_H #include <sys/cdefs.h> +#endif + +#ifndef __BEGIN_DECLS +# if defined(__cplusplus) +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS }; +# else /* __BEGIN_DECLS */ +# define __BEGIN_DECLS +# define __END_DECLS +# endif /* __BEGIN_DECLS */ +#endif /* __BEGIN_DECLS */ + #include <stddef.h> #include <stdint.h> #include <stdbool.h>
On Fri, 6 Nov 2009, Joakim Johansson wrote:
Added the checking for cdefs.h that does not exist on all platforms, also added the __BEGIN_DECLS here as they are usually from cdefs.h and are not available on Solaris.
Perhaps this should be broken out to a DISPATCH_SHIMS_CDEFS instead?
Unfortunately, we can't rely on config.h-based tests in the public headers, so this particular formulation of conditional cdefs.h inclusion won't work here (although it was fine in private.h, which I've committed as r141). Maybe we need to go with OS defines here for that reason. Robert
Joakim
octo.tbricks.com:gcd/trunk/dispatch> svn diff Index: dispatch.h =================================================================== --- dispatch.h (revision 140) +++ dispatch.h (working copy) @@ -25,7 +25,20 @@ #include <Availability.h> #include <TargetConditionals.h> #endif +#if HAVE_SYS_CDEFS_H #include <sys/cdefs.h> +#endif + +#ifndef __BEGIN_DECLS +# if defined(__cplusplus) +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS }; +# else /* __BEGIN_DECLS */ +# define __BEGIN_DECLS +# define __END_DECLS +# endif /* __BEGIN_DECLS */ +#endif /* __BEGIN_DECLS */ + #include <stddef.h> #include <stdint.h> #include <stdbool.h>
_______________________________________________ libdispatch-dev mailing list libdispatch-dev@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/libdispatch-dev
svn diff dispatch.h Index: dispatch.h =================================================================== --- dispatch.h (revision 142) +++ dispatch.h (working copy) @@ -25,7 +25,21 @@ #include <Availability.h> #include <TargetConditionals.h> #endif
Aha, I see - thanks for the explanation. Attaching a revised version of the patch utilizing OS defines instead! Thanks for integrating the other two fixes! Joakim ps Anyone else having issues with extremely slow delivery of posts to the list? It can take literally many hours between a post being available from the archives at macosforge until the post actually turns up through email (all directly addressed emails comes at once though, so it is not a problem with our mail delivery... ----- + +#if defined (__SVR4) && defined (__sun) +#ifndef __BEGIN_DECLS +# if defined(__cplusplus) +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS }; +# else /* __BEGIN_DECLS */ +# define __BEGIN_DECLS +# define __END_DECLS +# endif /* __BEGIN_DECLS */ +#endif /* __BEGIN_DECLS */ +#else #include <sys/cdefs.h> +#endif + #include <stddef.h> #include <stdint.h> #include <stdbool.h> ----- On 6 nov 2009, at 23.29, Robert Watson wrote:
On Fri, 6 Nov 2009, Joakim Johansson wrote:
Added the checking for cdefs.h that does not exist on all platforms, also added the __BEGIN_DECLS here as they are usually from cdefs.h and are not available on Solaris.
Perhaps this should be broken out to a DISPATCH_SHIMS_CDEFS instead?
Unfortunately, we can't rely on config.h-based tests in the public headers, so this particular formulation of conditional cdefs.h inclusion won't work here (although it was fine in private.h, which I've committed as r141). Maybe we need to go with OS defines here for that reason.
Robert
Joakim
octo.tbricks.com:gcd/trunk/dispatch> svn diff Index: dispatch.h =================================================================== --- dispatch.h (revision 140) +++ dispatch.h (working copy) @@ -25,7 +25,20 @@ #include <Availability.h> #include <TargetConditionals.h> #endif +#if HAVE_SYS_CDEFS_H #include <sys/cdefs.h> +#endif + +#ifndef __BEGIN_DECLS +# if defined(__cplusplus) +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS }; +# else /* __BEGIN_DECLS */ +# define __BEGIN_DECLS +# define __END_DECLS +# endif /* __BEGIN_DECLS */ +#endif /* __BEGIN_DECLS */ + #include <stddef.h> #include <stdint.h> #include <stdbool.h>
_______________________________________________ libdispatch-dev mailing list libdispatch-dev@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/libdispatch-dev
On Nov 7, 2009, at 12:53 AM, Joakim Johansson wrote:
ps Anyone else having issues with extremely slow delivery of posts to the list? It can take literally many hours between a post being available from the archives at macosforge until the post actually turns up through email (all directly addressed emails comes at once though, so it is not a problem with our mail delivery...
I just noticed my own posts coming in several days after posting, and possibly replicated at that, so yeah. I'll CC Bill on this to see if something's going on with MacOSForge mail... - Jordan
On Nov 7, 2009, at 5:22 PM, Jordan K. Hubbard wrote:
On Nov 7, 2009, at 12:53 AM, Joakim Johansson wrote:
ps Anyone else having issues with extremely slow delivery of posts to the list? It can take literally many hours between a post being available from the archives at macosforge until the post actually turns up through email (all directly addressed emails comes at once though, so it is not a problem with our mail delivery...
I just noticed my own posts coming in several days after posting, and possibly replicated at that, so yeah. I'll CC Bill on this to see if something's going on with MacOSForge mail...
One of the Mac OS Forge servers is damaged, and we're having to route around the problem. The mail delivery delays were fixed this afternoon. Sorry for the inconvenience. -Bill
On 11/06/2009 11:29 PM, Robert Watson wrote:
+ +#ifndef __BEGIN_DECLS +# if defined(__cplusplus) +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS }; +# else /* __BEGIN_DECLS */ +# define __BEGIN_DECLS +# define __END_DECLS +# endif /* __BEGIN_DECLS */ +#endif /* __BEGIN_DECLS */
Just remove cdefs.h completely and do s/__BEGIN_DECLS/__DISPATCH_BEGIN_DECLS/ (similarly for END)? Paolo
I'd certainly be glad with that approach and would happily provide the simple diffs for it if the maintainers are happy with it, it would definitely look cleaner. Kevin/Robert? Joakim On 7 nov 2009, at 16.55, Paolo Bonzini wrote:
On 11/06/2009 11:29 PM, Robert Watson wrote:
+ +#ifndef __BEGIN_DECLS +# if defined(__cplusplus) +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS }; +# else /* __BEGIN_DECLS */ +# define __BEGIN_DECLS +# define __END_DECLS +# endif /* __BEGIN_DECLS */ +#endif /* __BEGIN_DECLS */
Just remove cdefs.h completely and do s/__BEGIN_DECLS/ __DISPATCH_BEGIN_DECLS/ (similarly for END)?
Paolo _______________________________________________ libdispatch-dev mailing list libdispatch-dev@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/libdispatch-dev
On Mon, 9 Nov 2009, Joakim Johansson wrote:
I'd certainly be glad with that approach and would happily provide the simple diffs for it if the maintainers are happy with it, it would definitely look cleaner.
Kevin/Robert?
I'm not sure I have any specific opinion on this, but if we're going to be defining __BEGIN_DECLS/__END_DECLS variations in dispatch.h, let's go whole hog (as it were) and use __DISPATCH_BEGIN_DECLS. Robert
Joakim
On 7 nov 2009, at 16.55, Paolo Bonzini wrote:
On 11/06/2009 11:29 PM, Robert Watson wrote:
+ +#ifndef __BEGIN_DECLS +# if defined(__cplusplus) +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS }; +# else /* __BEGIN_DECLS */ +# define __BEGIN_DECLS +# define __END_DECLS +# endif /* __BEGIN_DECLS */ +#endif /* __BEGIN_DECLS */
Just remove cdefs.h completely and do s/__BEGIN_DECLS/__DISPATCH_BEGIN_DECLS/ (similarly for END)?
Paolo _______________________________________________ libdispatch-dev mailing list libdispatch-dev@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/libdispatch-dev
_______________________________________________ libdispatch-dev mailing list libdispatch-dev@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/libdispatch-dev
Ok, patch attached below. I also removed the include of cdefs.h in dispatch.h, as it no longer seems required. Joakim On 10 nov 2009, at 12.50, Robert Watson wrote:
On Mon, 9 Nov 2009, Joakim Johansson wrote:
I'd certainly be glad with that approach and would happily provide the simple diffs for it if the maintainers are happy with it, it would definitely look cleaner.
Kevin/Robert?
I'm not sure I have any specific opinion on this, but if we're going to be defining __BEGIN_DECLS/__END_DECLS variations in dispatch.h, let's go whole hog (as it were) and use __DISPATCH_BEGIN_DECLS.
Robert
Joakim
On 7 nov 2009, at 16.55, Paolo Bonzini wrote:
On 11/06/2009 11:29 PM, Robert Watson wrote:
+ +#ifndef __BEGIN_DECLS +# if defined(__cplusplus) +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS }; +# else /* __BEGIN_DECLS */ +# define __BEGIN_DECLS +# define __END_DECLS +# endif /* __BEGIN_DECLS */ +#endif /* __BEGIN_DECLS */ Just remove cdefs.h completely and do s/__BEGIN_DECLS/__DISPATCH_BEGIN_DECLS/ (similarly for END)? Paolo
libdispatch-dev mailing list libdispatch-dev@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/libdispatch-dev
_______________________________________________ libdispatch-dev mailing list libdispatch-dev@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/libdispatch-dev
-----
/usr/bin/svn diff Index: dispatch/benchmark.h =================================================================== --- dispatch/benchmark.h (revision 147) +++ dispatch/benchmark.h (working copy) @@ -32,7 +32,7 @@ #include <dispatch/base.h> // for HeaderDoc #endif
-__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS /*! * @function dispatch_benchmark @@ -78,6 +78,6 @@ uint64_t dispatch_benchmark_f(size_t count, void *ctxt, void (*func)(void *)); -__END_DECLS +__DISPATCH_END_DECLS #endif Index: dispatch/group.h =================================================================== --- dispatch/group.h (revision 147) +++ dispatch/group.h (working copy) @@ -33,7 +33,7 @@ */ DISPATCH_DECL(dispatch_group); -__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS /*! * @function dispatch_group_create @@ -268,6 +268,6 @@ void dispatch_group_leave(dispatch_group_t group); -__END_DECLS +__DISPATCH_END_DECLS #endif Index: dispatch/time.h =================================================================== --- dispatch/time.h (revision 147) +++ dispatch/time.h (working copy) @@ -28,7 +28,7 @@ #include <stdint.h> -__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS struct timespec; @@ -108,6 +108,6 @@ dispatch_time_t dispatch_walltime(const struct timespec *when, int64_t delta); -__END_DECLS +__DISPATCH_END_DECLS #endif Index: dispatch/dispatch.h =================================================================== --- dispatch/dispatch.h (revision 147) +++ dispatch/dispatch.h (working copy) @@ -25,12 +25,19 @@ #include <Availability.h> #include <TargetConditionals.h> #endif -#include <sys/cdefs.h> #include <stddef.h> #include <stdint.h> #include <stdbool.h> #include <stdarg.h> +#if defined(__cplusplus) +# define __DISPATCH_BEGIN_DECLS extern "C" { +# define __DISPATCH_END_DECLS }; +#else +# define __DISPATCH_BEGIN_DECLS +# define __DISPATCH_END_DECLS +#endif + #ifndef __OSX_AVAILABLE_STARTING #define __OSX_AVAILABLE_STARTING(x, y) #endif Index: dispatch/source.h =================================================================== --- dispatch/source.h (revision 147) +++ dispatch/source.h (working copy) @@ -240,7 +240,7 @@ DISPATCH_VNODE_REVOKE = 0x40, }; -__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS /*! * @function dispatch_source_create @@ -580,6 +580,6 @@ uint64_t interval, uint64_t leeway); -__END_DECLS +__DISPATCH_END_DECLS #endif Index: dispatch/semaphore.h =================================================================== --- dispatch/semaphore.h (revision 147) +++ dispatch/semaphore.h (working copy) @@ -34,7 +34,7 @@ */ DISPATCH_DECL(dispatch_semaphore); -__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS /*! * @function dispatch_semaphore_create @@ -107,6 +107,6 @@ long dispatch_semaphore_signal(dispatch_semaphore_t dsema); -__END_DECLS +__DISPATCH_END_DECLS #endif /* __DISPATCH_SEMAPHORE__ */ Index: dispatch/once.h =================================================================== --- dispatch/once.h (revision 147) +++ dispatch/once.h (working copy) @@ -26,7 +26,7 @@ #include <dispatch/base.h> // for HeaderDoc #endif -__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS /*! * @typedef dispatch_once_t @@ -72,6 +72,6 @@ #define dispatch_once_f(x, y, z) do { if (__builtin_expect(*(x), ~0l) != ~0l) dispatch_once_f((x), (y), (z)); } while (0) #endif -__END_DECLS +__DISPATCH_END_DECLS #endif Index: dispatch/queue.h =================================================================== --- dispatch/queue.h (revision 147) +++ dispatch/queue.h (working copy) @@ -111,7 +111,7 @@ typedef void (^dispatch_block_t)(void); #endif -__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS /*! * @function dispatch_async @@ -563,6 +563,6 @@ void *context, dispatch_function_t work); -__END_DECLS +__DISPATCH_END_DECLS #endif Index: dispatch/object.h =================================================================== --- dispatch/object.h (revision 147) +++ dispatch/object.h (working copy) @@ -26,7 +26,7 @@ #include <dispatch/base.h> // for HeaderDoc #endif -__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS /*! * @function dispatch_debug @@ -190,6 +190,6 @@ void dispatch_resume(dispatch_object_t object); -__END_DECLS +__DISPATCH_END_DECLS #endif Index: src/source_private.h =================================================================== --- src/source_private.h (revision 147) +++ src/source_private.h (working copy) @@ -109,7 +109,7 @@ DISPATCH_PROC_REAP = 0x10000000, }; -__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS #if HAVE_MACH /*! @@ -126,6 +126,6 @@ dispatch_mig_server(dispatch_source_t ds, size_t maxmsgsz, dispatch_mig_callback_t callback); #endif -__END_DECLS +__DISPATCH_END_DECLS #endif Index: src/legacy.h =================================================================== --- src/legacy.h (revision 147) +++ src/legacy.h (working copy) @@ -93,7 +93,7 @@ typedef void (*dispatch_queue_finalizer_function_t)(void *, dispatch_queue_t); -__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS /*! * @function dispatch_queue_attr_create @@ -759,6 +759,6 @@ #endif /* HAVE_MACH */ -__END_DECLS +__DISPATCH_END_DECLS #endif Index: src/private.h =================================================================== --- src/private.h (revision 147) +++ src/private.h (working copy) @@ -65,7 +65,7 @@ /* LEGACY: Use DISPATCH_API_VERSION */ #define LIBDISPATCH_VERSION DISPATCH_API_VERSION -__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS DISPATCH_NOTHROW void @@ -120,6 +120,6 @@ dispatch_mach_msg_get_context(mach_msg_header_t *msg); #endif -__END_DECLS +__DISPATCH_END_DECLS #endif Index: src/queue_private.h =================================================================== --- src/queue_private.h (revision 147) +++ src/queue_private.h (working copy) @@ -32,7 +32,7 @@ #include <dispatch/base.h> // for HeaderDoc #endif -__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS /*! @@ -117,6 +117,6 @@ } dispatch_queue_offsets; -__END_DECLS +__DISPATCH_END_DECLS #endif
On Tue, 10 Nov 2009, Joakim Johansson wrote:
Ok, patch attached below.
I also removed the include of cdefs.h in dispatch.h, as it no longer seems required.
Committed as r150, but with minor tweaks so that the definitions exactly match those on Mac OS X. I notice also that dispatch_test.h isn't updated? Robert
Joakim
On 10 nov 2009, at 12.50, Robert Watson wrote:
On Mon, 9 Nov 2009, Joakim Johansson wrote:
I'd certainly be glad with that approach and would happily provide the simple diffs for it if the maintainers are happy with it, it would definitely look cleaner.
Kevin/Robert?
I'm not sure I have any specific opinion on this, but if we're going to be defining __BEGIN_DECLS/__END_DECLS variations in dispatch.h, let's go whole hog (as it were) and use __DISPATCH_BEGIN_DECLS.
Robert
Joakim
On 7 nov 2009, at 16.55, Paolo Bonzini wrote:
On 11/06/2009 11:29 PM, Robert Watson wrote:
+ +#ifndef __BEGIN_DECLS +# if defined(__cplusplus) +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS }; +# else /* __BEGIN_DECLS */ +# define __BEGIN_DECLS +# define __END_DECLS +# endif /* __BEGIN_DECLS */ +#endif /* __BEGIN_DECLS */ Just remove cdefs.h completely and do s/__BEGIN_DECLS/__DISPATCH_BEGIN_DECLS/ (similarly for END)? Paolo
libdispatch-dev mailing list libdispatch-dev@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/libdispatch-dev
_______________________________________________ libdispatch-dev mailing list libdispatch-dev@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/libdispatch-dev
-----
/usr/bin/svn diff Index: dispatch/benchmark.h =================================================================== --- dispatch/benchmark.h (revision 147) +++ dispatch/benchmark.h (working copy) @@ -32,7 +32,7 @@ #include <dispatch/base.h> // for HeaderDoc #endif
-__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS
/*! * @function dispatch_benchmark @@ -78,6 +78,6 @@ uint64_t dispatch_benchmark_f(size_t count, void *ctxt, void (*func)(void *));
-__END_DECLS +__DISPATCH_END_DECLS
#endif Index: dispatch/group.h =================================================================== --- dispatch/group.h (revision 147) +++ dispatch/group.h (working copy) @@ -33,7 +33,7 @@ */ DISPATCH_DECL(dispatch_group);
-__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS
/*! * @function dispatch_group_create @@ -268,6 +268,6 @@ void dispatch_group_leave(dispatch_group_t group);
-__END_DECLS +__DISPATCH_END_DECLS
#endif Index: dispatch/time.h =================================================================== --- dispatch/time.h (revision 147) +++ dispatch/time.h (working copy) @@ -28,7 +28,7 @@
#include <stdint.h>
-__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS
struct timespec;
@@ -108,6 +108,6 @@ dispatch_time_t dispatch_walltime(const struct timespec *when, int64_t delta);
-__END_DECLS +__DISPATCH_END_DECLS
#endif Index: dispatch/dispatch.h =================================================================== --- dispatch/dispatch.h (revision 147) +++ dispatch/dispatch.h (working copy) @@ -25,12 +25,19 @@ #include <Availability.h> #include <TargetConditionals.h> #endif -#include <sys/cdefs.h> #include <stddef.h> #include <stdint.h> #include <stdbool.h> #include <stdarg.h>
+#if defined(__cplusplus) +# define __DISPATCH_BEGIN_DECLS extern "C" { +# define __DISPATCH_END_DECLS }; +#else +# define __DISPATCH_BEGIN_DECLS +# define __DISPATCH_END_DECLS +#endif + #ifndef __OSX_AVAILABLE_STARTING #define __OSX_AVAILABLE_STARTING(x, y) #endif Index: dispatch/source.h =================================================================== --- dispatch/source.h (revision 147) +++ dispatch/source.h (working copy) @@ -240,7 +240,7 @@ DISPATCH_VNODE_REVOKE = 0x40, };
-__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS
/*! * @function dispatch_source_create @@ -580,6 +580,6 @@ uint64_t interval, uint64_t leeway);
-__END_DECLS +__DISPATCH_END_DECLS
#endif Index: dispatch/semaphore.h =================================================================== --- dispatch/semaphore.h (revision 147) +++ dispatch/semaphore.h (working copy) @@ -34,7 +34,7 @@ */ DISPATCH_DECL(dispatch_semaphore);
-__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS
/*! * @function dispatch_semaphore_create @@ -107,6 +107,6 @@ long dispatch_semaphore_signal(dispatch_semaphore_t dsema);
-__END_DECLS +__DISPATCH_END_DECLS
#endif /* __DISPATCH_SEMAPHORE__ */ Index: dispatch/once.h =================================================================== --- dispatch/once.h (revision 147) +++ dispatch/once.h (working copy) @@ -26,7 +26,7 @@ #include <dispatch/base.h> // for HeaderDoc #endif
-__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS
/*! * @typedef dispatch_once_t @@ -72,6 +72,6 @@ #define dispatch_once_f(x, y, z) do { if (__builtin_expect(*(x), ~0l) != ~0l) dispatch_once_f((x), (y), (z)); } while (0) #endif
-__END_DECLS +__DISPATCH_END_DECLS
#endif Index: dispatch/queue.h =================================================================== --- dispatch/queue.h (revision 147) +++ dispatch/queue.h (working copy) @@ -111,7 +111,7 @@ typedef void (^dispatch_block_t)(void); #endif
-__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS
/*! * @function dispatch_async @@ -563,6 +563,6 @@ void *context, dispatch_function_t work);
-__END_DECLS +__DISPATCH_END_DECLS
#endif Index: dispatch/object.h =================================================================== --- dispatch/object.h (revision 147) +++ dispatch/object.h (working copy) @@ -26,7 +26,7 @@ #include <dispatch/base.h> // for HeaderDoc #endif
-__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS
/*! * @function dispatch_debug @@ -190,6 +190,6 @@ void dispatch_resume(dispatch_object_t object);
-__END_DECLS +__DISPATCH_END_DECLS
#endif Index: src/source_private.h =================================================================== --- src/source_private.h (revision 147) +++ src/source_private.h (working copy) @@ -109,7 +109,7 @@ DISPATCH_PROC_REAP = 0x10000000, };
-__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS
#if HAVE_MACH /*! @@ -126,6 +126,6 @@ dispatch_mig_server(dispatch_source_t ds, size_t maxmsgsz, dispatch_mig_callback_t callback); #endif
-__END_DECLS +__DISPATCH_END_DECLS
#endif Index: src/legacy.h =================================================================== --- src/legacy.h (revision 147) +++ src/legacy.h (working copy) @@ -93,7 +93,7 @@
typedef void (*dispatch_queue_finalizer_function_t)(void *, dispatch_queue_t);
-__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS
/*! * @function dispatch_queue_attr_create @@ -759,6 +759,6 @@
#endif /* HAVE_MACH */
-__END_DECLS +__DISPATCH_END_DECLS
#endif Index: src/private.h =================================================================== --- src/private.h (revision 147) +++ src/private.h (working copy) @@ -65,7 +65,7 @@ /* LEGACY: Use DISPATCH_API_VERSION */ #define LIBDISPATCH_VERSION DISPATCH_API_VERSION
-__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS
DISPATCH_NOTHROW void @@ -120,6 +120,6 @@ dispatch_mach_msg_get_context(mach_msg_header_t *msg); #endif
-__END_DECLS +__DISPATCH_END_DECLS
#endif Index: src/queue_private.h =================================================================== --- src/queue_private.h (revision 147) +++ src/queue_private.h (working copy) @@ -32,7 +32,7 @@ #include <dispatch/base.h> // for HeaderDoc #endif
-__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS
/*! @@ -117,6 +117,6 @@ } dispatch_queue_offsets;
-__END_DECLS +__DISPATCH_END_DECLS
#endif
_______________________________________________ libdispatch-dev mailing list libdispatch-dev@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/libdispatch-dev
Thanks! I skipped dispatch_test.h on purpose for now, I intend to try to address additional issues with the tests overall a bit later and thought to do that change also together with those. (e.g. lack of asprintf() on solaris etc) What about the CPU detection patch, is it bad style to combine platform and capability ifdef checks, or is it ok? Joakim On 13 nov 2009, at 01.13, Robert Watson <robert@fledge.watson.org> wrote:
On Tue, 10 Nov 2009, Joakim Johansson wrote:
Ok, patch attached below.
I also removed the include of cdefs.h in dispatch.h, as it no longer seems required.
Committed as r150, but with minor tweaks so that the definitions exactly match those on Mac OS X. I notice also that dispatch_test.h isn't updated?
Robert
Joakim
On 10 nov 2009, at 12.50, Robert Watson wrote:
On Mon, 9 Nov 2009, Joakim Johansson wrote:
I'd certainly be glad with that approach and would happily provide the simple diffs for it if the maintainers are happy with it, it would definitely look cleaner.
Kevin/Robert?
I'm not sure I have any specific opinion on this, but if we're going to be defining __BEGIN_DECLS/__END_DECLS variations in dispatch.h, let's go whole hog (as it were) and use __DISPATCH_BEGIN_DECLS.
Robert
Joakim
On 7 nov 2009, at 16.55, Paolo Bonzini wrote:
On 11/06/2009 11:29 PM, Robert Watson wrote:
+ +#ifndef __BEGIN_DECLS +# if defined(__cplusplus) +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS }; +# else /* __BEGIN_DECLS */ +# define __BEGIN_DECLS +# define __END_DECLS +# endif /* __BEGIN_DECLS */ +#endif /* __BEGIN_DECLS */ Just remove cdefs.h completely and do s/__BEGIN_DECLS/ __DISPATCH_BEGIN_DECLS/ (similarly for END)? Paolo
libdispatch-dev mailing list libdispatch-dev@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/libdispatch-dev
_______________________________________________ libdispatch-dev mailing list libdispatch-dev@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/libdispatch-dev
-----
/usr/bin/svn diff Index: dispatch/benchmark.h =================================================================== --- dispatch/benchmark.h (revision 147) +++ dispatch/benchmark.h (working copy) @@ -32,7 +32,7 @@ #include <dispatch/base.h> // for HeaderDoc #endif
-__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS
/*! * @function dispatch_benchmark @@ -78,6 +78,6 @@ uint64_t dispatch_benchmark_f(size_t count, void *ctxt, void (*func)(void *));
-__END_DECLS +__DISPATCH_END_DECLS
#endif Index: dispatch/group.h =================================================================== --- dispatch/group.h (revision 147) +++ dispatch/group.h (working copy) @@ -33,7 +33,7 @@ */ DISPATCH_DECL(dispatch_group);
-__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS
/*! * @function dispatch_group_create @@ -268,6 +268,6 @@ void dispatch_group_leave(dispatch_group_t group);
-__END_DECLS +__DISPATCH_END_DECLS
#endif Index: dispatch/time.h =================================================================== --- dispatch/time.h (revision 147) +++ dispatch/time.h (working copy) @@ -28,7 +28,7 @@
#include <stdint.h>
-__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS
struct timespec;
@@ -108,6 +108,6 @@ dispatch_time_t dispatch_walltime(const struct timespec *when, int64_t delta);
-__END_DECLS +__DISPATCH_END_DECLS
#endif Index: dispatch/dispatch.h =================================================================== --- dispatch/dispatch.h (revision 147) +++ dispatch/dispatch.h (working copy) @@ -25,12 +25,19 @@ #include <Availability.h> #include <TargetConditionals.h> #endif -#include <sys/cdefs.h> #include <stddef.h> #include <stdint.h> #include <stdbool.h> #include <stdarg.h>
+#if defined(__cplusplus) +# define __DISPATCH_BEGIN_DECLS extern "C" { +# define __DISPATCH_END_DECLS }; +#else +# define __DISPATCH_BEGIN_DECLS +# define __DISPATCH_END_DECLS +#endif + #ifndef __OSX_AVAILABLE_STARTING #define __OSX_AVAILABLE_STARTING(x, y) #endif Index: dispatch/source.h =================================================================== --- dispatch/source.h (revision 147) +++ dispatch/source.h (working copy) @@ -240,7 +240,7 @@ DISPATCH_VNODE_REVOKE = 0x40, };
-__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS
/*! * @function dispatch_source_create @@ -580,6 +580,6 @@ uint64_t interval, uint64_t leeway);
-__END_DECLS +__DISPATCH_END_DECLS
#endif Index: dispatch/semaphore.h =================================================================== --- dispatch/semaphore.h (revision 147) +++ dispatch/semaphore.h (working copy) @@ -34,7 +34,7 @@ */ DISPATCH_DECL(dispatch_semaphore);
-__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS
/*! * @function dispatch_semaphore_create @@ -107,6 +107,6 @@ long dispatch_semaphore_signal(dispatch_semaphore_t dsema);
-__END_DECLS +__DISPATCH_END_DECLS
#endif /* __DISPATCH_SEMAPHORE__ */ Index: dispatch/once.h =================================================================== --- dispatch/once.h (revision 147) +++ dispatch/once.h (working copy) @@ -26,7 +26,7 @@ #include <dispatch/base.h> // for HeaderDoc #endif
-__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS
/*! * @typedef dispatch_once_t @@ -72,6 +72,6 @@ #define dispatch_once_f(x, y, z) do { if (__builtin_expect(*(x), ~0l) != ~0l) dispatch_once_f((x), (y), (z)); } while (0) #endif
-__END_DECLS +__DISPATCH_END_DECLS
#endif Index: dispatch/queue.h =================================================================== --- dispatch/queue.h (revision 147) +++ dispatch/queue.h (working copy) @@ -111,7 +111,7 @@ typedef void (^dispatch_block_t)(void); #endif
-__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS
/*! * @function dispatch_async @@ -563,6 +563,6 @@ void *context, dispatch_function_t work);
-__END_DECLS +__DISPATCH_END_DECLS
#endif Index: dispatch/object.h =================================================================== --- dispatch/object.h (revision 147) +++ dispatch/object.h (working copy) @@ -26,7 +26,7 @@ #include <dispatch/base.h> // for HeaderDoc #endif
-__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS
/*! * @function dispatch_debug @@ -190,6 +190,6 @@ void dispatch_resume(dispatch_object_t object);
-__END_DECLS +__DISPATCH_END_DECLS
#endif Index: src/source_private.h =================================================================== --- src/source_private.h (revision 147) +++ src/source_private.h (working copy) @@ -109,7 +109,7 @@ DISPATCH_PROC_REAP = 0x10000000, };
-__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS
#if HAVE_MACH /*! @@ -126,6 +126,6 @@ dispatch_mig_server(dispatch_source_t ds, size_t maxmsgsz, dispatch_mig_callback_t callback); #endif
-__END_DECLS +__DISPATCH_END_DECLS
#endif Index: src/legacy.h =================================================================== --- src/legacy.h (revision 147) +++ src/legacy.h (working copy) @@ -93,7 +93,7 @@
typedef void (*dispatch_queue_finalizer_function_t)(void *, dispatch_queue_t);
-__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS
/*! * @function dispatch_queue_attr_create @@ -759,6 +759,6 @@
#endif /* HAVE_MACH */
-__END_DECLS +__DISPATCH_END_DECLS
#endif Index: src/private.h =================================================================== --- src/private.h (revision 147) +++ src/private.h (working copy) @@ -65,7 +65,7 @@ /* LEGACY: Use DISPATCH_API_VERSION */ #define LIBDISPATCH_VERSION DISPATCH_API_VERSION
-__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS
DISPATCH_NOTHROW void @@ -120,6 +120,6 @@ dispatch_mach_msg_get_context(mach_msg_header_t *msg); #endif
-__END_DECLS +__DISPATCH_END_DECLS
#endif Index: src/queue_private.h =================================================================== --- src/queue_private.h (revision 147) +++ src/queue_private.h (working copy) @@ -32,7 +32,7 @@ #include <dispatch/base.h> // for HeaderDoc #endif
-__BEGIN_DECLS +__DISPATCH_BEGIN_DECLS
/*! @@ -117,6 +117,6 @@ } dispatch_queue_offsets;
-__END_DECLS +__DISPATCH_END_DECLS
#endif
_______________________________________________ libdispatch-dev mailing list libdispatch-dev@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/libdispatch-dev
Here is the patch for dispatch_test.h, seems to be no reason for and defines in this singular place really... Joakim Index: testing/dispatch_test.h =================================================================== --- testing/dispatch_test.h (revision 171) +++ testing/dispatch_test.h (working copy) @@ -1,7 +1,9 @@ #include <errno.h> -__BEGIN_DECLS - +#ifdef __cplusplus +extern "C" { +#endif + void test_start(const char* desc); void test_stop(void); void test_stop_after_delay(void *delay); @@ -30,4 +32,6 @@ void _test_errno(const char* file, long line, const char* desc, long actual, long expected); #define test_errno(a,b,c) _test_errno(__FILE__, __LINE__, a, b, c) -__END_DECLS +#ifdef __cplusplus +} +#endif On 13 nov 2009, at 01.13, Robert Watson wrote: On Tue, 10 Nov 2009, Joakim Johansson wrote:
Ok, patch attached below.
I also removed the include of cdefs.h in dispatch.h, as it no longer seems required.
Committed as r150, but with minor tweaks so that the definitions exactly match those on Mac OS X. I notice also that dispatch_test.h isn't updated?
Robert
participants (5)
-
Joakim Johansson
-
Jordan K. Hubbard
-
Paolo Bonzini
-
Robert Watson
-
William Siegrist