From 5748d2b404785f82d6a92b497f58dc4c4c33e06d Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Mon, 13 Feb 2017 15:26:51 +0000 Subject: [PATCH] config: disable thread safety analysis on COFF clang cannot properly handle __declspec and __attribute__ on classes right now. This prevents the shared_mutex tests from working. Disable the use of the annotation on COFF targets. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294958 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/__config | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/__config b/include/__config index 10de952e7..3853916a0 100644 --- a/include/__config +++ b/include/__config @@ -1012,10 +1012,16 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( #define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK #endif -#if (defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS) && defined(__clang__) \ - && __has_attribute(acquire_capability)) +#if defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS) +#if defined(__clang__) && __has_attribute(acquire_capability) +// Work around the attribute handling in clang. When both __declspec and +// __attribute__ are present, the processing goes awry preventing the definition +// of the types. +#if !defined(_LIBCPP_OBJECT_FORMAT_COFF) #define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS #endif +#endif +#endif #if __has_attribute(require_constant_initialization) #define _LIBCPP_SAFE_STATIC __attribute__((__require_constant_initialization__))