From cee23446e1c50ef7c6d6906c9146460a198803fa Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Wed, 2 Nov 2016 17:56:05 +0000 Subject: [PATCH] Add support for old versions of MacOS to libunwind. Fixes PR22203. Thanks to Jeremy for the bug report and the patch. llvm-svn: 285845 --- libunwind/include/libunwind.h | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/libunwind/include/libunwind.h b/libunwind/include/libunwind.h index b52fe9d..9d72d48 100644 --- a/libunwind/include/libunwind.h +++ b/libunwind/include/libunwind.h @@ -20,12 +20,26 @@ #include #ifdef __APPLE__ - #include - #ifdef __arm__ - #define LIBUNWIND_AVAIL __attribute__((unavailable)) + #if __clang__ + #if __has_include() + #include + #endif + #elif __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050 + #include + #endif + + #ifdef __arm__ + #define LIBUNWIND_AVAIL __attribute__((unavailable)) + #elif defined(__OSX_AVAILABLE_STARTING) + #define LIBUNWIND_AVAIL __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_5_0) + #else + #include + #ifdef AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER + #define LIBUNWIND_AVAIL AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER #else - #define LIBUNWIND_AVAIL __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_5_0) + #define LIBUNWIND_AVAIL __attribute__((unavailable)) #endif + #endif #else #define LIBUNWIND_AVAIL #endif -- 2.7.4