[PATCH] D41601: Ignore the DISPATCH_NOESCAPE if not defined
Yi Kong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 27 15:27:53 PST 2017
kongyi created this revision.
kongyi added a reviewer: ahatanak.
Herald added subscribers: Sanitizers, llvm-commits, kubamracek.
This macro is only defined after XCode 8, causing build breakage for build systems with prior versions. Ignore DISPATCH_NOESCAPE if not defined.
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D41601
Files:
lib/tsan/rtl/tsan_libdispatch_mac.cc
Index: lib/tsan/rtl/tsan_libdispatch_mac.cc
===================================================================
--- lib/tsan/rtl/tsan_libdispatch_mac.cc
+++ lib/tsan/rtl/tsan_libdispatch_mac.cc
@@ -25,6 +25,13 @@
#include <dispatch/dispatch.h>
#include <pthread.h>
+// DISPATCH_NOESCAPE is not defined prior to XCode 8.
+#ifdef DISPATCH_NOESCAPE
+#define _DISPATCH_NOESCAPE DISPATCH_NOESCAPE
+#else
+#define _DISPATCH_NOESCAPE
+#endif
+
typedef long long_t; // NOLINT
namespace __tsan {
@@ -178,7 +185,7 @@
#define DISPATCH_INTERCEPT_SYNC_B(name, barrier) \
TSAN_INTERCEPTOR(void, name, dispatch_queue_t q, \
- DISPATCH_NOESCAPE dispatch_block_t block) { \
+ _DISPATCH_NOESCAPE dispatch_block_t block) { \
SCOPED_TSAN_INTERCEPTOR(name, q, block); \
SCOPED_TSAN_INTERCEPTOR_USER_CALLBACK_START(); \
dispatch_block_t heap_block = Block_copy(block); \
@@ -268,7 +275,7 @@
// need to undefine the macro.
#undef dispatch_once
TSAN_INTERCEPTOR(void, dispatch_once, dispatch_once_t *predicate,
- DISPATCH_NOESCAPE dispatch_block_t block) {
+ _DISPATCH_NOESCAPE dispatch_block_t block) {
SCOPED_INTERCEPTOR_RAW(dispatch_once, predicate, block);
atomic_uint32_t *a = reinterpret_cast<atomic_uint32_t *>(predicate);
u32 v = atomic_load(a, memory_order_acquire);
@@ -479,7 +486,7 @@
TSAN_INTERCEPTOR(void, dispatch_apply, size_t iterations,
dispatch_queue_t queue,
- DISPATCH_NOESCAPE void (^block)(size_t)) {
+ _DISPATCH_NOESCAPE void (^block)(size_t)) {
SCOPED_TSAN_INTERCEPTOR(dispatch_apply, iterations, queue, block);
void *parent_to_child_sync = nullptr;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41601.128244.patch
Type: text/x-patch
Size: 1884 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171227/657f8136/attachment.bin>
More information about the llvm-commits
mailing list