llvm-project/libcxx
Dimitry Andric 83dca5c3d1 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

llvm-svn: 293197
2017-01-26 18:37:18 +00:00
..
benchmarks improve performance of string::find 2016-12-30 18:01:36 +00:00
cmake Improve CMake and LIT support for Windows 2017-01-16 20:47:35 +00:00
docs [libcxx] Mentions "targeting C++11 and above" instead of "targeting C++11" in the doc 2017-01-25 17:00:30 +00:00
include Disable thread safety analysis for some functions in __thread_support 2017-01-26 18:37:18 +00:00
lib Update Linux ABI lists to reflect inlining change in LLVM. More investigation tomorrow. 2017-01-24 13:03:40 +00:00
src Revert "[libcxx] Never use <cassert> within libc++" 2017-01-24 12:26:01 +00:00
test Implement LWG2556: Wide contract for future::share() 2017-01-24 23:28:25 +00:00
utils Allow sym_diff.py to report non-zero for non-breaking ABI changes 2017-01-18 00:05:01 +00:00
www Fixed a couple of invalid statuses for 2665 and 2758 2017-01-26 14:36:14 +00:00
.arcconfig Upgrade arcconfig to use https 2016-07-18 02:02:49 +00:00
.clang-format Tweak .clang-format configuration. 2017-01-14 05:43:02 +00:00
.gitignore Implement N4606 optional 2016-10-12 07:46:20 +00:00
CMakeLists.txt Revert "[libcxx] Never use <cassert> within libc++" 2017-01-24 12:26:01 +00:00
CREDITS.TXT Added "Michael Park" to `CREDITS.TXT`. 2017-01-07 10:19:24 +00:00
LICENSE.TXT Update year to 2017 2017-01-03 11:20:43 +00:00
NOTES.TXT Update doc and various cleanup 2016-12-23 20:00:13 +00:00
TODO.TXT Update doc and various cleanup 2016-12-23 20:00:13 +00:00