Author: dim Date: Sun Jan 29 14:30:51 2017 New Revision: 293443 URL: http://llvm.org/viewvc/llvm-project?rev=293443&view=rev Log: Merging r293197: ------------------------------------------------------------------------ r293197 | dim | 2017-01-26 19:37:18 +0100 (Thu, 26 Jan 2017) | 43 lines
Disable thread safety analysis for some functions in __thread_support Many thread-related libc++ test cases fail on FreeBSD, due to the following -Werror warnings: In file included from test/std/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp:17: In file included from include/thread:97: In file included from include/__mutex_base:17: include/__threading_support:222:1: error: mutex '__m' is still held at the end of function [-Werror,-Wthread-safety-analysis] } ^ include/__threading_support:221:10: note: mutex acquired here return pthread_mutex_lock(__m); ^ include/__threading_support:231:10: error: releasing mutex '__m' that was not held [-Werror,-Wthread-safety-analysis] return pthread_mutex_unlock(__m); ^ include/__threading_support:242:1: error: mutex '__m' is still held at the end of function [-Werror,-Wthread-safety-analysis] } ^ include/__threading_support:241:10: note: mutex acquired here return pthread_mutex_lock(__m); ^ include/__threading_support:251:10: error: releasing mutex '__m' that was not held [-Werror,-Wthread-safety-analysis] return pthread_mutex_unlock(__m); ^ include/__threading_support:272:10: error: calling function 'pthread_cond_wait' requires holding mutex '__m' exclusively [-Werror,-Wthread-safety-analysis] return pthread_cond_wait(__cv, __m); ^ include/__threading_support:278:10: error: calling function 'pthread_cond_timedwait' requires holding mutex '__m' exclusively [-Werror,-Wthread-safety-analysis] return pthread_cond_timedwait(__cv, __m, __ts); ^ 6 errors generated. This is because on FreeBSD, the pthread functions have lock annotations. Since the functions in __thread_support are internal to libc++ only, add no_thread_safety_analysis attributes to suppress these warnings. Reviewers: mclow.lists, EricWF, delesley, aaron.ballman Reviewed By: aaron.ballman Subscribers: ed, aaron.ballman, joerg, emaste, cfe-commits Differential Revision: https://reviews.llvm.org/D28520 ------------------------------------------------------------------------ Modified: libcxx/branches/release_40/ (props changed) libcxx/branches/release_40/include/__threading_support Propchange: libcxx/branches/release_40/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Sun Jan 29 14:30:51 2017 @@ -1,2 +1,2 @@ /libcxx/branches/apple:136569-137939 -/libcxx/trunk:292013,292091,292607,292990,293154 +/libcxx/trunk:292013,292091,292607,292990,293154,293197 Modified: libcxx/branches/release_40/include/__threading_support URL: http://llvm.org/viewvc/llvm-project/libcxx/branches/release_40/include/__threading_support?rev=293443&r1=293442&r2=293443&view=diff ============================================================================== --- libcxx/branches/release_40/include/__threading_support (original) +++ libcxx/branches/release_40/include/__threading_support Sun Jan 29 14:30:51 2017 @@ -40,6 +40,12 @@ #define _LIBCPP_THREAD_ABI_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY #endif +#if defined(__FreeBSD__) && defined(__clang__) && __has_attribute(no_thread_safety_analysis) +#define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS __attribute__((no_thread_safety_analysis)) +#else +#define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS +#endif + _LIBCPP_BEGIN_NAMESPACE_STD #if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) @@ -98,25 +104,25 @@ typedef DWORD __libcpp_tls_key; _LIBCPP_THREAD_ABI_VISIBILITY int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m); -_LIBCPP_THREAD_ABI_VISIBILITY +_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m); -_LIBCPP_THREAD_ABI_VISIBILITY +_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m); -_LIBCPP_THREAD_ABI_VISIBILITY +_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t *__m); _LIBCPP_THREAD_ABI_VISIBILITY int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t *__m); -_LIBCPP_THREAD_ABI_VISIBILITY +_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_mutex_lock(__libcpp_mutex_t *__m); -_LIBCPP_THREAD_ABI_VISIBILITY +_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_mutex_trylock(__libcpp_mutex_t *__m); -_LIBCPP_THREAD_ABI_VISIBILITY +_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_mutex_unlock(__libcpp_mutex_t *__m); _LIBCPP_THREAD_ABI_VISIBILITY @@ -129,10 +135,10 @@ int __libcpp_condvar_signal(__libcpp_con _LIBCPP_THREAD_ABI_VISIBILITY int __libcpp_condvar_broadcast(__libcpp_condvar_t* __cv); -_LIBCPP_THREAD_ABI_VISIBILITY +_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_condvar_wait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m); -_LIBCPP_THREAD_ABI_VISIBILITY +_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m, timespec *__ts); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits