[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:25:12 PST 2023


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

>From 43a5a066723fa12df4a90a227805920c3d307ccb Mon Sep 17 00:00:00 2001
From: FX Coudert <fxcoudert at gmail.com>
Date: Fri, 17 Nov 2023 13:24:46 +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..1b0e9b3fe006049 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