[libcxx-commits] [libcxx] 0f5020a - [libc++] Build thread_win32.cpp only if LIBCXX_HAS_PTHREAD_API is not set

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 16 07:03:57 PST 2021


Author: Colin Finck
Date: 2021-02-16T10:03:42-05:00
New Revision: 0f5020af7f347f029b5687f7a6d3b72174995d59

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

LOG: [libc++] Build thread_win32.cpp only if LIBCXX_HAS_PTHREAD_API is not set

This allows building libc++ against winpthreads from mingw-w64 to support
operating systems older than Windows 7. The remaining libc++ code already
supports `WIN32` with `LIBCXX_HAS_PTHREAD_API`.

Note that there is also the older "pthreads-win32". However, that support
library implements `pthread_t` as a struct, which violates the libc++
assumption that `pthread_t` is always a scalar and can be compared,
ordered, and set to zero.

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

Added: 
    

Modified: 
    libcxx/src/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt
index 76227d39af50..cfb7eb1f7141 100644
--- a/libcxx/src/CMakeLists.txt
+++ b/libcxx/src/CMakeLists.txt
@@ -77,8 +77,13 @@ if(WIN32)
   list(APPEND LIBCXX_SOURCES
     support/win32/locale_win32.cpp
     support/win32/support.cpp
-    support/win32/thread_win32.cpp
     )
+
+  if (NOT LIBCXX_HAS_PTHREAD_API)
+    list(APPEND LIBCXX_SOURCES
+      support/win32/thread_win32.cpp
+      )
+  endif()
 elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS")
   list(APPEND LIBCXX_SOURCES
     support/solaris/mbsnrtowcs.inc


        


More information about the libcxx-commits mailing list