diff options
Diffstat (limited to 'contrib/libc++/src/system_error.cpp')
-rw-r--r-- | contrib/libc++/src/system_error.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/contrib/libc++/src/system_error.cpp b/contrib/libc++/src/system_error.cpp index 87f35ae..c547124 100644 --- a/contrib/libc++/src/system_error.cpp +++ b/contrib/libc++/src/system_error.cpp @@ -29,9 +29,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD // class error_category +#if defined(_LIBCPP_DEPRECATED_ABI_EXTERNAL_ERROR_CATEGORY_CONSTRUCTOR) error_category::error_category() _NOEXCEPT { } +#endif error_category::~error_category() _NOEXCEPT { @@ -55,6 +57,7 @@ error_category::equivalent(const error_code& code, int condition) const _NOEXCEP return *this == code.category() && code.value() == condition; } +#if !defined(_LIBCPP_HAS_NO_THREADS) namespace { // GLIBC also uses 1024 as the maximum buffer size internally. @@ -62,8 +65,16 @@ constexpr size_t strerror_buff_size = 1024; string do_strerror_r(int ev); -#if defined(__linux__) && !defined(_LIBCPP_HAS_MUSL_LIBC) \ - && (!defined(__ANDROID__) || __ANDROID_API__ >= 23) +#if defined(_LIBCPP_MSVCRT) +string do_strerror_r(int ev) { + char buffer[strerror_buff_size]; + if (::strerror_s(buffer, strerror_buff_size, ev) == 0) + return string(buffer); + std::snprintf(buffer, strerror_buff_size, "unknown error %d", ev); + return string(buffer); +} +#elif defined(__linux__) && !defined(_LIBCPP_HAS_MUSL_LIBC) && \ + (!defined(__ANDROID__) || __ANDROID_API__ >= 23) // GNU Extended version string do_strerror_r(int ev) { char buffer[strerror_buff_size]; @@ -96,6 +107,7 @@ string do_strerror_r(int ev) { #endif } // end namespace +#endif string __do_message::message(int ev) const @@ -258,6 +270,7 @@ __throw_system_error(int ev, const char* what_arg) #else (void)ev; (void)what_arg; + _VSTD::abort(); #endif } |