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

Tobias Burnus via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 17 04:20:46 PST 2023


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

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._

>From 4c03cd3fa7dbeca64002372596f4cffdfa50ecdb Mon Sep 17 00:00:00 2001
From: FX Coudert <fxcoudert at gmail.com>
Date: Fri, 17 Nov 2023 13:18:12 +0100
Subject: [PATCH] [asan][Darwin] Use Apples blocks extension only when
 supported (#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.
---
 compiler-rt/lib/asan/asan_mac.cpp | 2 ++
 1 file changed, 2 insertions(+)

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 {



More information about the llvm-commits mailing list