[libcxx-commits] [libcxx] de5d38e - [libcxx] Allow using thread safety annotations in MinGW mode

Martin Storsjö via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jan 28 01:22:09 PST 2022


Author: Martin Storsjö
Date: 2022-01-28T11:20:58+02:00
New Revision: de5d38ef2de6a76c0a76673958ce1d49e5af2324

URL: https://github.com/llvm/llvm-project/commit/de5d38ef2de6a76c0a76673958ce1d49e5af2324
DIFF: https://github.com/llvm/llvm-project/commit/de5d38ef2de6a76c0a76673958ce1d49e5af2324.diff

LOG: [libcxx] Allow using thread safety annotations in MinGW mode

These were omitted in all Windows configurations, but it turns out
that they work just fine in MinGW mode.

This allows converting a couple cases of "XFAIL: LIBCXX-WINDOWS-FIXME"
into "XFAIL: msvc" as the bug is specific to MSVC mode (clang-cl).

Differential Revision: https://reviews.llvm.org/D118192

Added: 
    

Modified: 
    libcxx/include/__config
    libcxx/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
    libcxx/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp
    libcxx/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp
    libcxx/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__config b/libcxx/include/__config
index b99cdc38dc9f8..bd77fba361191 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -1258,8 +1258,9 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container(
 #  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)
+// of the types. In MinGW mode, __declspec evaluates to __attribute__, and thus
+// combining the two does work.
+#    if !defined(_MSC_VER)
 #      define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS
 #    endif
 #  endif

diff  --git a/libcxx/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp b/libcxx/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
index 380839cceda9f..10ad116657704 100644
--- a/libcxx/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
+++ b/libcxx/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
@@ -8,7 +8,7 @@
 
 // On Windows Clang bugs out when both __declspec and __attribute__ are present,
 // the processing goes awry preventing the definition of the types.
-// XFAIL: LIBCXX-WINDOWS-FIXME
+// XFAIL: msvc
 
 // UNSUPPORTED: libcpp-has-no-threads
 // REQUIRES: thread-safety

diff  --git a/libcxx/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp b/libcxx/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp
index 1c53f21177e53..0b599f75b684d 100644
--- a/libcxx/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp
+++ b/libcxx/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp
@@ -8,7 +8,7 @@
 
 // On Windows Clang bugs out when both __declspec and __attribute__ are present,
 // the processing goes awry preventing the definition of the types.
-// XFAIL: LIBCXX-WINDOWS-FIXME
+// XFAIL: msvc
 
 // UNSUPPORTED: libcpp-has-no-threads
 // REQUIRES: thread-safety

diff  --git a/libcxx/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp b/libcxx/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp
index f494ac87168c2..beb508f4e30f4 100644
--- a/libcxx/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp
+++ b/libcxx/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp
@@ -8,7 +8,7 @@
 
 // On Windows Clang bugs out when both __declspec and __attribute__ are present,
 // the processing goes awry preventing the definition of the types.
-// XFAIL: LIBCXX-WINDOWS-FIXME
+// XFAIL: msvc
 
 // UNSUPPORTED: libcpp-has-no-threads
 // REQUIRES: thread-safety

diff  --git a/libcxx/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp b/libcxx/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp
index ed4b8665d1fa6..edfcfea496fb0 100644
--- a/libcxx/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp
+++ b/libcxx/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp
@@ -8,7 +8,7 @@
 
 // On Windows Clang bugs out when both __declspec and __attribute__ are present,
 // the processing goes awry preventing the definition of the types.
-// XFAIL: LIBCXX-WINDOWS-FIXME
+// XFAIL: msvc
 
 // UNSUPPORTED: libcpp-has-no-threads
 // REQUIRES: thread-safety


        


More information about the libcxx-commits mailing list