[libcxx-commits] [PATCH] D118192: [libcxx] Allow using thread safety annotations in MinGW mode

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jan 25 14:05:09 PST 2022


mstorsjo created this revision.
mstorsjo added a reviewer: ldionne.
mstorsjo requested review of this revision.
Herald added a project: libc++.
Herald added a reviewer: libc++.

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).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D118192

Files:
  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


Index: libcxx/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp
===================================================================
--- libcxx/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp
+++ 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
Index: libcxx/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp
===================================================================
--- libcxx/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp
+++ 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
Index: libcxx/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp
===================================================================
--- libcxx/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp
+++ 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
Index: libcxx/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
===================================================================
--- libcxx/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
+++ 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
Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -1258,8 +1258,9 @@
 #  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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118192.403035.patch
Type: text/x-patch
Size: 3074 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220125/a28e2fdc/attachment.bin>


More information about the libcxx-commits mailing list