diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-01-08 19:39:03 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-01-08 19:39:03 +0000 |
commit | aed8d94e97d1be8b4e26ce1ffb4d0547aee8ab1d (patch) | |
tree | f4b32ab9e34cda2eead99ae084f0b02d0dab6891 /contrib/libc++/src/system_error.cpp | |
parent | 657db61c2068b2bcc0d930546402284e2c9c9abd (diff) | |
parent | 4a2db4d30e1653093d4d8b06e8221e2f8b723507 (diff) |
Notes
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 87f35ae37f391..c547124768282 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 } |