[libdispatch-changes] [150] trunk

source_changes at macosforge.org source_changes at macosforge.org
Thu Nov 12 16:13:20 PST 2009


Revision: 150
          http://trac.macosforge.org/projects/libdispatch/changeset/150
Author:   robert at fledge.watson.org
Date:     2009-11-12 16:13:18 -0800 (Thu, 12 Nov 2009)
Log Message:
-----------
Define and use libdispatch-local versions of __BEGIN_DECLS and __END_DECLS
since they (and cdefs.h) are not portable.  Unlike the submitted patch,
match the exact definition used on Mac OS X.

Note that this does not update dispatch_testing.h, which was not updated
in the submitted patch.

Submitted by:	Joakim Johansson <jocke at tbricks.com>

Modified Paths:
--------------
    trunk/dispatch/benchmark.h
    trunk/dispatch/dispatch.h
    trunk/dispatch/group.h
    trunk/dispatch/object.h
    trunk/dispatch/once.h
    trunk/dispatch/queue.h
    trunk/dispatch/semaphore.h
    trunk/dispatch/source.h
    trunk/dispatch/time.h
    trunk/src/legacy.h
    trunk/src/private.h
    trunk/src/queue_private.h
    trunk/src/source_private.h

Modified: trunk/dispatch/benchmark.h
===================================================================
--- trunk/dispatch/benchmark.h	2009-11-13 00:03:21 UTC (rev 149)
+++ trunk/dispatch/benchmark.h	2009-11-13 00:13:18 UTC (rev 150)
@@ -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

Modified: trunk/dispatch/dispatch.h
===================================================================
--- trunk/dispatch/dispatch.h	2009-11-13 00:03:21 UTC (rev 149)
+++ trunk/dispatch/dispatch.h	2009-11-13 00:13:18 UTC (rev 150)
@@ -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

Modified: trunk/dispatch/group.h
===================================================================
--- trunk/dispatch/group.h	2009-11-13 00:03:21 UTC (rev 149)
+++ trunk/dispatch/group.h	2009-11-13 00:13:18 UTC (rev 150)
@@ -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

Modified: trunk/dispatch/object.h
===================================================================
--- trunk/dispatch/object.h	2009-11-13 00:03:21 UTC (rev 149)
+++ trunk/dispatch/object.h	2009-11-13 00:13:18 UTC (rev 150)
@@ -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

Modified: trunk/dispatch/once.h
===================================================================
--- trunk/dispatch/once.h	2009-11-13 00:03:21 UTC (rev 149)
+++ trunk/dispatch/once.h	2009-11-13 00:13:18 UTC (rev 150)
@@ -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

Modified: trunk/dispatch/queue.h
===================================================================
--- trunk/dispatch/queue.h	2009-11-13 00:03:21 UTC (rev 149)
+++ trunk/dispatch/queue.h	2009-11-13 00:13:18 UTC (rev 150)
@@ -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

Modified: trunk/dispatch/semaphore.h
===================================================================
--- trunk/dispatch/semaphore.h	2009-11-13 00:03:21 UTC (rev 149)
+++ trunk/dispatch/semaphore.h	2009-11-13 00:13:18 UTC (rev 150)
@@ -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__ */

Modified: trunk/dispatch/source.h
===================================================================
--- trunk/dispatch/source.h	2009-11-13 00:03:21 UTC (rev 149)
+++ trunk/dispatch/source.h	2009-11-13 00:13:18 UTC (rev 150)
@@ -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

Modified: trunk/dispatch/time.h
===================================================================
--- trunk/dispatch/time.h	2009-11-13 00:03:21 UTC (rev 149)
+++ trunk/dispatch/time.h	2009-11-13 00:13:18 UTC (rev 150)
@@ -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

Modified: trunk/src/legacy.h
===================================================================
--- trunk/src/legacy.h	2009-11-13 00:03:21 UTC (rev 149)
+++ trunk/src/legacy.h	2009-11-13 00:13:18 UTC (rev 150)
@@ -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

Modified: trunk/src/private.h
===================================================================
--- trunk/src/private.h	2009-11-13 00:03:21 UTC (rev 149)
+++ trunk/src/private.h	2009-11-13 00:13:18 UTC (rev 150)
@@ -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

Modified: trunk/src/queue_private.h
===================================================================
--- trunk/src/queue_private.h	2009-11-13 00:03:21 UTC (rev 149)
+++ trunk/src/queue_private.h	2009-11-13 00:13:18 UTC (rev 150)
@@ -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

Modified: trunk/src/source_private.h
===================================================================
--- trunk/src/source_private.h	2009-11-13 00:03:21 UTC (rev 149)
+++ trunk/src/source_private.h	2009-11-13 00:13:18 UTC (rev 150)
@@ -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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/libdispatch-changes/attachments/20091112/3433ff4b/attachment.html>


More information about the libdispatch-changes mailing list