[libcxx-commits] [PATCH] D86598: [libcxx] Fix compile for BUILD_EXTERNAL_THREAD_LIBRARY

David Nicuesa via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Aug 26 01:47:44 PDT 2020


Nicu created this revision.
Nicu added a reviewer: libc++.
Nicu added a project: libc++.
Herald added subscribers: libcxx-commits, mgorny.
Herald added 1 blocking reviewer(s): libc++.
Nicu requested review of this revision.

Fix compilation with -DLIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY when using clang. Now including 'libcxx/include' for building target  'cxx_external_threads'. Fix mismatching visibility for `libcpp_timed_backoff_policy` function in file <__threading_support>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86598

Files:
  libcxx/include/__threading_support
  libcxx/src/CMakeLists.txt


Index: libcxx/src/CMakeLists.txt
===================================================================
--- libcxx/src/CMakeLists.txt
+++ libcxx/src/CMakeLists.txt
@@ -323,7 +323,10 @@
 
 
 if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY)
-  file(GLOB LIBCXX_EXTERNAL_THREADING_SUPPORT_SOURCES ../test/support/external_threads.cpp)
+  set(LIBCXX_EXTERNAL_THREADING_SUPPORT_SOURCES
+      "${CMAKE_CURRENT_SOURCE_DIR}/../test/support/external_threads.cpp")
+  set(LIBCXX_INCLUDE_DIR
+      "${CMAKE_CURRENT_SOURCE_DIR}/../include")
 
   if (LIBCXX_ENABLE_SHARED)
     add_library(cxx_external_threads SHARED ${LIBCXX_EXTERNAL_THREADING_SUPPORT_SOURCES})
@@ -337,6 +340,8 @@
       COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}"
       OUTPUT_NAME   "c++external_threads"
   )
+
+  target_include_directories(cxx_external_threads PRIVATE ${LIBCXX_INCLUDE_DIR})
 endif()
 
 if (LIBCXX_INSTALL_LIBRARY)
Index: libcxx/include/__threading_support
===================================================================
--- libcxx/include/__threading_support
+++ libcxx/include/__threading_support
@@ -274,15 +274,15 @@
 
 _LIBCPP_THREAD_ABI_VISIBILITY
 int __libcpp_tls_set(__libcpp_tls_key __key, void *__p);
-
 #endif // !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
 
+
 struct __libcpp_timed_backoff_policy {
   _LIBCPP_THREAD_ABI_VISIBILITY
   bool operator()(chrono::nanoseconds __elapsed) const;
 };
 
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_THREAD_ABI_VISIBILITY
 bool __libcpp_timed_backoff_policy::operator()(chrono::nanoseconds __elapsed) const
 {
     if(__elapsed > chrono::milliseconds(128))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86598.287865.patch
Type: text/x-patch
Size: 1585 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200826/b0d606e6/attachment.bin>


More information about the libcxx-commits mailing list