[PATCH] D14731: [libcxx] Add clang thread safety annotations to mutex and lock_guard

James Robinson via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 11 14:55:23 PST 2016


jamesr updated this revision to Diff 50481.
jamesr added a comment.

This patch guards the new annotations with _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS and adds a number of tests to check that the annotations produce errors when the annotations are enabled that code violates the thread safety rules, that correct code does not produce errors, and that code that does not enable the annotations does not produce errors even in code that the thread-safety feature in Clang does not understand.

The feature guard is state in the positive as opposed to the negative as the annotations may be incompatible with correct code in some situations.


http://reviews.llvm.org/D14731

Files:
  include/__config
  include/__mutex_base
  test/libcxx/test/format.py
  test/libcxx/thread/thread.mutex/thread_safety_access_guarded_without_lock.fail.cpp
  test/libcxx/thread/thread.mutex/thread_safety_annotations_not_enabled.cpp
  test/libcxx/thread/thread.mutex/thread_safety_call_requires_capability_without_having.fail.cpp
  test/libcxx/thread/thread.mutex/thread_safety_lock_guard.cpp
  test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.cpp
  test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp
  test/libcxx/thread/thread.mutex/thread_safety_requires_capability.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14731.50481.patch
Type: text/x-patch
Size: 7897 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160311/1918d7b4/attachment-0001.bin>


More information about the cfe-commits mailing list