libstdc++: Tweak TSan annotations for std::atomic<shared_ptr<T>>
authorJonathan Wakely <jwakely@redhat.com>
Thu, 15 Sep 2022 15:57:30 +0000 (16:57 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 15 Sep 2022 20:04:36 +0000 (21:04 +0100)
commitecbdfa8b314e2c17da17511b86371f552bffd441
treecaf0b2257c147e4c66f393c2f204f6e62800a994
parent29b39d4b0e44d350a35e5f25d9faeb9f9aac38e4
libstdc++: Tweak TSan annotations for std::atomic<shared_ptr<T>>

Do not use the __tsan_mutex_not_static flag for annotation functions
where it's not a valid flag.  Also use the try_lock and try_lock_failed
flags to more precisely annotate the CAS loop used to acquire a lock.

libstdc++-v3/ChangeLog:

* include/bits/shared_ptr_atomic.h (_GLIBCXX_TSAN_MUTEX_PRE_LOCK):
Replace with ...
(_GLIBCXX_TSAN_MUTEX_TRY_LOCK): ... this, add try_lock flag.
(_GLIBCXX_TSAN_MUTEX_TRY_LOCK_FAILED): New macro using
try_lock_failed flag
(_GLIBCXX_TSAN_MUTEX_POST_LOCK): Rename to ...
(_GLIBCXX_TSAN_MUTEX_LOCKED): ... this.
(_GLIBCXX_TSAN_MUTEX_PRE_UNLOCK): Remove invalid flag.
(_GLIBCXX_TSAN_MUTEX_POST_UNLOCK): Remove invalid flag.
(_Sp_atomic::_Atomic_count::lock): Use new macros.
libstdc++-v3/include/bits/shared_ptr_atomic.h