mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 14:58:30 +00:00
parent
446a1f7c5a
commit
06f9a5b627
34 changed files with 115 additions and 51 deletions
1
third_party/libcxx/__config
vendored
1
third_party/libcxx/__config
vendored
|
@ -16,6 +16,7 @@
|
|||
#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
|
||||
#define _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
|
||||
#define _LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION
|
||||
#define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
|
|
8
third_party/libcxx/algorithm.cc
vendored
8
third_party/libcxx/algorithm.cc
vendored
|
@ -55,8 +55,10 @@ template unsigned __sort5<__less<long double>&, long double*>(long double*, long
|
|||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
_LIBCPP_SAFE_STATIC static __libcpp_mutex_t __rs_mut = _LIBCPP_MUTEX_INITIALIZER;
|
||||
#endif
|
||||
unsigned __rs_default::__c_ = 0;
|
||||
|
||||
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE) \
|
||||
|| defined(_LIBCPP_BUILDING_LIBRARY)
|
||||
unsigned __rs_default::__c_ = 0;
|
||||
__rs_default::__rs_default()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
|
@ -64,12 +66,10 @@ __rs_default::__rs_default()
|
|||
#endif
|
||||
__c_ = 1;
|
||||
}
|
||||
|
||||
__rs_default::__rs_default(const __rs_default&)
|
||||
{
|
||||
++__c_;
|
||||
}
|
||||
|
||||
__rs_default::~__rs_default()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
|
@ -79,13 +79,13 @@ __rs_default::~__rs_default()
|
|||
--__c_;
|
||||
#endif
|
||||
}
|
||||
|
||||
__rs_default::result_type
|
||||
__rs_default::operator()()
|
||||
{
|
||||
static mt19937 __rs_g;
|
||||
return __rs_g();
|
||||
}
|
||||
#endif
|
||||
|
||||
__rs_default
|
||||
__rs_get()
|
||||
|
|
8
third_party/libcxx/exception_fallback.hh
vendored
8
third_party/libcxx/exception_fallback.hh
vendored
|
@ -14,23 +14,25 @@
|
|||
namespace std {
|
||||
|
||||
_LIBCPP_SAFE_STATIC static std::terminate_handler __terminate_handler;
|
||||
_LIBCPP_SAFE_STATIC static std::unexpected_handler __unexpected_handler;
|
||||
|
||||
#if _LIBCPP_STD_VER <= 14 || \
|
||||
defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS) || \
|
||||
defined(_LIBCPP_BUILDING_LIBRARY)
|
||||
_LIBCPP_SAFE_STATIC static std::unexpected_handler __unexpected_handler;
|
||||
// libcxxrt provides implementations of these functions itself.
|
||||
unexpected_handler set_unexpected(unexpected_handler func) _NOEXCEPT {
|
||||
return __libcpp_atomic_exchange(&__unexpected_handler, func);
|
||||
}
|
||||
|
||||
unexpected_handler get_unexpected() _NOEXCEPT {
|
||||
return __libcpp_atomic_load(&__unexpected_handler);
|
||||
}
|
||||
|
||||
_LIBCPP_NORETURN
|
||||
void unexpected() {
|
||||
(*get_unexpected())();
|
||||
// unexpected handler should not return
|
||||
terminate();
|
||||
}
|
||||
#endif
|
||||
|
||||
terminate_handler set_terminate(terminate_handler func) _NOEXCEPT {
|
||||
return __libcpp_atomic_exchange(&__terminate_handler, func);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue