[libdispatch-dev] Solaris portability, dispatch.h - PATCH [4/6] REVISED
Joakim Johansson
jocke at tbricks.com
Tue Nov 10 06:13:35 PST 2009
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 at lists.macosforge.org
>>> http://lists.macosforge.org/mailman/listinfo.cgi/libdispatch-dev
>>
>> _______________________________________________
>> libdispatch-dev mailing list
>> libdispatch-dev at 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
More information about the libdispatch-dev
mailing list