aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-10-23 17:52:30 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-10-23 17:52:30 +0000
commit243a6be085fe6a7ce49169864c68a8839735e49b (patch)
treeabfecf3c23dc7512ca48e72ac418b149c865e0f3 /src
parent1147845301c03308e3419b89c28c77bb6917fe04 (diff)
downloadsrc-vendor/libc++.tar.gz
src-vendor/libc++.zip
Vendor import of stripped libc++ trunk r375505, the last commit beforevendor/libc++/libc++-trunk-r375505vendor/libc++
the upstream Subversion repository was made read-only, and the LLVM project migrated to GitHub: https://llvm.org/svn/llvm-project/libcxx/trunk@375505
Notes
Notes: svn path=/vendor/libc++/dist/; revision=353946 svn path=/vendor/libc++/libc++-r375505/; revision=353947; tag=vendor/libc++/libc++-trunk-r375505
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt140
-rw-r--r--src/algorithm.cpp2
-rw-r--r--src/chrono.cpp2
-rw-r--r--src/condition_variable.cpp2
-rw-r--r--src/debug.cpp2
-rw-r--r--src/experimental/memory_resource.cpp6
-rw-r--r--src/filesystem/directory_iterator.cpp12
-rw-r--r--src/filesystem/int128_builtins.cpp2
-rw-r--r--src/filesystem/operations.cpp2
-rw-r--r--src/iostream.cpp19
-rw-r--r--src/memory.cpp2
-rw-r--r--src/mutex.cpp20
-rw-r--r--src/shared_mutex.cpp2
-rw-r--r--src/thread.cpp2
-rw-r--r--src/utility.cpp2
-rw-r--r--src/valarray.cpp4
16 files changed, 70 insertions, 151 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 31cd24333a5e..120505fe18da 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -137,90 +137,17 @@ if (APPLE AND LLVM_USE_SANITIZER)
endif()
endif()
-function(cxx_link_system_libraries target)
- target_add_link_flags_if_supported(${target} PRIVATE "-nodefaultlibs")
- target_add_compile_flags_if_supported(${target} PRIVATE "/Zl")
- target_add_link_flags_if_supported(${target} PRIVATE "/nodefaultlib")
-
- if (LIBCXX_HAS_SYSTEM_LIB)
- target_link_libraries(${target} PUBLIC System)
- endif()
-
- if (LIBCXX_HAS_PTHREAD_LIB)
- target_link_libraries(${target} PUBLIC pthread)
- endif()
-
- if (LIBCXX_HAS_C_LIB)
- target_link_libraries(${target} PUBLIC c)
- endif()
-
- if (LIBCXX_HAS_M_LIB)
- target_link_libraries(${target} PUBLIC m)
- endif()
-
- if (LIBCXX_HAS_RT_LIB)
- target_link_libraries(${target} PUBLIC rt)
- endif()
-
- if (LIBCXX_USE_COMPILER_RT)
- find_compiler_rt_library(builtins LIBCXX_BUILTINS_LIBRARY)
- if (LIBCXX_BUILTINS_LIBRARY)
- target_link_libraries(${target} PUBLIC "${LIBCXX_BUILTINS_LIBRARY}")
- endif()
- elseif (LIBCXX_HAS_GCC_S_LIB)
- target_link_libraries(${target} PUBLIC gcc_s)
- endif()
-
- if (LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB)
- target_link_libraries(${target} PUBLIC atomic)
- endif()
-
- if (MINGW)
- target_link_libraries(${target} PUBLIC "${MINGW_LIBRARIES}")
- endif()
-
- if (LIBCXX_TARGETING_MSVC)
- if (LIBCXX_DEBUG_BUILD)
- set(LIB_SUFFIX "d")
- else()
- set(LIB_SUFFIX "")
- endif()
-
- target_link_libraries(${target} PUBLIC ucrt${LIB_SUFFIX}) # Universal C runtime
- target_link_libraries(${target} PUBLIC vcruntime${LIB_SUFFIX}) # C++ runtime
- target_link_libraries(${target} PUBLIC msvcrt${LIB_SUFFIX}) # C runtime startup files
- target_link_libraries(${target} PUBLIC msvcprt${LIB_SUFFIX}) # C++ standard library. Required for exception_ptr internals.
- # Required for standards-complaint wide character formatting functions
- # (e.g. `printfw`/`scanfw`)
- target_link_libraries(${target} PUBLIC iso_stdio_wide_specifiers)
- endif()
-endfunction()
+if (LIBCXX_ENABLE_PARALLEL_ALGORITHMS AND NOT TARGET pstl::ParallelSTL)
+ message(FATAL_ERROR "Could not find ParallelSTL")
+endif()
function(cxx_set_common_defines name)
if(LIBCXX_CXX_ABI_HEADER_TARGET)
add_dependencies(${name} ${LIBCXX_CXX_ABI_HEADER_TARGET})
endif()
- if(WIN32 AND NOT MINGW)
- target_compile_definitions(${name}
- PRIVATE
- # Ignore the -MSC_VER mismatch, as we may build
- # with a different compatibility version.
- _ALLOW_MSC_VER_MISMATCH
- # Don't check the msvcprt iterator debug levels
- # as we will define the iterator types; libc++
- # uses a different macro to identify the debug
- # level.
- _ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH
- # We are building the c++ runtime, don't pull in
- # msvcprt.
- _CRTBLD
- # Don't warn on the use of "deprecated"
- # "insecure" functions which are standards
- # specified.
- _CRT_SECURE_NO_WARNINGS
- # Use the ISO conforming behaviour for conversion
- # in printf, scanf.
- _CRT_STDIO_ISO_WIDE_SPECIFIERS)
+
+ if (LIBCXX_ENABLE_PARALLEL_ALGORITHMS)
+ target_link_libraries(${name} PUBLIC pstl::ParallelSTL)
endif()
endfunction()
@@ -233,7 +160,6 @@ if (LIBCXX_ENABLE_SHARED)
if(COMMAND llvm_setup_rpath)
llvm_setup_rpath(cxx_shared)
endif()
- cxx_link_system_libraries(cxx_shared)
target_link_libraries(cxx_shared PRIVATE ${LIBCXX_LIBRARIES})
set_target_properties(cxx_shared
PROPERTIES
@@ -244,18 +170,17 @@ if (LIBCXX_ENABLE_SHARED)
SOVERSION "${LIBCXX_ABI_VERSION}"
DEFINE_SYMBOL ""
)
+ cxx_add_common_build_flags(cxx_shared)
cxx_set_common_defines(cxx_shared)
# Link against LLVM libunwind
if (LIBCXXABI_USE_LLVM_UNWINDER)
if (NOT LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY AND (TARGET unwind_shared OR HAVE_LIBUNWIND))
target_link_libraries(cxx_shared PUBLIC unwind_shared)
- list(APPEND LIBCXX_INTERFACE_LIBRARIES unwind_shared) # For the linker script
elseif (LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY AND (TARGET unwind_static OR HAVE_LIBUNWIND))
# libunwind is already included in libc++abi
else()
- target_link_libraries(cxx_shared PRIVATE unwind)
- list(APPEND LIBCXX_INTERFACE_LIBRARIES unwind) # For the linker script
+ target_link_libraries(cxx_shared PUBLIC unwind)
endif()
endif()
@@ -268,7 +193,6 @@ if (LIBCXX_ENABLE_SHARED)
endif()
else()
target_link_libraries(cxx_shared PUBLIC "${LIBCXX_CXX_SHARED_ABI_LIBRARY}")
- list(APPEND LIBCXX_INTERFACE_LIBRARIES "${LIBCXX_CXX_SHARED_ABI_LIBRARY}") # For the linker script
endif()
# Maybe re-export symbols from libc++abi
@@ -295,31 +219,10 @@ if (LIBCXX_ENABLE_SHARED)
endif()
endif()
- # Generate a linker script in place of a libc++.so symlink. Rerun this command
- # after cxx builds.
+ # Generate a linker script in place of a libc++.so symlink.
if (LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
- # Get the name of the ABI library and handle the case where CXXABI_LIBNAME
- # is a target name and not a library. Ex cxxabi_shared.
- set(LIBCXX_INTERFACE_LIBRARY_NAMES)
- foreach(lib ${LIBCXX_INTERFACE_LIBRARIES})
- # FIXME: Handle cxxabi_static and unwind_static.
- if (TARGET ${lib} OR
- (${lib} MATCHES "cxxabi(_static|_shared)?" AND HAVE_LIBCXXABI) OR
- (${lib} MATCHES "unwind(_static|_shared)?" AND HAVE_LIBUNWIND))
- list(APPEND LIBCXX_INTERFACE_LIBRARY_NAMES "$<TARGET_PROPERTY:${lib},OUTPUT_NAME>")
- else()
- list(APPEND LIBCXX_INTERFACE_LIBRARY_NAMES "${lib}")
- endif()
- endforeach()
- add_custom_command(TARGET cxx_shared POST_BUILD
- COMMAND
- ${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/gen_link_script.py
- ARGS
- --input "$<TARGET_SONAME_FILE:cxx_shared>"
- --output "$<TARGET_LINKER_FILE:cxx_shared>"
- ${LIBCXX_INTERFACE_LIBRARY_NAMES}
- WORKING_DIRECTORY ${LIBCXX_BUILD_DIR}
- )
+ include(DefineLinkerScript)
+ define_linker_script(cxx_shared)
endif()
list(APPEND LIBCXX_BUILD_TARGETS "cxx_shared")
@@ -335,7 +238,6 @@ endif()
# Build the static library.
if (LIBCXX_ENABLE_STATIC)
add_library(cxx_static STATIC ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS})
- cxx_link_system_libraries(cxx_static)
target_link_libraries(cxx_static PRIVATE ${LIBCXX_LIBRARIES})
set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
set_target_properties(cxx_static
@@ -344,10 +246,10 @@ if (LIBCXX_ENABLE_STATIC)
LINK_FLAGS "${LIBCXX_LINK_FLAGS}"
OUTPUT_NAME "c++"
)
+ cxx_add_common_build_flags(cxx_static)
cxx_set_common_defines(cxx_static)
if (LIBCXX_HERMETIC_STATIC_LIBRARY)
- append_flags_if_supported(CXX_STATIC_LIBRARY_FLAGS -fvisibility=hidden)
# If the hermetic library doesn't define the operator new/delete functions
# then its code shouldn't declare them with hidden visibility. They might
# actually be provided by a shared library at link time.
@@ -398,23 +300,25 @@ if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
)
add_library(cxx_experimental STATIC ${LIBCXX_EXPERIMENTAL_SOURCES})
if (LIBCXX_ENABLE_SHARED)
- target_link_libraries(cxx_experimental cxx_shared)
+ target_link_libraries(cxx_experimental PRIVATE cxx_shared)
else()
- target_link_libraries(cxx_experimental cxx_static)
+ target_link_libraries(cxx_experimental PRIVATE cxx_static)
endif()
- set(experimental_flags "${LIBCXX_COMPILE_FLAGS}")
- check_flag_supported(-std=c++14)
- if (NOT MSVC AND LIBCXX_SUPPORTS_STD_EQ_CXX14_FLAG)
- string(REPLACE "-std=c++11" "-std=c++14" experimental_flags "${LIBCXX_COMPILE_FLAGS}")
- endif()
set_target_properties(cxx_experimental
PROPERTIES
- COMPILE_FLAGS "${experimental_flags}"
+ COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}"
OUTPUT_NAME "c++experimental"
)
+ cxx_add_common_build_flags(cxx_experimental)
+ # Overwrite the previously-set Standard flag with -std=c++14 if supported
+ check_flag_supported(-std=c++14)
+ if (NOT MSVC AND LIBCXX_SUPPORTS_STD_EQ_CXX14_FLAG)
+ target_compile_options(cxx_experimental PRIVATE "-std=c++14")
+ endif()
endif()
+
if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY)
file(GLOB LIBCXX_EXTERNAL_THREADING_SUPPORT_SOURCES ../test/support/external_threads.cpp)
diff --git a/src/algorithm.cpp b/src/algorithm.cpp
index a110ae8b1a6e..ffdcb5fccde7 100644
--- a/src/algorithm.cpp
+++ b/src/algorithm.cpp
@@ -10,7 +10,7 @@
#include "random"
#ifndef _LIBCPP_HAS_NO_THREADS
#include "mutex"
-#if defined(__unix__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA)
+#if defined(__unix__) && !defined(__ANDROID__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA)
#pragma comment(lib, "pthread")
#endif
#endif
diff --git a/src/chrono.cpp b/src/chrono.cpp
index 8f533f1059ed..c461d19ddb1f 100644
--- a/src/chrono.cpp
+++ b/src/chrono.cpp
@@ -37,7 +37,7 @@
#endif
#endif
-#if defined(__unix__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA)
+#if defined(__unix__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA)
#pragma comment(lib, "rt")
#endif
diff --git a/src/condition_variable.cpp b/src/condition_variable.cpp
index b8426c66fde6..bf89d255dd82 100644
--- a/src/condition_variable.cpp
+++ b/src/condition_variable.cpp
@@ -15,7 +15,7 @@
#include "system_error"
#include "__undef_macros"
-#if defined(__unix__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA)
+#if defined(__unix__) && !defined(__ANDROID__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA)
#pragma comment(lib, "pthread")
#endif
diff --git a/src/debug.cpp b/src/debug.cpp
index c4cc281d586b..1f5ce1052f87 100644
--- a/src/debug.cpp
+++ b/src/debug.cpp
@@ -15,7 +15,7 @@
#include "__hash_table"
#ifndef _LIBCPP_HAS_NO_THREADS
#include "mutex"
-#if defined(__unix__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA)
+#if defined(__unix__) && !defined(__ANDROID__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA)
#pragma comment(lib, "pthread")
#endif
#endif
diff --git a/src/experimental/memory_resource.cpp b/src/experimental/memory_resource.cpp
index 9aa077942b0d..e98726283173 100644
--- a/src/experimental/memory_resource.cpp
+++ b/src/experimental/memory_resource.cpp
@@ -12,7 +12,7 @@
#include "atomic"
#elif !defined(_LIBCPP_HAS_NO_THREADS)
#include "mutex"
-#if defined(__unix__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA)
+#if defined(__unix__) && !defined(__ANDROID__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA)
#pragma comment(lib, "pthread")
#endif
#endif
@@ -116,11 +116,11 @@ __default_memory_resource(bool set = false, memory_resource * new_res = nullptr)
new_res = new_res ? new_res : new_delete_resource();
// TODO: Can a weaker ordering be used?
return _VSTD::atomic_exchange_explicit(
- &__res, new_res, memory_order::memory_order_acq_rel);
+ &__res, new_res, memory_order_acq_rel);
}
else {
return _VSTD::atomic_load_explicit(
- &__res, memory_order::memory_order_acquire);
+ &__res, memory_order_acquire);
}
#elif !defined(_LIBCPP_HAS_NO_THREADS)
_LIBCPP_SAFE_STATIC static memory_resource * res = &res_init.resources.new_delete_res;
diff --git a/src/filesystem/directory_iterator.cpp b/src/filesystem/directory_iterator.cpp
index ca88dee06402..e8941b3494b3 100644
--- a/src/filesystem/directory_iterator.cpp
+++ b/src/filesystem/directory_iterator.cpp
@@ -10,7 +10,7 @@
#include "__config"
#if defined(_LIBCPP_WIN32API)
#define WIN32_LEAN_AND_MEAN
-#include <Windows.h>
+#include <windows.h>
#else
#include <dirent.h>
#endif
@@ -79,14 +79,14 @@ static file_type get_file_type(const WIN32_FIND_DATA& data) {
return file_type::unknown;
}
static uintmax_t get_file_size(const WIN32_FIND_DATA& data) {
- return (data.nFileSizeHight * (MAXDWORD + 1)) + data.nFileSizeLow;
+ return (data.nFileSizeHigh * (MAXDWORD + 1)) + data.nFileSizeLow;
}
static file_time_type get_write_time(const WIN32_FIND_DATA& data) {
ULARGE_INTEGER tmp;
- FILETIME& time = data.ftLastWriteTime;
+ const FILETIME& time = data.ftLastWriteTime;
tmp.u.LowPart = time.dwLowDateTime;
tmp.u.HighPart = time.dwHighDateTime;
- return file_time_type(file_time_type::duration(time.QuadPart));
+ return file_time_type(file_time_type::duration(tmp.QuadPart));
}
#endif
@@ -110,7 +110,7 @@ public:
__dir_stream(const path& root, directory_options opts, error_code& ec)
: __stream_(INVALID_HANDLE_VALUE), __root_(root) {
- __stream_ = ::FindFirstFileEx(root.c_str(), &__data_);
+ __stream_ = ::FindFirstFile(root.c_str(), &__data_);
if (__stream_ == INVALID_HANDLE_VALUE) {
ec = error_code(::GetLastError(), generic_category());
const bool ignore_permission_denied =
@@ -140,7 +140,7 @@ public:
//cdata.__write_time_ = get_write_time(__data_);
__entry_.__assign_iter_entry(
__root_ / __data_.cFileName,
- directory_entry::__create_iter_result(get_file_type(__data)));
+ directory_entry::__create_iter_result(detail::get_file_type(__data)));
return true;
}
ec = error_code(::GetLastError(), generic_category());
diff --git a/src/filesystem/int128_builtins.cpp b/src/filesystem/int128_builtins.cpp
index a55540fe276e..ed531ee145a2 100644
--- a/src/filesystem/int128_builtins.cpp
+++ b/src/filesystem/int128_builtins.cpp
@@ -18,7 +18,7 @@
#if !defined(_LIBCPP_HAS_NO_INT128)
-extern "C" __attribute__((no_sanitize("undefined")))
+extern "C" __attribute__((no_sanitize("undefined"))) _LIBCPP_FUNC_VIS
__int128_t __muloti4(__int128_t a, __int128_t b, int* overflow) {
const int N = (int)(sizeof(__int128_t) * CHAR_BIT);
const __int128_t MIN = (__int128_t)1 << (N - 1);
diff --git a/src/filesystem/operations.cpp b/src/filesystem/operations.cpp
index 69350ddfe9da..4e6cb1427a11 100644
--- a/src/filesystem/operations.cpp
+++ b/src/filesystem/operations.cpp
@@ -44,7 +44,7 @@
#include <sys/time.h> // for gettimeofday and timeval
#endif // !defined(CLOCK_REALTIME)
-#if defined(__unix__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA)
+#if defined(__unix__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA)
#pragma comment(lib, "rt")
#endif
diff --git a/src/iostream.cpp b/src/iostream.cpp
index 0a5d6e8d2264..ad1920abc657 100644
--- a/src/iostream.cpp
+++ b/src/iostream.cpp
@@ -97,7 +97,13 @@ static void force_locale_initialization() {
#endif
}
-ios_base::Init::Init()
+class DoIOSInit {
+public:
+ DoIOSInit();
+ ~DoIOSInit();
+};
+
+DoIOSInit::DoIOSInit()
{
force_locale_initialization();
@@ -126,7 +132,7 @@ ios_base::Init::Init()
#endif
}
-ios_base::Init::~Init()
+DoIOSInit::~DoIOSInit()
{
#ifndef _LIBCPP_HAS_NO_STDOUT
ostream* cout_ptr = reinterpret_cast<ostream*>(cout);
@@ -141,4 +147,13 @@ ios_base::Init::~Init()
wclog_ptr->flush();
}
+ios_base::Init::Init()
+{
+ static DoIOSInit init_the_streams; // gets initialized once
+}
+
+ios_base::Init::~Init()
+{
+}
+
_LIBCPP_END_NAMESPACE_STD
diff --git a/src/memory.cpp b/src/memory.cpp
index c8c00383cf92..e89d94f27e4c 100644
--- a/src/memory.cpp
+++ b/src/memory.cpp
@@ -10,7 +10,7 @@
#ifndef _LIBCPP_HAS_NO_THREADS
#include "mutex"
#include "thread"
-#if defined(__unix__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA)
+#if defined(__unix__) && !defined(__ANDROID__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA)
#pragma comment(lib, "pthread")
#endif
#endif
diff --git a/src/mutex.cpp b/src/mutex.cpp
index 0d69d7cacfa1..7e979cd89041 100644
--- a/src/mutex.cpp
+++ b/src/mutex.cpp
@@ -13,7 +13,7 @@
#include "__undef_macros"
#ifndef _LIBCPP_HAS_NO_THREADS
-#if defined(__unix__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA)
+#if defined(__unix__) && !defined(__ANDROID__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA)
#pragma comment(lib, "pthread")
#endif
#endif
@@ -21,9 +21,9 @@
_LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_HAS_NO_THREADS
-const defer_lock_t defer_lock = {};
-const try_to_lock_t try_to_lock = {};
-const adopt_lock_t adopt_lock = {};
+const defer_lock_t defer_lock{};
+const try_to_lock_t try_to_lock{};
+const adopt_lock_t adopt_lock{};
// ~mutex is defined elsewhere
@@ -132,7 +132,7 @@ timed_mutex::unlock() _NOEXCEPT
recursive_timed_mutex::recursive_timed_mutex()
: __count_(0),
- __id_(0)
+ __id_{}
{
}
@@ -144,9 +144,9 @@ recursive_timed_mutex::~recursive_timed_mutex()
void
recursive_timed_mutex::lock()
{
- __libcpp_thread_id id = __libcpp_thread_get_current_id();
+ __thread_id id = this_thread::get_id();
unique_lock<mutex> lk(__m_);
- if (__libcpp_thread_id_equal(id, __id_))
+ if (id ==__id_)
{
if (__count_ == numeric_limits<size_t>::max())
__throw_system_error(EAGAIN, "recursive_timed_mutex lock limit reached");
@@ -162,9 +162,9 @@ recursive_timed_mutex::lock()
bool
recursive_timed_mutex::try_lock() _NOEXCEPT
{
- __libcpp_thread_id id = __libcpp_thread_get_current_id();
+ __thread_id id = this_thread::get_id();
unique_lock<mutex> lk(__m_, try_to_lock);
- if (lk.owns_lock() && (__count_ == 0 || __libcpp_thread_id_equal(id, __id_)))
+ if (lk.owns_lock() && (__count_ == 0 || id == __id_))
{
if (__count_ == numeric_limits<size_t>::max())
return false;
@@ -181,7 +181,7 @@ recursive_timed_mutex::unlock() _NOEXCEPT
unique_lock<mutex> lk(__m_);
if (--__count_ == 0)
{
- __id_ = 0;
+ __id_.__reset();
lk.unlock();
__cv_.notify_one();
}
diff --git a/src/shared_mutex.cpp b/src/shared_mutex.cpp
index eb3f5f3506f5..9e6d5202aafa 100644
--- a/src/shared_mutex.cpp
+++ b/src/shared_mutex.cpp
@@ -10,7 +10,7 @@
#ifndef _LIBCPP_HAS_NO_THREADS
#include "shared_mutex"
-#if defined(__unix__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA)
+#if defined(__unix__) && !defined(__ANDROID__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA)
#pragma comment(lib, "pthread")
#endif
diff --git a/src/thread.cpp b/src/thread.cpp
index 39bb9e9bac63..cee778f6ee85 100644
--- a/src/thread.cpp
+++ b/src/thread.cpp
@@ -35,7 +35,7 @@
#include <windows.h>
#endif
-#if defined(__unix__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA)
+#if defined(__unix__) && !defined(__ANDROID__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA)
#pragma comment(lib, "pthread")
#endif
diff --git a/src/utility.cpp b/src/utility.cpp
index 016a5d91b85a..6a690dc2879e 100644
--- a/src/utility.cpp
+++ b/src/utility.cpp
@@ -10,6 +10,6 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-const piecewise_construct_t piecewise_construct = {};
+const piecewise_construct_t piecewise_construct{};
_LIBCPP_END_NAMESPACE_STD
diff --git a/src/valarray.cpp b/src/valarray.cpp
index 7bf0b4175889..64d26583c74b 100644
--- a/src/valarray.cpp
+++ b/src/valarray.cpp
@@ -12,8 +12,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// These two symbols are part of the v1 ABI but not part of the >=v2 ABI.
#if _LIBCPP_ABI_VERSION == 1
-template valarray<size_t>::valarray(size_t);
-template valarray<size_t>::~valarray();
+template _LIBCPP_FUNC_VIS valarray<size_t>::valarray(size_t);
+template _LIBCPP_FUNC_VIS valarray<size_t>::~valarray();
#endif
template void valarray<size_t>::resize(size_t, size_t);