[llvm-commits] [compiler-rt] r154326 - /compiler-rt/trunk/lib/asan/asan_mac.cc

Alexey Samsonov samsonov at google.com
Mon Apr 9 09:45:18 PDT 2012


Author: samsonov
Date: Mon Apr  9 11:45:18 2012
New Revision: 154326

URL: http://llvm.org/viewvc/llvm-project?rev=154326&view=rev
Log:
[ASan] remove dispatch.h header once again - it's not present on Leopard, and we don't want to break the build of compiler-rt there. See https://trac.macports.org/ticket/33362

Modified:
    compiler-rt/trunk/lib/asan/asan_mac.cc

Modified: compiler-rt/trunk/lib/asan/asan_mac.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_mac.cc?rev=154326&r1=154325&r2=154326&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_mac.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_mac.cc Mon Apr  9 11:45:18 2012
@@ -23,7 +23,6 @@
 #include "asan_thread_registry.h"
 
 #include <crt_externs.h>  // for _NSGetEnviron
-#include <dispatch/dispatch.h>
 #include <mach-o/dyld.h>
 #include <mach-o/loader.h>
 #include <sys/mman.h>
@@ -439,6 +438,11 @@
 
 typedef void* pthread_workqueue_t;
 typedef void* pthread_workitem_handle_t;
+
+typedef void* dispatch_group_t;
+typedef void* dispatch_queue_t;
+typedef uint64_t dispatch_time_t;
+typedef void (*dispatch_function_t)(void *block);
 typedef void* (*worker_t)(void *block);
 
 // A wrapper for the ObjC blocks used to support libdispatch.
@@ -448,11 +452,22 @@
   int parent_tid;
 } asan_block_context_t;
 
+// We use extern declarations of libdispatch functions here instead
+// of including <dispatch/dispatch.h>. This header is not present on
+// Mac OS X Leopard and eariler, and although we don't expect ASan to
+// work on legacy systems, it's bad to break the build of
+// LLVM compiler-rt there.
 extern "C" {
-// dispatch_barrier_async_f() is not declared in <dispatch/dispatch.h>.
+void dispatch_async_f(dispatch_queue_t dq, void *ctxt,
+                      dispatch_function_t func);
+void dispatch_sync_f(dispatch_queue_t dq, void *ctxt,
+                     dispatch_function_t func);
+void dispatch_after_f(dispatch_time_t when, dispatch_queue_t dq, void *ctxt,
+                      dispatch_function_t func);
 void dispatch_barrier_async_f(dispatch_queue_t dq, void *ctxt,
                               dispatch_function_t func);
-// Neither is pthread_workqueue_additem_np().
+void dispatch_group_async_f(dispatch_group_t group, dispatch_queue_t dq,
+                            void *ctxt, dispatch_function_t func);
 int pthread_workqueue_additem_np(pthread_workqueue_t workq,
     void *(*workitem_func)(void *), void * workitem_arg,
     pthread_workitem_handle_t * itemhandlep, unsigned int *gencountp);





More information about the llvm-commits mailing list