[compiler-rt] [asan][Darwin] Use Apples blocks extension only when supported (#72639) (PR #72642)

via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 17 04:21:19 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Tobias Burnus (tob2)

<details>
<summary>Changes</summary>

Issue #<!-- -->72639

The commit at 020cdaf broke build of asan on macOS with GCC. GCC does not support the Apple blocks extension (yet). Uses of blocks in other parts of the sanitisers are protected by MISSING_BLOCKS_SUPPORT. But the type definition is not.

_This applies FX's patch from the issue._

---
Full diff: https://github.com/llvm/llvm-project/pull/72642.diff


1 Files Affected:

- (modified) compiler-rt/lib/asan/asan_mac.cpp (+2) 


``````````diff
diff --git a/compiler-rt/lib/asan/asan_mac.cpp b/compiler-rt/lib/asan/asan_mac.cpp
index 5d5146e0cde0ba9..6252fa20d5e740f 100644
--- a/compiler-rt/lib/asan/asan_mac.cpp
+++ b/compiler-rt/lib/asan/asan_mac.cpp
@@ -139,9 +139,11 @@ typedef void (*dispatch_mach_handler_function_t)(void *context,
                                                  dispatch_mach_reason reason,
                                                  dispatch_mach_msg_t message,
                                                  mach_error_t error);
+#if !defined(MISSING_BLOCKS_SUPPORT)
 typedef void (^dispatch_mach_handler_t)(dispatch_mach_reason reason,
                                         dispatch_mach_msg_t message,
                                         mach_error_t error);
+#endif
 
 // A wrapper for the ObjC blocks used to support libdispatch.
 typedef struct {

``````````

</details>


https://github.com/llvm/llvm-project/pull/72642


More information about the llvm-commits mailing list