diff options
author | robot-contrib <robot-contrib@yandex-team.com> | 2022-08-23 11:58:00 +0300 |
---|---|---|
committer | robot-contrib <robot-contrib@yandex-team.com> | 2022-08-23 11:58:00 +0300 |
commit | 95330412936b4d7ccae8ad4e9870ecf21f0ec220 (patch) | |
tree | a1a606b113c3053ce66bd08dffc255a54f323701 /contrib | |
parent | d1147290456ee39303d010ba69ba3972162215f3 (diff) | |
download | ydb-95330412936b4d7ccae8ad4e9870ecf21f0ec220.tar.gz |
Update contrib/restricted/boost/system to 1.79.0
Diffstat (limited to 'contrib')
37 files changed, 3636 insertions, 1729 deletions
diff --git a/contrib/restricted/boost/assert/include/boost/assert/source_location.hpp b/contrib/restricted/boost/assert/include/boost/assert/source_location.hpp new file mode 100644 index 0000000000..14dff9ab80 --- /dev/null +++ b/contrib/restricted/boost/assert/include/boost/assert/source_location.hpp @@ -0,0 +1,189 @@ +#ifndef BOOST_ASSERT_SOURCE_LOCATION_HPP_INCLUDED +#define BOOST_ASSERT_SOURCE_LOCATION_HPP_INCLUDED + +// http://www.boost.org/libs/assert +// +// Copyright 2019, 2021 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// http://www.boost.org/LICENSE_1_0.txt + +#include <boost/current_function.hpp> +#include <boost/config.hpp> +#include <boost/config/workaround.hpp> +#include <boost/cstdint.hpp> +#include <iosfwd> +#include <string> +#include <cstdio> +#include <cstring> + +#if defined(__cpp_lib_source_location) && __cpp_lib_source_location >= 201907L +# error #include <source_location> +#endif + +namespace boost +{ + +struct source_location +{ +private: + + char const * file_; + char const * function_; + boost::uint_least32_t line_; + boost::uint_least32_t column_; + +public: + + BOOST_CONSTEXPR source_location() BOOST_NOEXCEPT: file_( "" ), function_( "" ), line_( 0 ), column_( 0 ) + { + } + + BOOST_CONSTEXPR source_location( char const * file, boost::uint_least32_t ln, char const * function, boost::uint_least32_t col = 0 ) BOOST_NOEXCEPT: file_( file ), function_( function ), line_( ln ), column_( col ) + { + } + +#if defined(__cpp_lib_source_location) && __cpp_lib_source_location >= 201907L + + BOOST_CONSTEXPR source_location( std::source_location const& loc ) BOOST_NOEXCEPT: file_( loc.file_name() ), function_( loc.function_name() ), line_( loc.line() ), column_( loc.column() ) + { + } + +#endif + + BOOST_CONSTEXPR char const * file_name() const BOOST_NOEXCEPT + { + return file_; + } + + BOOST_CONSTEXPR char const * function_name() const BOOST_NOEXCEPT + { + return function_; + } + + BOOST_CONSTEXPR boost::uint_least32_t line() const BOOST_NOEXCEPT + { + return line_; + } + + BOOST_CONSTEXPR boost::uint_least32_t column() const BOOST_NOEXCEPT + { + return column_; + } + +#if defined(BOOST_MSVC) +# pragma warning( push ) +# pragma warning( disable: 4996 ) +#endif + +#if ( defined(_MSC_VER) && _MSC_VER < 1900 ) || ( defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) ) +# define BOOST_ASSERT_SNPRINTF(buffer, format, arg) std::sprintf(buffer, format, arg) +#else +# define BOOST_ASSERT_SNPRINTF(buffer, format, arg) std::snprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), format, arg) +#endif + + std::string to_string() const + { + unsigned long ln = line(); + + if( ln == 0 ) + { + return "(unknown source location)"; + } + + std::string r = file_name(); + + char buffer[ 16 ]; + + BOOST_ASSERT_SNPRINTF( buffer, ":%lu", ln ); + r += buffer; + + unsigned long co = column(); + + if( co ) + { + BOOST_ASSERT_SNPRINTF( buffer, ":%lu", co ); + r += buffer; + } + + char const* fn = function_name(); + + if( *fn != 0 ) + { + r += " in function '"; + r += fn; + r += '\''; + } + + return r; + } + +#undef BOOST_ASSERT_SNPRINTF + +#if defined(BOOST_MSVC) +# pragma warning( pop ) +#endif + + inline friend bool operator==( source_location const& s1, source_location const& s2 ) BOOST_NOEXCEPT + { + return std::strcmp( s1.file_, s2.file_ ) == 0 && std::strcmp( s1.function_, s2.function_ ) == 0 && s1.line_ == s2.line_ && s1.column_ == s2.column_; + } + + inline friend bool operator!=( source_location const& s1, source_location const& s2 ) BOOST_NOEXCEPT + { + return !( s1 == s2 ); + } +}; + +template<class E, class T> std::basic_ostream<E, T> & operator<<( std::basic_ostream<E, T> & os, source_location const & loc ) +{ + os << loc.to_string(); + return os; +} + +} // namespace boost + +#if defined(BOOST_DISABLE_CURRENT_LOCATION) + +# define BOOST_CURRENT_LOCATION ::boost::source_location() + +#elif defined(BOOST_MSVC) && BOOST_MSVC >= 1926 + +// std::source_location::current() is available in -std:c++20, but fails with consteval errors before 19.31, and doesn't produce +// the correct result under 19.31, so prefer the built-ins +# define BOOST_CURRENT_LOCATION ::boost::source_location(__builtin_FILE(), __builtin_LINE(), __builtin_FUNCTION(), __builtin_COLUMN()) + +#elif defined(BOOST_MSVC) + +// __LINE__ is not a constant expression under /ZI (edit and continue) for 1925 and before + +# define BOOST_CURRENT_LOCATION_IMPL_1(x) BOOST_CURRENT_LOCATION_IMPL_2(x) +# define BOOST_CURRENT_LOCATION_IMPL_2(x) (x##0 / 10) + +# define BOOST_CURRENT_LOCATION ::boost::source_location(__FILE__, BOOST_CURRENT_LOCATION_IMPL_1(__LINE__), "") + +#elif defined(__cpp_lib_source_location) && __cpp_lib_source_location >= 201907L + +# define BOOST_CURRENT_LOCATION ::boost::source_location(::std::source_location::current()) + +#elif defined(BOOST_CLANG) && BOOST_CLANG_VERSION >= 90000 + +# define BOOST_CURRENT_LOCATION ::boost::source_location(__builtin_FILE(), __builtin_LINE(), __builtin_FUNCTION(), __builtin_COLUMN()) + +#elif defined(BOOST_GCC) && BOOST_GCC >= 70000 + +// The built-ins are available in 4.8+, but are not constant expressions until 7 +# define BOOST_CURRENT_LOCATION ::boost::source_location(__builtin_FILE(), __builtin_LINE(), __builtin_FUNCTION()) + +#elif defined(BOOST_GCC) && BOOST_GCC >= 50000 + +// __PRETTY_FUNCTION__ is allowed outside functions under GCC, but 4.x suffers from codegen bugs +# define BOOST_CURRENT_LOCATION ::boost::source_location(__FILE__, __LINE__, __PRETTY_FUNCTION__) + +#else + +// __func__ macros aren't allowed outside functions, but BOOST_CURRENT_LOCATION is +# define BOOST_CURRENT_LOCATION ::boost::source_location(__FILE__, __LINE__, "") + +#endif + +#endif // #ifndef BOOST_ASSERT_SOURCE_LOCATION_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/CMakeLists.txt b/contrib/restricted/boost/system/CMakeLists.txt index 8e7aebba39..778bdfb252 100644 --- a/contrib/restricted/boost/system/CMakeLists.txt +++ b/contrib/restricted/boost/system/CMakeLists.txt @@ -7,19 +7,15 @@ -add_library(restricted-boost-system) -target_include_directories(restricted-boost-system PUBLIC +add_library(restricted-boost-system INTERFACE) +target_include_directories(restricted-boost-system INTERFACE ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/system/include ) -target_link_libraries(restricted-boost-system PUBLIC +target_link_libraries(restricted-boost-system INTERFACE contrib-libs-cxxsupp yutil restricted-boost-assert restricted-boost-config - restricted-boost-core - restricted-boost-predef + restricted-boost-throw_exception restricted-boost-winapi ) -target_sources(restricted-boost-system PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/system/src/error_code.cpp -) diff --git a/contrib/restricted/boost/system/include/boost/cerrno.hpp b/contrib/restricted/boost/system/include/boost/cerrno.hpp index 57278f5cee..25323100f9 100644 --- a/contrib/restricted/boost/system/include/boost/cerrno.hpp +++ b/contrib/restricted/boost/system/include/boost/cerrno.hpp @@ -7,325 +7,9 @@ // See library home page at http://www.boost.org/libs/system -#ifndef BOOST_SYSTEM_CERRNO_HPP -#define BOOST_SYSTEM_CERRNO_HPP +#ifndef BOOST_CERRNO_HPP_INCLUDED +#define BOOST_CERRNO_HPP_INCLUDED -#include <cerrno> +#include <boost/system/detail/cerrno.hpp> -// supply errno values likely to be missing, particularly on Windows - -#ifndef EAFNOSUPPORT -#define EAFNOSUPPORT 9901 -#endif - -#ifndef EADDRINUSE -#define EADDRINUSE 9902 -#endif - -#ifndef EADDRNOTAVAIL -#define EADDRNOTAVAIL 9903 -#endif - -#ifndef EISCONN -#define EISCONN 9904 -#endif - -#ifndef EBADMSG -#define EBADMSG 9905 -#endif - -#ifndef ECONNABORTED -#define ECONNABORTED 9906 -#endif - -#ifndef EALREADY -#define EALREADY 9907 -#endif - -#ifndef ECONNREFUSED -#define ECONNREFUSED 9908 -#endif - -#ifndef ECONNRESET -#define ECONNRESET 9909 -#endif - -#ifndef EDESTADDRREQ -#define EDESTADDRREQ 9910 -#endif - -#ifndef EHOSTUNREACH -#define EHOSTUNREACH 9911 -#endif - -#ifndef EIDRM -#define EIDRM 9912 -#endif - -#ifndef EMSGSIZE -#define EMSGSIZE 9913 -#endif - -#ifndef ENETDOWN -#define ENETDOWN 9914 -#endif - -#ifndef ENETRESET -#define ENETRESET 9915 -#endif - -#ifndef ENETUNREACH -#define ENETUNREACH 9916 -#endif - -#ifndef ENOBUFS -#define ENOBUFS 9917 -#endif - -#ifndef ENOLINK -#define ENOLINK 9918 -#endif - -#ifndef ENODATA -#define ENODATA 9919 -#endif - -#ifndef ENOMSG -#define ENOMSG 9920 -#endif - -#ifndef ENOPROTOOPT -#define ENOPROTOOPT 9921 -#endif - -#ifndef ENOSR -#define ENOSR 9922 -#endif - -#ifndef ENOTSOCK -#define ENOTSOCK 9923 -#endif - -#ifndef ENOSTR -#define ENOSTR 9924 -#endif - -#ifndef ENOTCONN -#define ENOTCONN 9925 -#endif - -#ifndef ENOTSUP -#define ENOTSUP 9926 -#endif - -#ifndef ECANCELED -#define ECANCELED 9927 -#endif - -#ifndef EINPROGRESS -#define EINPROGRESS 9928 -#endif - -#ifndef EOPNOTSUPP -#define EOPNOTSUPP 9929 -#endif - -#ifndef EWOULDBLOCK -#define EWOULDBLOCK 9930 -#endif - -#ifndef EOWNERDEAD -#define EOWNERDEAD 9931 -#endif - -#ifndef EPROTO -#define EPROTO 9932 -#endif - -#ifndef EPROTONOSUPPORT -#define EPROTONOSUPPORT 9933 -#endif - -#ifndef ENOTRECOVERABLE -#define ENOTRECOVERABLE 9934 -#endif - -#ifndef ETIME -#define ETIME 9935 -#endif - -#ifndef ETXTBSY -#define ETXTBSY 9936 -#endif - -#ifndef ETIMEDOUT -#define ETIMEDOUT 9938 -#endif - -#ifndef ELOOP -#define ELOOP 9939 -#endif - -#ifndef EOVERFLOW -#define EOVERFLOW 9940 -#endif - -#ifndef EPROTOTYPE -#define EPROTOTYPE 9941 -#endif - -#ifndef ENOSYS -#define ENOSYS 9942 -#endif - -#ifndef EINVAL -#define EINVAL 9943 -#endif - -#ifndef ERANGE -#define ERANGE 9944 -#endif - -#ifndef EILSEQ -#define EILSEQ 9945 -#endif - -// Windows Mobile doesn't appear to define these: - -#ifndef E2BIG -#define E2BIG 9946 -#endif - -#ifndef EDOM -#define EDOM 9947 -#endif - -#ifndef EFAULT -#define EFAULT 9948 -#endif - -#ifndef EBADF -#define EBADF 9949 -#endif - -#ifndef EPIPE -#define EPIPE 9950 -#endif - -#ifndef EXDEV -#define EXDEV 9951 -#endif - -#ifndef EBUSY -#define EBUSY 9952 -#endif - -#ifndef ENOTEMPTY -#define ENOTEMPTY 9953 -#endif - -#ifndef ENOEXEC -#define ENOEXEC 9954 -#endif - -#ifndef EEXIST -#define EEXIST 9955 -#endif - -#ifndef EFBIG -#define EFBIG 9956 -#endif - -#ifndef ENAMETOOLONG -#define ENAMETOOLONG 9957 -#endif - -#ifndef ENOTTY -#define ENOTTY 9958 -#endif - -#ifndef EINTR -#define EINTR 9959 -#endif - -#ifndef ESPIPE -#define ESPIPE 9960 -#endif - -#ifndef EIO -#define EIO 9961 -#endif - -#ifndef EISDIR -#define EISDIR 9962 -#endif - -#ifndef ECHILD -#define ECHILD 9963 -#endif - -#ifndef ENOLCK -#define ENOLCK 9964 -#endif - -#ifndef ENOSPC -#define ENOSPC 9965 -#endif - -#ifndef ENXIO -#define ENXIO 9966 -#endif - -#ifndef ENODEV -#define ENODEV 9967 -#endif - -#ifndef ENOENT -#define ENOENT 9968 -#endif - -#ifndef ESRCH -#define ESRCH 9969 -#endif - -#ifndef ENOTDIR -#define ENOTDIR 9970 -#endif - -#ifndef ENOMEM -#define ENOMEM 9971 -#endif - -#ifndef EPERM -#define EPERM 9972 -#endif - -#ifndef EACCES -#define EACCES 9973 -#endif - -#ifndef EROFS -#define EROFS 9974 -#endif - -#ifndef EDEADLK -#define EDEADLK 9975 -#endif - -#ifndef EAGAIN -#define EAGAIN 9976 -#endif - -#ifndef ENFILE -#define ENFILE 9977 -#endif - -#ifndef EMFILE -#define EMFILE 9978 -#endif - -#ifndef EMLINK -#define EMLINK 9979 -#endif - -#endif // include guard +#endif // #ifndef BOOST_CERRNO_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/config.hpp b/contrib/restricted/boost/system/include/boost/system/config.hpp index 14faa63420..1e5f686511 100644 --- a/contrib/restricted/boost/system/include/boost/system/config.hpp +++ b/contrib/restricted/boost/system/include/boost/system/config.hpp @@ -7,15 +7,16 @@ // See http://www.boost.org/libs/system for documentation. -#ifndef BOOST_SYSTEM_CONFIG_HPP +#ifndef BOOST_SYSTEM_CONFIG_HPP #define BOOST_SYSTEM_CONFIG_HPP #include <boost/config.hpp> -#include <boost/predef/platform.h> #include <boost/system/api_config.hpp> // for BOOST_POSIX_API or BOOST_WINDOWS_API -// This header implements separate compilation features as described in +// This header implemented separate compilation features as described in // http://www.boost.org/more/separate_compilation.html +// +// It's only retained for compatibility now that the library is header-only. // normalize macros ------------------------------------------------------------------// @@ -46,25 +47,4 @@ # define BOOST_SYSTEM_DECL #endif -// enable automatic library variant selection ----------------------------------------// - -#if !defined(BOOST_SYSTEM_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_SYSTEM_NO_LIB) -// -// Set the name of our library, this will get undef'ed by auto_link.hpp -// once it's done with it: -// -#define BOOST_LIB_NAME boost_system -// -// If we're importing code from a dll, then tell auto_link.hpp about it: -// -#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SYSTEM_DYN_LINK) -# define BOOST_DYN_LINK -#endif -// -// And include the header that does the work: -// -#include <boost/config/auto_link.hpp> -#endif // auto-linking disabled - #endif // BOOST_SYSTEM_CONFIG_HPP - diff --git a/contrib/restricted/boost/system/include/boost/system/detail/append_int.hpp b/contrib/restricted/boost/system/include/boost/system/detail/append_int.hpp new file mode 100644 index 0000000000..d927376569 --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/detail/append_int.hpp @@ -0,0 +1,32 @@ +#ifndef BOOST_SYSTEM_DETAIL_APPEND_INT_HPP_INCLUDED +#define BOOST_SYSTEM_DETAIL_APPEND_INT_HPP_INCLUDED + +// Copyright 2021 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt) + +#include <boost/system/detail/snprintf.hpp> +#include <string> + +// + +namespace boost +{ +namespace system +{ +namespace detail +{ + +inline void append_int( std::string& s, int v ) +{ + char buffer[ 32 ]; + detail::snprintf( buffer, sizeof( buffer ), ":%d", v ); + + s += buffer; +} + +} // namespace detail +} // namespace system +} // namespace boost + +#endif // #ifndef BOOST_SYSTEM_DETAIL_APPEND_INT_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/detail/cerrno.hpp b/contrib/restricted/boost/system/include/boost/system/detail/cerrno.hpp new file mode 100644 index 0000000000..24dc28b4db --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/detail/cerrno.hpp @@ -0,0 +1,329 @@ +// Copyright Beman Dawes 2005. +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See library home page at http://www.boost.org/libs/system + +#ifndef BOOST_SYSTEM_DETAIL_CERRNO_HPP_INCLUDED +#define BOOST_SYSTEM_DETAIL_CERRNO_HPP_INCLUDED + +#include <cerrno> + +// supply errno values likely to be missing, particularly on Windows + +#ifndef EAFNOSUPPORT +#define EAFNOSUPPORT 9901 +#endif + +#ifndef EADDRINUSE +#define EADDRINUSE 9902 +#endif + +#ifndef EADDRNOTAVAIL +#define EADDRNOTAVAIL 9903 +#endif + +#ifndef EISCONN +#define EISCONN 9904 +#endif + +#ifndef EBADMSG +#define EBADMSG 9905 +#endif + +#ifndef ECONNABORTED +#define ECONNABORTED 9906 +#endif + +#ifndef EALREADY +#define EALREADY 9907 +#endif + +#ifndef ECONNREFUSED +#define ECONNREFUSED 9908 +#endif + +#ifndef ECONNRESET +#define ECONNRESET 9909 +#endif + +#ifndef EDESTADDRREQ +#define EDESTADDRREQ 9910 +#endif + +#ifndef EHOSTUNREACH +#define EHOSTUNREACH 9911 +#endif + +#ifndef EIDRM +#define EIDRM 9912 +#endif + +#ifndef EMSGSIZE +#define EMSGSIZE 9913 +#endif + +#ifndef ENETDOWN +#define ENETDOWN 9914 +#endif + +#ifndef ENETRESET +#define ENETRESET 9915 +#endif + +#ifndef ENETUNREACH +#define ENETUNREACH 9916 +#endif + +#ifndef ENOBUFS +#define ENOBUFS 9917 +#endif + +#ifndef ENOLINK +#define ENOLINK 9918 +#endif + +#ifndef ENODATA +#define ENODATA 9919 +#endif + +#ifndef ENOMSG +#define ENOMSG 9920 +#endif + +#ifndef ENOPROTOOPT +#define ENOPROTOOPT 9921 +#endif + +#ifndef ENOSR +#define ENOSR 9922 +#endif + +#ifndef ENOTSOCK +#define ENOTSOCK 9923 +#endif + +#ifndef ENOSTR +#define ENOSTR 9924 +#endif + +#ifndef ENOTCONN +#define ENOTCONN 9925 +#endif + +#ifndef ENOTSUP +#define ENOTSUP 9926 +#endif + +#ifndef ECANCELED +#define ECANCELED 9927 +#endif + +#ifndef EINPROGRESS +#define EINPROGRESS 9928 +#endif + +#ifndef EOPNOTSUPP +#define EOPNOTSUPP 9929 +#endif + +#ifndef EWOULDBLOCK +#define EWOULDBLOCK 9930 +#endif + +#ifndef EOWNERDEAD +#define EOWNERDEAD 9931 +#endif + +#ifndef EPROTO +#define EPROTO 9932 +#endif + +#ifndef EPROTONOSUPPORT +#define EPROTONOSUPPORT 9933 +#endif + +#ifndef ENOTRECOVERABLE +#define ENOTRECOVERABLE 9934 +#endif + +#ifndef ETIME +#define ETIME 9935 +#endif + +#ifndef ETXTBSY +#define ETXTBSY 9936 +#endif + +#ifndef ETIMEDOUT +#define ETIMEDOUT 9938 +#endif + +#ifndef ELOOP +#define ELOOP 9939 +#endif + +#ifndef EOVERFLOW +#define EOVERFLOW 9940 +#endif + +#ifndef EPROTOTYPE +#define EPROTOTYPE 9941 +#endif + +#ifndef ENOSYS +#define ENOSYS 9942 +#endif + +#ifndef EINVAL +#define EINVAL 9943 +#endif + +#ifndef ERANGE +#define ERANGE 9944 +#endif + +#ifndef EILSEQ +#define EILSEQ 9945 +#endif + +// Windows Mobile doesn't appear to define these: + +#ifndef E2BIG +#define E2BIG 9946 +#endif + +#ifndef EDOM +#define EDOM 9947 +#endif + +#ifndef EFAULT +#define EFAULT 9948 +#endif + +#ifndef EBADF +#define EBADF 9949 +#endif + +#ifndef EPIPE +#define EPIPE 9950 +#endif + +#ifndef EXDEV +#define EXDEV 9951 +#endif + +#ifndef EBUSY +#define EBUSY 9952 +#endif + +#ifndef ENOTEMPTY +#define ENOTEMPTY 9953 +#endif + +#ifndef ENOEXEC +#define ENOEXEC 9954 +#endif + +#ifndef EEXIST +#define EEXIST 9955 +#endif + +#ifndef EFBIG +#define EFBIG 9956 +#endif + +#ifndef ENAMETOOLONG +#define ENAMETOOLONG 9957 +#endif + +#ifndef ENOTTY +#define ENOTTY 9958 +#endif + +#ifndef EINTR +#define EINTR 9959 +#endif + +#ifndef ESPIPE +#define ESPIPE 9960 +#endif + +#ifndef EIO +#define EIO 9961 +#endif + +#ifndef EISDIR +#define EISDIR 9962 +#endif + +#ifndef ECHILD +#define ECHILD 9963 +#endif + +#ifndef ENOLCK +#define ENOLCK 9964 +#endif + +#ifndef ENOSPC +#define ENOSPC 9965 +#endif + +#ifndef ENXIO +#define ENXIO 9966 +#endif + +#ifndef ENODEV +#define ENODEV 9967 +#endif + +#ifndef ENOENT +#define ENOENT 9968 +#endif + +#ifndef ESRCH +#define ESRCH 9969 +#endif + +#ifndef ENOTDIR +#define ENOTDIR 9970 +#endif + +#ifndef ENOMEM +#define ENOMEM 9971 +#endif + +#ifndef EPERM +#define EPERM 9972 +#endif + +#ifndef EACCES +#define EACCES 9973 +#endif + +#ifndef EROFS +#define EROFS 9974 +#endif + +#ifndef EDEADLK +#define EDEADLK 9975 +#endif + +#ifndef EAGAIN +#define EAGAIN 9976 +#endif + +#ifndef ENFILE +#define ENFILE 9977 +#endif + +#ifndef EMFILE +#define EMFILE 9978 +#endif + +#ifndef EMLINK +#define EMLINK 9979 +#endif + +#endif // #ifndef BOOST_SYSTEM_DETAIL_CERRNO_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/detail/config.hpp b/contrib/restricted/boost/system/include/boost/system/detail/config.hpp new file mode 100644 index 0000000000..26e0a4cae8 --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/detail/config.hpp @@ -0,0 +1,81 @@ +#ifndef BOOST_SYSTEM_DETAIL_CONFIG_HPP_INCLUDED +#define BOOST_SYSTEM_DETAIL_CONFIG_HPP_INCLUDED + +// Copyright 2018-2022 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/system for documentation. + +#include <boost/config.hpp> +#include <boost/config/workaround.hpp> + +// BOOST_SYSTEM_HAS_SYSTEM_ERROR + +#if !defined(BOOST_NO_CXX11_HDR_SYSTEM_ERROR) && !defined(BOOST_NO_CXX11_HDR_ATOMIC) +# define BOOST_SYSTEM_HAS_SYSTEM_ERROR +#endif + +// BOOST_SYSTEM_NOEXCEPT +// Retained for backward compatibility + +#define BOOST_SYSTEM_NOEXCEPT BOOST_NOEXCEPT + +// BOOST_SYSTEM_HAS_CONSTEXPR + +#if !defined(BOOST_NO_CXX14_CONSTEXPR) +# define BOOST_SYSTEM_HAS_CONSTEXPR +#endif + +#if BOOST_WORKAROUND(BOOST_GCC, < 60000) +# undef BOOST_SYSTEM_HAS_CONSTEXPR +#endif + +#if defined(BOOST_SYSTEM_HAS_CONSTEXPR) +# define BOOST_SYSTEM_CONSTEXPR constexpr +#else +# define BOOST_SYSTEM_CONSTEXPR +#endif + +// BOOST_SYSTEM_DEPRECATED + +#if defined(__clang__) +# define BOOST_SYSTEM_DEPRECATED(msg) __attribute__((deprecated(msg))) +#elif defined(__GNUC__) +# if __GNUC__ * 100 + __GNUC_MINOR__ >= 405 +# define BOOST_SYSTEM_DEPRECATED(msg) __attribute__((deprecated(msg))) +# else +# define BOOST_SYSTEM_DEPRECATED(msg) __attribute__((deprecated)) +# endif +#elif defined(_MSC_VER) +# define BOOST_SYSTEM_DEPRECATED(msg) __declspec(deprecated(msg)) +#elif defined(__sun) +# define BOOST_SYSTEM_DEPRECATED(msg) __attribute__((deprecated(msg))) +#else +# define BOOST_SYSTEM_DEPRECATED(msg) +#endif + +// BOOST_SYSTEM_CLANG_6 + +#if defined(__clang__) && (__clang_major__ < 7 || (defined(__APPLE__) && __clang_major__ < 11)) +# define BOOST_SYSTEM_CLANG_6 +#endif + +// + +#if defined(BOOST_LIBSTDCXX_VERSION) && BOOST_LIBSTDCXX_VERSION < 50000 +# define BOOST_SYSTEM_AVOID_STD_GENERIC_CATEGORY +#endif + +#if defined(__CYGWIN__) || defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER == 1800) || (defined(BOOST_LIBSTDCXX_VERSION) && BOOST_LIBSTDCXX_VERSION < 90000) + +// Under Cygwin (and MinGW!), std::system_category() is POSIX +// Under VS2013, std::system_category() isn't quite right +// Under libstdc++ before 7.4, before 8.3, before 9.1, default_error_condition +// for the system category returns a condition from the system category + +# define BOOST_SYSTEM_AVOID_STD_SYSTEM_CATEGORY +#endif + +#endif // BOOST_SYSTEM_DETAIL_CONFIG_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/detail/enable_if.hpp b/contrib/restricted/boost/system/include/boost/system/detail/enable_if.hpp new file mode 100644 index 0000000000..7f3d70bae3 --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/detail/enable_if.hpp @@ -0,0 +1,32 @@ +#ifndef BOOST_SYSTEM_DETAIL_ENABLE_IF_HPP_INCLUDED +#define BOOST_SYSTEM_DETAIL_ENABLE_IF_HPP_INCLUDED + +// Copyright 2020 Peter Dimov +// Distributed under the Boost Software License, Version 1.0 +// http://www.boost.org/LICENSE_1_0.txt + +namespace boost +{ + +namespace system +{ + +namespace detail +{ + +template<bool C, class T = void> struct enable_if +{ + typedef T type; +}; + +template<class T> struct enable_if<false, T> +{ +}; + +} // namespace detail + +} // namespace system + +} // namespace boost + +#endif // #ifndef BOOST_SYSTEM_DETAIL_ENABLE_IF_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/detail/errc.hpp b/contrib/restricted/boost/system/include/boost/system/detail/errc.hpp new file mode 100644 index 0000000000..8fae09482b --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/detail/errc.hpp @@ -0,0 +1,126 @@ +#ifndef BOOST_SYSTEM_DETAIL_ERRC_HPP_INCLUDED +#define BOOST_SYSTEM_DETAIL_ERRC_HPP_INCLUDED + +// Copyright Beman Dawes 2006, 2007 +// Copyright Christoper Kohlhoff 2007 +// Copyright Peter Dimov 2017, 2018, 2020 +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See library home page at http://www.boost.org/libs/system + +#include <boost/system/is_error_condition_enum.hpp> +#include <boost/system/detail/cerrno.hpp> + +namespace boost +{ + +namespace system +{ + +namespace errc +{ + +enum errc_t +{ + success = 0, + address_family_not_supported = EAFNOSUPPORT, + address_in_use = EADDRINUSE, + address_not_available = EADDRNOTAVAIL, + already_connected = EISCONN, + argument_list_too_long = E2BIG, + argument_out_of_domain = EDOM, + bad_address = EFAULT, + bad_file_descriptor = EBADF, + bad_message = EBADMSG, + broken_pipe = EPIPE, + connection_aborted = ECONNABORTED, + connection_already_in_progress = EALREADY, + connection_refused = ECONNREFUSED, + connection_reset = ECONNRESET, + cross_device_link = EXDEV, + destination_address_required = EDESTADDRREQ, + device_or_resource_busy = EBUSY, + directory_not_empty = ENOTEMPTY, + executable_format_error = ENOEXEC, + file_exists = EEXIST, + file_too_large = EFBIG, + filename_too_long = ENAMETOOLONG, + function_not_supported = ENOSYS, + host_unreachable = EHOSTUNREACH, + identifier_removed = EIDRM, + illegal_byte_sequence = EILSEQ, + inappropriate_io_control_operation = ENOTTY, + interrupted = EINTR, + invalid_argument = EINVAL, + invalid_seek = ESPIPE, + io_error = EIO, + is_a_directory = EISDIR, + message_size = EMSGSIZE, + network_down = ENETDOWN, + network_reset = ENETRESET, + network_unreachable = ENETUNREACH, + no_buffer_space = ENOBUFS, + no_child_process = ECHILD, + no_link = ENOLINK, + no_lock_available = ENOLCK, + no_message_available = ENODATA, + no_message = ENOMSG, + no_protocol_option = ENOPROTOOPT, + no_space_on_device = ENOSPC, + no_stream_resources = ENOSR, + no_such_device_or_address = ENXIO, + no_such_device = ENODEV, + no_such_file_or_directory = ENOENT, + no_such_process = ESRCH, + not_a_directory = ENOTDIR, + not_a_socket = ENOTSOCK, + not_a_stream = ENOSTR, + not_connected = ENOTCONN, + not_enough_memory = ENOMEM, + not_supported = ENOTSUP, + operation_canceled = ECANCELED, + operation_in_progress = EINPROGRESS, + operation_not_permitted = EPERM, + operation_not_supported = EOPNOTSUPP, + operation_would_block = EWOULDBLOCK, + owner_dead = EOWNERDEAD, + permission_denied = EACCES, + protocol_error = EPROTO, + protocol_not_supported = EPROTONOSUPPORT, + read_only_file_system = EROFS, + resource_deadlock_would_occur = EDEADLK, + resource_unavailable_try_again = EAGAIN, + result_out_of_range = ERANGE, + state_not_recoverable = ENOTRECOVERABLE, + stream_timeout = ETIME, + text_file_busy = ETXTBSY, + timed_out = ETIMEDOUT, + too_many_files_open_in_system = ENFILE, + too_many_files_open = EMFILE, + too_many_links = EMLINK, + too_many_symbolic_link_levels = ELOOP, + value_too_large = EOVERFLOW, + wrong_protocol_type = EPROTOTYPE +}; + +} // namespace errc + +#ifdef BOOST_SYSTEM_ENABLE_DEPRECATED + +namespace posix = errc; +namespace posix_error = errc; + +#endif + +template<> struct is_error_condition_enum<errc::errc_t> +{ + static const bool value = true; +}; + +} // namespace system + +} // namespace boost + +#endif // #ifndef BOOST_SYSTEM_DETAIL_ERRC_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/detail/error_category.hpp b/contrib/restricted/boost/system/include/boost/system/detail/error_category.hpp new file mode 100644 index 0000000000..a205d81cab --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/detail/error_category.hpp @@ -0,0 +1,198 @@ +#ifndef BOOST_SYSTEM_DETAIL_ERROR_CATEGORY_HPP_INCLUDED +#define BOOST_SYSTEM_DETAIL_ERROR_CATEGORY_HPP_INCLUDED + +// Copyright Beman Dawes 2006, 2007 +// Copyright Christoper Kohlhoff 2007 +// Copyright Peter Dimov 2017, 2018 +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See library home page at http://www.boost.org/libs/system + +#include <boost/system/detail/config.hpp> +#include <boost/cstdint.hpp> +#include <boost/config.hpp> +#include <string> +#include <functional> +#include <cstddef> + +#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) +# include <system_error> +# include <atomic> +#endif + +namespace boost +{ + +namespace system +{ + +class error_category; +class error_code; +class error_condition; + +std::size_t hash_value( error_code const & ec ); + +namespace detail +{ + +BOOST_SYSTEM_CONSTEXPR bool failed_impl( int ev, error_category const & cat ); + +class std_category; + +} // namespace detail + +#if ( defined( BOOST_GCC ) && BOOST_GCC >= 40600 ) || defined( BOOST_CLANG ) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wnon-virtual-dtor" +#endif + +class BOOST_SYMBOL_VISIBLE error_category +{ +private: + + friend std::size_t hash_value( error_code const & ec ); + friend BOOST_SYSTEM_CONSTEXPR bool detail::failed_impl( int ev, error_category const & cat ); + + friend class error_code; + friend class error_condition; + +#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) +public: + + error_category( error_category const & ) = delete; + error_category& operator=( error_category const & ) = delete; + +#else +private: + + error_category( error_category const & ); + error_category& operator=( error_category const & ); + +#endif + +private: + + boost::ulong_long_type id_; + +#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) + + mutable std::atomic< boost::system::detail::std_category* > ps_; + +#else + + boost::system::detail::std_category* ps_; + +#endif + +protected: + +#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) && !defined(BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS) + + ~error_category() = default; + +#else + + // We'd like to make the destructor protected, to make code that deletes + // an error_category* not compile; unfortunately, doing the below makes + // the destructor user-provided and hence breaks use after main, as the + // categories may get destroyed before code that uses them + + // ~error_category() {} + +#endif + + BOOST_SYSTEM_CONSTEXPR error_category() BOOST_NOEXCEPT: id_( 0 ), ps_() + { + } + + explicit BOOST_SYSTEM_CONSTEXPR error_category( boost::ulong_long_type id ) BOOST_NOEXCEPT: id_( id ), ps_() + { + } + +public: + + virtual const char * name() const BOOST_NOEXCEPT = 0; + + virtual error_condition default_error_condition( int ev ) const BOOST_NOEXCEPT; + virtual bool equivalent( int code, const error_condition & condition ) const BOOST_NOEXCEPT; + virtual bool equivalent( const error_code & code, int condition ) const BOOST_NOEXCEPT; + + virtual std::string message( int ev ) const = 0; + virtual char const * message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT; + + virtual bool failed( int ev ) const BOOST_NOEXCEPT + { + return ev != 0; + } + + friend BOOST_SYSTEM_CONSTEXPR bool operator==( error_category const & lhs, error_category const & rhs ) BOOST_NOEXCEPT + { + return rhs.id_ == 0? &lhs == &rhs: lhs.id_ == rhs.id_; + } + + friend BOOST_SYSTEM_CONSTEXPR bool operator!=( error_category const & lhs, error_category const & rhs ) BOOST_NOEXCEPT + { + return !( lhs == rhs ); + } + + friend BOOST_SYSTEM_CONSTEXPR bool operator<( error_category const & lhs, error_category const & rhs ) BOOST_NOEXCEPT + { + if( lhs.id_ < rhs.id_ ) + { + return true; + } + + if( lhs.id_ > rhs.id_ ) + { + return false; + } + + if( rhs.id_ != 0 ) + { + return false; // equal + } + + return std::less<error_category const *>()( &lhs, &rhs ); + } + +#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) +# if defined(__SUNPRO_CC) // trailing __global is not supported + operator std::error_category const & () const; +# else + operator std::error_category const & () const BOOST_SYMBOL_VISIBLE; +# endif +#endif +}; + +#if ( defined( BOOST_GCC ) && BOOST_GCC >= 40600 ) || defined( BOOST_CLANG ) +#pragma GCC diagnostic pop +#endif + +namespace detail +{ + +static const boost::ulong_long_type generic_category_id = ( boost::ulong_long_type( 0xB2AB117A ) << 32 ) + 0x257EDFD0; +static const boost::ulong_long_type system_category_id = generic_category_id + 1; +static const boost::ulong_long_type interop_category_id = generic_category_id + 2; + +BOOST_SYSTEM_CONSTEXPR inline bool failed_impl( int ev, error_category const & cat ) +{ + if( cat.id_ == system_category_id || cat.id_ == generic_category_id ) + { + return ev != 0; + } + else + { + return cat.failed( ev ); + } +} + +} // namespace detail + +} // namespace system + +} // namespace boost + +#endif // #ifndef BOOST_SYSTEM_DETAIL_ERROR_CATEGORY_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/detail/error_category_impl.hpp b/contrib/restricted/boost/system/include/boost/system/detail/error_category_impl.hpp new file mode 100644 index 0000000000..e37d4ba6a6 --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/detail/error_category_impl.hpp @@ -0,0 +1,164 @@ +#ifndef BOOST_SYSTEM_DETAIL_ERROR_CATEGORY_IMPL_HPP_INCLUDED +#define BOOST_SYSTEM_DETAIL_ERROR_CATEGORY_IMPL_HPP_INCLUDED + +// Copyright Beman Dawes 2006, 2007 +// Copyright Christoper Kohlhoff 2007 +// Copyright Peter Dimov 2017, 2018 +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See library home page at http://www.boost.org/libs/system + +#include <boost/system/detail/error_category.hpp> +#include <boost/system/detail/error_condition.hpp> +#include <boost/system/detail/error_code.hpp> +#include <boost/system/detail/snprintf.hpp> +#include <boost/system/detail/config.hpp> +#include <boost/config.hpp> +#include <string> +#include <cstring> + +namespace boost +{ +namespace system +{ + +// error_category default implementation + +inline error_condition error_category::default_error_condition( int ev ) const BOOST_NOEXCEPT +{ + return error_condition( ev, *this ); +} + +inline bool error_category::equivalent( int code, const error_condition & condition ) const BOOST_NOEXCEPT +{ + return default_error_condition( code ) == condition; +} + +inline bool error_category::equivalent( const error_code & code, int condition ) const BOOST_NOEXCEPT +{ + return code.equals( condition, *this ); +} + +inline char const * error_category::message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT +{ + if( len == 0 ) + { + return buffer; + } + + if( len == 1 ) + { + buffer[0] = 0; + return buffer; + } + +#if !defined(BOOST_NO_EXCEPTIONS) + try +#endif + { + std::string m = this->message( ev ); + +# if defined( BOOST_MSVC ) +# pragma warning( push ) +# pragma warning( disable: 4996 ) +# elif defined(__clang__) && defined(__has_warning) +# pragma clang diagnostic push +# if __has_warning("-Wdeprecated-declarations") +# pragma clang diagnostic ignored "-Wdeprecated-declarations" +# endif +# endif + + std::strncpy( buffer, m.c_str(), len - 1 ); + buffer[ len-1 ] = 0; + +# if defined( BOOST_MSVC ) +# pragma warning( pop ) +# elif defined(__clang__) && defined(__has_warning) +# pragma clang diagnostic pop +# endif + + return buffer; + } +#if !defined(BOOST_NO_EXCEPTIONS) + catch( ... ) + { + detail::snprintf( buffer, len, "No message text available for error %d", ev ); + return buffer; + } +#endif +} + +} // namespace system +} // namespace boost + +// interoperability with std::error_code, std::error_condition + +#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) + +#include <boost/system/detail/std_category.hpp> + +namespace boost +{ +namespace system +{ + +inline error_category::operator std::error_category const & () const +{ + if( id_ == detail::generic_category_id ) + { +// This condition must be the same as the one in error_condition.hpp +#if defined(BOOST_SYSTEM_AVOID_STD_GENERIC_CATEGORY) + + static const boost::system::detail::std_category generic_instance( this, 0x1F4D3 ); + return generic_instance; + +#else + + return std::generic_category(); + +#endif + } + + if( id_ == detail::system_category_id ) + { +// This condition must be the same as the one in error_code.hpp +#if defined(BOOST_SYSTEM_AVOID_STD_SYSTEM_CATEGORY) + + static const boost::system::detail::std_category system_instance( this, 0x1F4D7 ); + return system_instance; + +#else + + return std::system_category(); + +#endif + } + + detail::std_category* p = ps_.load( std::memory_order_acquire ); + + if( p != 0 ) + { + return *p; + } + + detail::std_category* q = new detail::std_category( this, 0 ); + + if( ps_.compare_exchange_strong( p, q, std::memory_order_release, std::memory_order_acquire ) ) + { + return *q; + } + else + { + delete q; + return *p; + } +} + +} // namespace system +} // namespace boost + +#endif // #if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) + +#endif // #ifndef BOOST_SYSTEM_DETAIL_ERROR_CATEGORY_IMPL_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/detail/error_code.hpp b/contrib/restricted/boost/system/include/boost/system/detail/error_code.hpp new file mode 100644 index 0000000000..587b3abddf --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/detail/error_code.hpp @@ -0,0 +1,716 @@ +#ifndef BOOST_SYSTEM_DETAIL_ERROR_CODE_HPP_INCLUDED +#define BOOST_SYSTEM_DETAIL_ERROR_CODE_HPP_INCLUDED + +// Copyright Beman Dawes 2006, 2007 +// Copyright Christoper Kohlhoff 2007 +// Copyright Peter Dimov 2017-2021 +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See library home page at http://www.boost.org/libs/system + +#include <boost/system/is_error_code_enum.hpp> +#include <boost/system/detail/error_category.hpp> +#include <boost/system/detail/error_condition.hpp> +#include <boost/system/detail/system_category.hpp> +#include <boost/system/detail/system_category_impl.hpp> +#include <boost/system/detail/interop_category.hpp> +#include <boost/system/detail/enable_if.hpp> +#include <boost/system/detail/is_same.hpp> +#include <boost/system/detail/append_int.hpp> +#include <boost/system/detail/snprintf.hpp> +#include <boost/system/detail/config.hpp> +#include <boost/assert/source_location.hpp> +#include <boost/cstdint.hpp> +#include <boost/config.hpp> +#include <ostream> +#include <new> +#include <cstdio> + +#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) +# include <system_error> +#endif + +#if defined(BOOST_GCC) && BOOST_GCC >= 40600 && BOOST_GCC < 70000 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif + +namespace boost +{ + +namespace system +{ + +// class error_code + +// We want error_code to be a value type that can be copied without slicing +// and without requiring heap allocation, but we also want it to have +// polymorphic behavior based on the error category. This is achieved by +// abstract base class error_category supplying the polymorphic behavior, +// and error_code containing a pointer to an object of a type derived +// from error_category. + +std::size_t hash_value( error_code const & ec ); + +class error_code +{ +private: + + friend std::size_t hash_value( error_code const & ec ); + +private: + + struct data + { + int val_; + const error_category * cat_; + }; + + union + { + data d1_; +#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) + unsigned char d2_[ sizeof(std::error_code) ]; +#endif + }; + + // 0: default constructed, d1_ value initialized + // 1: holds std::error_code in d2_ + // 2: holds error code in d1_, failed == false + // 3: holds error code in d1_, failed == true + // >3: pointer to source_location, failed_ in lsb + boost::uintptr_t lc_flags_; + +private: + + char const* category_name() const BOOST_NOEXCEPT + { + // return category().name(); + + if( lc_flags_ == 0 ) + { + // must match detail::system_error_category::name() + return "system"; + } + else if( lc_flags_ == 1 ) + { + // must match detail::interop_error_category::name() + return "std:unknown"; + } + else + { + return d1_.cat_->name(); + } + } + +public: + + // constructors: + + BOOST_SYSTEM_CONSTEXPR error_code() BOOST_NOEXCEPT: + d1_(), lc_flags_( 0 ) + { + } + + BOOST_SYSTEM_CONSTEXPR error_code( int val, const error_category & cat ) BOOST_NOEXCEPT: + d1_(), lc_flags_( 2 + detail::failed_impl( val, cat ) ) + { + d1_.val_ = val; + d1_.cat_ = &cat; + } + + error_code( int val, const error_category & cat, source_location const * loc ) BOOST_NOEXCEPT: + d1_(), lc_flags_( ( loc? reinterpret_cast<boost::uintptr_t>( loc ): 2 ) | +detail::failed_impl( val, cat ) ) + { + d1_.val_ = val; + d1_.cat_ = &cat; + } + + template<class ErrorCodeEnum> BOOST_SYSTEM_CONSTEXPR error_code( ErrorCodeEnum e, + typename detail::enable_if< + is_error_code_enum<ErrorCodeEnum>::value +#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) + || std::is_error_code_enum<ErrorCodeEnum>::value +#endif + >::type* = 0 ) BOOST_NOEXCEPT: d1_(), lc_flags_( 0 ) + { + *this = make_error_code( e ); + } + + template<class ErrorCodeEnum> error_code( ErrorCodeEnum e, source_location const * loc, + typename detail::enable_if<is_error_code_enum<ErrorCodeEnum>::value>::type* = 0 ) BOOST_NOEXCEPT: + d1_(), lc_flags_( 0 ) + { + error_code e2 = make_error_code( e ); + + if( e2.lc_flags_ == 0 || e2.lc_flags_ == 1 ) + { + *this = e2; + } + else + { + *this = error_code( e2.d1_.val_, *e2.d1_.cat_, loc ); + } + } + +#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) + + error_code( std::error_code const& ec ) BOOST_NOEXCEPT: + lc_flags_( 1 ) + { + ::new( d2_ ) std::error_code( ec ); + } + +#endif + + // modifiers: + + BOOST_SYSTEM_CONSTEXPR void assign( int val, const error_category & cat ) BOOST_NOEXCEPT + { + *this = error_code( val, cat ); + } + + void assign( int val, const error_category & cat, source_location const * loc ) BOOST_NOEXCEPT + { + *this = error_code( val, cat, loc ); + } + + template<typename ErrorCodeEnum> + BOOST_SYSTEM_CONSTEXPR typename detail::enable_if<is_error_code_enum<ErrorCodeEnum>::value, error_code>::type & + operator=( ErrorCodeEnum val ) BOOST_NOEXCEPT + { + *this = make_error_code( val ); + return *this; + } + + template<typename ErrorCodeEnum> + typename detail::enable_if<is_error_code_enum<ErrorCodeEnum>::value, void>::type + assign( ErrorCodeEnum val, source_location const * loc ) BOOST_NOEXCEPT + { + *this = error_code( val, loc ); + } + + BOOST_SYSTEM_CONSTEXPR void clear() BOOST_NOEXCEPT + { + *this = error_code(); + } + + // observers: + + BOOST_SYSTEM_CONSTEXPR int value() const BOOST_NOEXCEPT + { + if( lc_flags_ != 1 ) + { + return d1_.val_; + } + else + { +#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) + + std::error_code const& ec = *reinterpret_cast<std::error_code const*>( d2_ ); + + unsigned cv = static_cast<unsigned>( ec.value() ); + unsigned ch = static_cast<unsigned>( reinterpret_cast<boost::uintptr_t>( &ec.category() ) % 2097143 ); // 2^21-9, prime + + return static_cast<int>( cv + 1000 * ch ); +#else + + return -1; +#endif + } + } + + BOOST_SYSTEM_CONSTEXPR const error_category & category() const BOOST_NOEXCEPT + { + if( lc_flags_ == 0 ) + { + return system_category(); + } + else if( lc_flags_ == 1 ) + { + return detail::interop_category(); + } + else + { + return *d1_.cat_; + } + } + + // deprecated? + error_condition default_error_condition() const BOOST_NOEXCEPT + { + return category().default_error_condition( value() ); + } + + std::string message() const + { +#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) + + if( lc_flags_ == 1 ) + { + std::error_code const& ec = *reinterpret_cast<std::error_code const*>( d2_ ); + return ec.message(); + } + +#endif + + if( lc_flags_ == 0 ) + { + return detail::system_error_category_message( value() ); + } + else + { + return category().message( value() ); + } + } + + char const * message( char * buffer, std::size_t len ) const BOOST_NOEXCEPT + { +#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) + if( lc_flags_ == 1 ) + { + std::error_code const& ec = *reinterpret_cast<std::error_code const*>( d2_ ); + +#if !defined(BOOST_NO_EXCEPTIONS) + try +#endif + { + detail::snprintf( buffer, len, "%s", ec.message().c_str() ); + return buffer; + } +#if !defined(BOOST_NO_EXCEPTIONS) + catch( ... ) + { + detail::snprintf( buffer, len, "No message text available for error std:%s:%d", ec.category().name(), ec.value() ); + return buffer; + } +#endif + } +#endif + + if( lc_flags_ == 0 ) + { + return detail::system_error_category_message( value(), buffer, len ); + } + else + { + return category().message( value(), buffer, len ); + } + } + + BOOST_SYSTEM_CONSTEXPR bool failed() const BOOST_NOEXCEPT + { + if( lc_flags_ & 1 ) + { +#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) + if( lc_flags_ == 1 ) + { + std::error_code const& ec = *reinterpret_cast<std::error_code const*>( d2_ ); + return ec.value() != 0; + } +#endif + return true; + } + else + { + return false; + } + } + +#if !defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) + + BOOST_SYSTEM_CONSTEXPR explicit operator bool() const BOOST_NOEXCEPT // true if error + { + return failed(); + } + +#else + + typedef void (*unspecified_bool_type)(); + static void unspecified_bool_true() {} + + BOOST_SYSTEM_CONSTEXPR operator unspecified_bool_type() const BOOST_NOEXCEPT // true if error + { + return failed()? unspecified_bool_true: 0; + } + + BOOST_SYSTEM_CONSTEXPR bool operator!() const BOOST_NOEXCEPT // true if no error + { + return !failed(); + } + +#endif + + bool has_location() const BOOST_NOEXCEPT + { + return lc_flags_ >= 4; + } + + source_location const & location() const BOOST_NOEXCEPT + { + BOOST_STATIC_CONSTEXPR source_location loc; + return lc_flags_ >= 4? *reinterpret_cast<source_location const*>( lc_flags_ &~ static_cast<boost::uintptr_t>( 1 ) ): loc; + } + + // relationals: + +private: + + // private equality for use in error_category::equivalent + + friend class error_category; + + BOOST_SYSTEM_CONSTEXPR bool equals( int val, error_category const& cat ) const BOOST_NOEXCEPT + { + if( lc_flags_ == 0 ) + { + return val == 0 && cat.id_ == detail::system_category_id; + } + else if( lc_flags_ == 1 ) + { + return cat.id_ == detail::interop_category_id && val == value(); + } + else + { + return val == d1_.val_ && cat == *d1_.cat_; + } + } + +public: + + // the more symmetrical non-member syntax allows enum + // conversions work for both rhs and lhs. + + BOOST_SYSTEM_CONSTEXPR inline friend bool operator==( const error_code & lhs, const error_code & rhs ) BOOST_NOEXCEPT + { +#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) + + if( lhs.lc_flags_ == 1 && rhs.lc_flags_ == 1 ) + { + std::error_code const& e1 = *reinterpret_cast<std::error_code const*>( lhs.d2_ ); + std::error_code const& e2 = *reinterpret_cast<std::error_code const*>( rhs.d2_ ); + + return e1 == e2; + } + else +#endif + { + return lhs.value() == rhs.value() && lhs.category() == rhs.category(); + } + } + + BOOST_SYSTEM_CONSTEXPR inline friend bool operator<( const error_code & lhs, const error_code & rhs ) BOOST_NOEXCEPT + { +#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) + + if( lhs.lc_flags_ == 1 && rhs.lc_flags_ == 1 ) + { + std::error_code const& e1 = *reinterpret_cast<std::error_code const*>( lhs.d2_ ); + std::error_code const& e2 = *reinterpret_cast<std::error_code const*>( rhs.d2_ ); + + return e1 < e2; + } + else +#endif + { + return lhs.category() < rhs.category() || (lhs.category() == rhs.category() && lhs.value() < rhs.value()); + } + } + + BOOST_SYSTEM_CONSTEXPR inline friend bool operator!=( const error_code & lhs, const error_code & rhs ) BOOST_NOEXCEPT + { + return !( lhs == rhs ); + } + + inline friend bool operator==( const error_code & code, const error_condition & condition ) BOOST_NOEXCEPT + { +#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) + + if( code.lc_flags_ == 1 ) + { + return static_cast<std::error_code>( code ) == static_cast<std::error_condition>( condition ); + } + else + +#endif + { + return code.category().equivalent( code.value(), condition ) || condition.category().equivalent( code, condition.value() ); + } + } + + inline friend bool operator==( const error_condition & condition, const error_code & code ) BOOST_NOEXCEPT + { +#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) + + if( code.lc_flags_ == 1 ) + { + return static_cast<std::error_code>( code ) == static_cast<std::error_condition>( condition ); + } + else + +#endif + { + return code.category().equivalent( code.value(), condition ) || condition.category().equivalent( code, condition.value() ); + } + } + + inline friend bool operator!=( const error_code & lhs, const error_condition & rhs ) BOOST_NOEXCEPT + { + return !( lhs == rhs ); + } + + inline friend bool operator!=( const error_condition & lhs, const error_code & rhs ) BOOST_NOEXCEPT + { + return !( lhs == rhs ); + } + +#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) + + inline friend bool operator==( std::error_code const & lhs, error_code const & rhs ) BOOST_NOEXCEPT + { + return lhs == static_cast< std::error_code >( rhs ); + } + + inline friend bool operator==( error_code const & lhs, std::error_code const & rhs ) BOOST_NOEXCEPT + { + return static_cast< std::error_code >( lhs ) == rhs; + } + + inline friend bool operator!=( std::error_code const & lhs, error_code const & rhs ) BOOST_NOEXCEPT + { + return !( lhs == rhs ); + } + + inline friend bool operator!=( error_code const & lhs, std::error_code const & rhs ) BOOST_NOEXCEPT + { + return !( lhs == rhs ); + } + + // + + template<class E, class N = typename detail::enable_if<std::is_error_condition_enum<E>::value>::type> + inline friend bool operator==( error_code const & lhs, E rhs ) BOOST_NOEXCEPT + { + return lhs == make_error_condition( rhs ); + } + + template<class E, class N = typename detail::enable_if<std::is_error_condition_enum<E>::value>::type> + inline friend bool operator==( E lhs, error_code const & rhs ) BOOST_NOEXCEPT + { + return make_error_condition( lhs ) == rhs; + } + + template<class E, class N = typename detail::enable_if<std::is_error_condition_enum<E>::value>::type> + inline friend bool operator!=( error_code const & lhs, E rhs ) BOOST_NOEXCEPT + { + return !( lhs == rhs ); + } + + template<class E, class N = typename detail::enable_if<std::is_error_condition_enum<E>::value>::type> + inline friend bool operator!=( E lhs, error_code const & rhs ) BOOST_NOEXCEPT + { + return !( lhs == rhs ); + } + + // + + template<class E, class N1 = void, class N2 = typename detail::enable_if<std::is_error_code_enum<E>::value>::type> + BOOST_SYSTEM_CONSTEXPR inline friend bool operator==( error_code const & lhs, E rhs ) BOOST_NOEXCEPT + { + return lhs == make_error_code( rhs ); + } + + template<class E, class N1 = void, class N2 = typename detail::enable_if<std::is_error_code_enum<E>::value>::type> + BOOST_SYSTEM_CONSTEXPR inline friend bool operator==( E lhs, error_code const & rhs ) BOOST_NOEXCEPT + { + return make_error_code( lhs ) == rhs; + } + + template<class E, class N1 = void, class N2 = typename detail::enable_if<std::is_error_code_enum<E>::value>::type> + BOOST_SYSTEM_CONSTEXPR inline friend bool operator!=( error_code const & lhs, E rhs ) BOOST_NOEXCEPT + { + return !( lhs == rhs ); + } + + template<class E, class N1 = void, class N2 = typename detail::enable_if<std::is_error_code_enum<E>::value>::type> + BOOST_SYSTEM_CONSTEXPR inline friend bool operator!=( E lhs, error_code const & rhs ) BOOST_NOEXCEPT + { + return !( lhs == rhs ); + } + +#if defined(BOOST_SYSTEM_CLANG_6) + + inline friend bool operator==( error_code const & lhs, std::error_condition const & rhs ) BOOST_NOEXCEPT + { + return static_cast< std::error_code >( lhs ) == rhs; + } + + inline friend bool operator==( std::error_condition const & lhs, error_code const & rhs ) BOOST_NOEXCEPT + { + return lhs == static_cast< std::error_code >( rhs ); + } + + inline friend bool operator!=( error_code const & lhs, std::error_condition const & rhs ) BOOST_NOEXCEPT + { + return !( lhs == rhs ); + } + + inline friend bool operator!=( std::error_condition const & lhs, error_code const & rhs ) BOOST_NOEXCEPT + { + return !( lhs == rhs ); + } + +#endif + + // conversions + + operator std::error_code () const + { + if( lc_flags_ == 1 ) + { + return *reinterpret_cast<std::error_code const*>( d2_ ); + } + else if( lc_flags_ == 0 ) + { +// This condition must be the same as the one in error_category_impl.hpp +#if defined(BOOST_SYSTEM_AVOID_STD_SYSTEM_CATEGORY) + + return std::error_code( 0, boost::system::system_category() ); + +#else + + return std::error_code(); + +#endif + } + else + { + return std::error_code( d1_.val_, *d1_.cat_ ); + } + } + + operator std::error_code () + { + return const_cast<error_code const&>( *this ); + } + + template<class T, + class E = typename detail::enable_if<detail::is_same<T, std::error_code>::value>::type> + operator T& () + { + if( lc_flags_ != 1 ) + { + std::error_code e2( *this ); + ::new( d2_ ) std::error_code( e2 ); + lc_flags_ = 1; + } + + return *reinterpret_cast<std::error_code*>( d2_ ); + } + +#if defined(BOOST_SYSTEM_CLANG_6) + + template<class T, + class E = typename std::enable_if<std::is_same<T, std::error_code>::value>::type> + operator T const& () = delete; + +#endif + +#endif + + std::string to_string() const + { +#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) + + if( lc_flags_ == 1 ) + { + std::error_code const& e2 = *reinterpret_cast<std::error_code const*>( d2_ ); + + std::string r( "std:" ); + r += e2.category().name(); + detail::append_int( r, e2.value() ); + + return r; + } + else +#endif + { + std::string r = category_name(); + detail::append_int( r, value() ); + return r; + } + } + + template<class Ch, class Tr> + inline friend std::basic_ostream<Ch, Tr>& + operator<< (std::basic_ostream<Ch, Tr>& os, error_code const & ec) + { + return os << ec.to_string().c_str(); + } + + std::string what() const + { + std::string r = message(); + + r += " ["; + r += to_string(); + + if( has_location() ) + { + r += " at "; + r += location().to_string(); + } + + r += "]"; + return r; + } +}; + +inline std::size_t hash_value( error_code const & ec ) +{ +#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) + + if( ec.lc_flags_ == 1 ) + { + std::error_code const& e2 = *reinterpret_cast<std::error_code const*>( ec.d2_ ); + return std::hash<std::error_code>()( e2 ); + } + +#endif + + error_category const & cat = ec.category(); + + boost::ulong_long_type id_ = cat.id_; + + if( id_ == 0 ) + { + id_ = reinterpret_cast<boost::uintptr_t>( &cat ); + } + + boost::ulong_long_type hv = ( boost::ulong_long_type( 0xCBF29CE4 ) << 32 ) + 0x84222325; + boost::ulong_long_type const prime = ( boost::ulong_long_type( 0x00000100 ) << 32 ) + 0x000001B3; + + // id + + hv ^= id_; + hv *= prime; + + // value + + hv ^= static_cast<unsigned>( ec.value() ); + hv *= prime; + + return static_cast<std::size_t>( hv ); +} + +} // namespace system + +} // namespace boost + +#if defined(BOOST_GCC) && BOOST_GCC >= 40600 && BOOST_GCC < 70000 +# pragma GCC diagnostic pop +#endif + +#endif // #ifndef BOOST_SYSTEM_DETAIL_ERROR_CODE_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/detail/error_code.ipp b/contrib/restricted/boost/system/include/boost/system/detail/error_code.ipp deleted file mode 100644 index f3d67b9c44..0000000000 --- a/contrib/restricted/boost/system/include/boost/system/detail/error_code.ipp +++ /dev/null @@ -1,496 +0,0 @@ -// error_code support implementation file --------------------------------------------// - -// Copyright Beman Dawes 2002, 2006 -// Copyright (c) Microsoft Corporation 2014 -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -// See library home page at http://www.boost.org/libs/system - -//--------------------------------------------------------------------------------------// - -#include <boost/config/warning_disable.hpp> - -#include <boost/system/config.hpp> -#include <boost/system/error_code.hpp> -#include <boost/cerrno.hpp> -#include <vector> -#include <cstdlib> -#include <cassert> - -#include <cstring> // for strerror/strerror_r - -# if defined( BOOST_WINDOWS_API ) -# include <boost/winapi/error_codes.hpp> -# include <boost/winapi/error_handling.hpp> -# include <boost/winapi/character_code_conversion.hpp> -# if !BOOST_PLAT_WINDOWS_RUNTIME -# include <boost/system/detail/local_free_on_destruction.hpp> -# endif -# ifndef ERROR_INCORRECT_SIZE -# define ERROR_INCORRECT_SIZE ERROR_BAD_ARGUMENTS -# endif -# endif - -//--------------------------------------------------------------------------------------// -namespace boost -{ - namespace system - { - -namespace detail -{ - - // standard error categories -------------------------------------------------------// - - class generic_error_category : public error_category - { - public: - generic_error_category(){} - const char * name() const BOOST_SYSTEM_NOEXCEPT; - std::string message( int ev ) const; - }; - - class system_error_category : public error_category - { - public: - system_error_category(){} - const char * name() const BOOST_SYSTEM_NOEXCEPT; - std::string message( int ev ) const; - error_condition default_error_condition( int ev ) const BOOST_SYSTEM_NOEXCEPT; - }; - -#ifdef BOOST_ERROR_CODE_HEADER_ONLY -# define BOOST_SYSTEM_INLINE inline -#else -# define BOOST_SYSTEM_INLINE -#endif - - // generic_error_category implementation ---------------------------------// - - BOOST_SYSTEM_INLINE const char * generic_error_category::name() const BOOST_SYSTEM_NOEXCEPT - { - return "generic"; - } - - BOOST_SYSTEM_INLINE std::string generic_error_category::message( int ev ) const - { - using namespace boost::system::errc; -#if defined(__PGI) - using boost::system::errc::invalid_argument; -#endif - - static std::string unknown_err( "Unknown error" ); - // strerror_r is preferred because it is always thread safe, - // however, we fallback to strerror in certain cases because: - // -- Windows doesn't provide strerror_r. - // -- HP and Sun do provide strerror_r on newer systems, but there is - // no way to tell if is available at runtime and in any case their - // versions of strerror are thread safe anyhow. - // -- Linux only sometimes provides strerror_r. - // -- Tru64 provides strerror_r only when compiled -pthread. - // -- VMS doesn't provide strerror_r, but on this platform, strerror is - // thread safe. - # if defined(BOOST_WINDOWS_API) || defined(__hpux) || defined(__sun)\ - || (defined(__linux) && (!defined(__USE_XOPEN2K)\ - || defined(BOOST_SYSTEM_USE_STRERROR)))\ - || (defined(__osf__) && !defined(_REENTRANT))\ - || (defined(__INTEGRITY))\ - || (defined(__vms))\ - || (defined(__QNXNTO__)) - const char * c_str = std::strerror( ev ); - return c_str - ? std::string( c_str ) - : unknown_err; - # else // use strerror_r - char buf[64]; - char * bp = buf; - std::size_t sz = sizeof(buf); - # if defined(__CYGWIN__) || defined(__USE_GNU) - // Oddball version of strerror_r - const char * c_str = strerror_r( ev, bp, sz ); - return c_str - ? std::string( c_str ) - : unknown_err; - # else - // POSIX version of strerror_r - int result; - for (;;) - { - // strerror_r returns 0 on success, otherwise ERANGE if buffer too small, - // invalid_argument if ev not a valid error number - # if defined (__sgi) - const char * c_str = strerror( ev ); - result = 0; - return c_str - ? std::string( c_str ) - : unknown_err; - # else - result = strerror_r( ev, bp, sz ); - # endif - if (result == 0 ) - break; - else - { - # if defined(__linux) - // Linux strerror_r returns -1 on error, with error number in errno - result = errno; - # endif - if ( result != ERANGE ) break; - if ( sz > sizeof(buf) ) std::free( bp ); - sz *= 2; - if ( (bp = static_cast<char*>(std::malloc( sz ))) == 0 ) - return std::string( "ENOMEM" ); - } - } - std::string msg; -# ifndef BOOST_NO_EXCEPTIONS - try -# endif - { - msg = ( ( result == invalid_argument ) ? "Unknown error" : bp ); - } - -# ifndef BOOST_NO_EXCEPTIONS - // See ticket #2098 - catch(...) - { - // just eat the exception - } -# endif - - if ( sz > sizeof(buf) ) std::free( bp ); - return msg; - # endif // else POSIX version of strerror_r - # endif // else use strerror_r - } - // system_error_category implementation --------------------------------------------// - - BOOST_SYSTEM_INLINE const char * system_error_category::name() const BOOST_SYSTEM_NOEXCEPT - { - return "system"; - } - - BOOST_SYSTEM_INLINE error_condition system_error_category::default_error_condition( int ev ) const - BOOST_SYSTEM_NOEXCEPT - { - using namespace boost::system::errc; -#if defined(__PGI) - using boost::system::errc::invalid_argument; -#endif - -# if defined(BOOST_WINDOWS_API) -# if defined(WINAPI_FAMILY) && ((WINAPI_FAMILY & WINAPI_PARTITION_APP) != 0) - // When using the Windows Runtime, most system errors are reported as HRESULTs. - // We want to map the common Win32 errors to their equivalent error condition, - // whether or not they are reported via an HRESULT. - if ( ev < 0 ) // Check for failed HRESULTs only. - if ( HRESULT_FACILITY( ev ) == FACILITY_WIN32 ) - ev = HRESULT_CODE( ev ); -# endif -# endif - -# if defined(BOOST_WINDOWS_API) - - using namespace boost::winapi; // for error codes - -# endif - - switch ( ev ) - { - case 0: return make_error_condition( success ); -# if defined(BOOST_POSIX_API) - // POSIX-like O/S -> posix_errno decode table -------------------------------------// - case E2BIG: return make_error_condition( argument_list_too_long ); - case EACCES: return make_error_condition( permission_denied ); - case EADDRINUSE: return make_error_condition( address_in_use ); - case EADDRNOTAVAIL: return make_error_condition( address_not_available ); - case EAFNOSUPPORT: return make_error_condition( address_family_not_supported ); - case EAGAIN: return make_error_condition( resource_unavailable_try_again ); -# if EALREADY != EBUSY // EALREADY and EBUSY are the same on QNX Neutrino - case EALREADY: return make_error_condition( connection_already_in_progress ); -# endif - case EBADF: return make_error_condition( bad_file_descriptor ); - case EBADMSG: return make_error_condition( bad_message ); - case EBUSY: return make_error_condition( device_or_resource_busy ); - case ECANCELED: return make_error_condition( operation_canceled ); - case ECHILD: return make_error_condition( no_child_process ); - case ECONNABORTED: return make_error_condition( connection_aborted ); - case ECONNREFUSED: return make_error_condition( connection_refused ); - case ECONNRESET: return make_error_condition( connection_reset ); - case EDEADLK: return make_error_condition( resource_deadlock_would_occur ); - case EDESTADDRREQ: return make_error_condition( destination_address_required ); - case EDOM: return make_error_condition( argument_out_of_domain ); - case EEXIST: return make_error_condition( file_exists ); - case EFAULT: return make_error_condition( bad_address ); - case EFBIG: return make_error_condition( file_too_large ); - case EHOSTUNREACH: return make_error_condition( host_unreachable ); - case EIDRM: return make_error_condition( identifier_removed ); - case EILSEQ: return make_error_condition( illegal_byte_sequence ); - case EINPROGRESS: return make_error_condition( operation_in_progress ); - case EINTR: return make_error_condition( interrupted ); - case EINVAL: return make_error_condition( invalid_argument ); - case EIO: return make_error_condition( io_error ); - case EISCONN: return make_error_condition( already_connected ); - case EISDIR: return make_error_condition( is_a_directory ); - case ELOOP: return make_error_condition( too_many_symbolic_link_levels ); - case EMFILE: return make_error_condition( too_many_files_open ); - case EMLINK: return make_error_condition( too_many_links ); - case EMSGSIZE: return make_error_condition( message_size ); - case ENAMETOOLONG: return make_error_condition( filename_too_long ); - case ENETDOWN: return make_error_condition( network_down ); - case ENETRESET: return make_error_condition( network_reset ); - case ENETUNREACH: return make_error_condition( network_unreachable ); - case ENFILE: return make_error_condition( too_many_files_open_in_system ); - case ENOBUFS: return make_error_condition( no_buffer_space ); - case ENODATA: return make_error_condition( no_message_available ); - case ENODEV: return make_error_condition( no_such_device ); - case ENOENT: return make_error_condition( no_such_file_or_directory ); - case ENOEXEC: return make_error_condition( executable_format_error ); - case ENOLCK: return make_error_condition( no_lock_available ); - case ENOLINK: return make_error_condition( no_link ); - case ENOMEM: return make_error_condition( not_enough_memory ); - case ENOMSG: return make_error_condition( no_message ); - case ENOPROTOOPT: return make_error_condition( no_protocol_option ); - case ENOSPC: return make_error_condition( no_space_on_device ); - case ENOSR: return make_error_condition( no_stream_resources ); - case ENOSTR: return make_error_condition( not_a_stream ); - case ENOSYS: return make_error_condition( function_not_supported ); - case ENOTCONN: return make_error_condition( not_connected ); - case ENOTDIR: return make_error_condition( not_a_directory ); - # if ENOTEMPTY != EEXIST // AIX treats ENOTEMPTY and EEXIST as the same value - case ENOTEMPTY: return make_error_condition( directory_not_empty ); - # endif // ENOTEMPTY != EEXIST - # if ENOTRECOVERABLE != ECONNRESET // the same on some Broadcom chips - case ENOTRECOVERABLE: return make_error_condition( state_not_recoverable ); - # endif // ENOTRECOVERABLE != ECONNRESET - case ENOTSOCK: return make_error_condition( not_a_socket ); - case ENOTSUP: return make_error_condition( not_supported ); - case ENOTTY: return make_error_condition( inappropriate_io_control_operation ); - case ENXIO: return make_error_condition( no_such_device_or_address ); - # if EOPNOTSUPP != ENOTSUP - case EOPNOTSUPP: return make_error_condition( operation_not_supported ); - # endif // EOPNOTSUPP != ENOTSUP - case EOVERFLOW: return make_error_condition( value_too_large ); - # if EOWNERDEAD != ECONNABORTED // the same on some Broadcom chips - case EOWNERDEAD: return make_error_condition( owner_dead ); - # endif // EOWNERDEAD != ECONNABORTED - case EPERM: return make_error_condition( operation_not_permitted ); - case EPIPE: return make_error_condition( broken_pipe ); - case EPROTO: return make_error_condition( protocol_error ); - case EPROTONOSUPPORT: return make_error_condition( protocol_not_supported ); - case EPROTOTYPE: return make_error_condition( wrong_protocol_type ); - case ERANGE: return make_error_condition( result_out_of_range ); - case EROFS: return make_error_condition( read_only_file_system ); - case ESPIPE: return make_error_condition( invalid_seek ); - case ESRCH: return make_error_condition( no_such_process ); - case ETIME: return make_error_condition( stream_timeout ); - case ETIMEDOUT: return make_error_condition( timed_out ); - case ETXTBSY: return make_error_condition( text_file_busy ); - # if EAGAIN != EWOULDBLOCK - case EWOULDBLOCK: return make_error_condition( operation_would_block ); - # endif // EAGAIN != EWOULDBLOCK - case EXDEV: return make_error_condition( cross_device_link ); - #else - // Windows system -> posix_errno decode table ---------------------------// - // see WinError.h comments for descriptions of errors - case ERROR_ACCESS_DENIED_: return make_error_condition( permission_denied ); - case ERROR_ALREADY_EXISTS_: return make_error_condition( file_exists ); - case ERROR_BAD_UNIT_: return make_error_condition( no_such_device ); - case ERROR_BUFFER_OVERFLOW_: return make_error_condition( filename_too_long ); - case ERROR_BUSY_: return make_error_condition( device_or_resource_busy ); - case ERROR_BUSY_DRIVE_: return make_error_condition( device_or_resource_busy ); - case ERROR_CANNOT_MAKE_: return make_error_condition( permission_denied ); - case ERROR_CANTOPEN_: return make_error_condition( io_error ); - case ERROR_CANTREAD_: return make_error_condition( io_error ); - case ERROR_CANTWRITE_: return make_error_condition( io_error ); - case ERROR_CURRENT_DIRECTORY_: return make_error_condition( permission_denied ); - case ERROR_DEV_NOT_EXIST_: return make_error_condition( no_such_device ); - case ERROR_DEVICE_IN_USE_: return make_error_condition( device_or_resource_busy ); - case ERROR_DIR_NOT_EMPTY_: return make_error_condition( directory_not_empty ); - case ERROR_DIRECTORY_: return make_error_condition( invalid_argument );\ - // WinError.h: "The directory name is invalid" - case ERROR_DISK_FULL_: return make_error_condition( no_space_on_device ); - case ERROR_FILE_EXISTS_: return make_error_condition( file_exists ); - case ERROR_FILE_NOT_FOUND_: return make_error_condition( no_such_file_or_directory ); - case ERROR_HANDLE_DISK_FULL_: return make_error_condition( no_space_on_device ); - case ERROR_INVALID_ACCESS_: return make_error_condition( permission_denied ); - case ERROR_INVALID_DRIVE_: return make_error_condition( no_such_device ); - case ERROR_INVALID_FUNCTION_: return make_error_condition( function_not_supported ); - case ERROR_INVALID_HANDLE_: return make_error_condition( invalid_argument ); - case ERROR_INVALID_NAME_: return make_error_condition( invalid_argument ); - case ERROR_LOCK_VIOLATION_: return make_error_condition( no_lock_available ); - case ERROR_LOCKED_: return make_error_condition( no_lock_available ); - case ERROR_NEGATIVE_SEEK_: return make_error_condition( invalid_argument ); - case ERROR_NOACCESS_: return make_error_condition( permission_denied ); - case ERROR_NOT_ENOUGH_MEMORY_: return make_error_condition( not_enough_memory ); - case ERROR_NOT_READY_: return make_error_condition( resource_unavailable_try_again ); - case ERROR_NOT_SAME_DEVICE_: return make_error_condition( cross_device_link ); - case ERROR_OPEN_FAILED_: return make_error_condition( io_error ); - case ERROR_OPEN_FILES_: return make_error_condition( device_or_resource_busy ); - case ERROR_OPERATION_ABORTED_: return make_error_condition( operation_canceled ); - case ERROR_OUTOFMEMORY_: return make_error_condition( not_enough_memory ); - case ERROR_PATH_NOT_FOUND_: return make_error_condition( no_such_file_or_directory ); - case ERROR_READ_FAULT_: return make_error_condition( io_error ); - case ERROR_RETRY_: return make_error_condition( resource_unavailable_try_again ); - case ERROR_SEEK_: return make_error_condition( io_error ); - case ERROR_SHARING_VIOLATION_: return make_error_condition( permission_denied ); - case ERROR_TOO_MANY_OPEN_FILES_: return make_error_condition( too_many_files_open ); - case ERROR_WRITE_FAULT_: return make_error_condition( io_error ); - case ERROR_WRITE_PROTECT_: return make_error_condition( permission_denied ); - case WSAEACCES_: return make_error_condition( permission_denied ); - case WSAEADDRINUSE_: return make_error_condition( address_in_use ); - case WSAEADDRNOTAVAIL_: return make_error_condition( address_not_available ); - case WSAEAFNOSUPPORT_: return make_error_condition( address_family_not_supported ); - case WSAEALREADY_: return make_error_condition( connection_already_in_progress ); - case WSAEBADF_: return make_error_condition( bad_file_descriptor ); - case WSAECONNABORTED_: return make_error_condition( connection_aborted ); - case WSAECONNREFUSED_: return make_error_condition( connection_refused ); - case WSAECONNRESET_: return make_error_condition( connection_reset ); - case WSAEDESTADDRREQ_: return make_error_condition( destination_address_required ); - case WSAEFAULT_: return make_error_condition( bad_address ); - case WSAEHOSTUNREACH_: return make_error_condition( host_unreachable ); - case WSAEINPROGRESS_: return make_error_condition( operation_in_progress ); - case WSAEINTR_: return make_error_condition( interrupted ); - case WSAEINVAL_: return make_error_condition( invalid_argument ); - case WSAEISCONN_: return make_error_condition( already_connected ); - case WSAEMFILE_: return make_error_condition( too_many_files_open ); - case WSAEMSGSIZE_: return make_error_condition( message_size ); - case WSAENAMETOOLONG_: return make_error_condition( filename_too_long ); - case WSAENETDOWN_: return make_error_condition( network_down ); - case WSAENETRESET_: return make_error_condition( network_reset ); - case WSAENETUNREACH_: return make_error_condition( network_unreachable ); - case WSAENOBUFS_: return make_error_condition( no_buffer_space ); - case WSAENOPROTOOPT_: return make_error_condition( no_protocol_option ); - case WSAENOTCONN_: return make_error_condition( not_connected ); - case WSAENOTSOCK_: return make_error_condition( not_a_socket ); - case WSAEOPNOTSUPP_: return make_error_condition( operation_not_supported ); - case WSAEPROTONOSUPPORT_: return make_error_condition( protocol_not_supported ); - case WSAEPROTOTYPE_: return make_error_condition( wrong_protocol_type ); - case WSAETIMEDOUT_: return make_error_condition( timed_out ); - case WSAEWOULDBLOCK_: return make_error_condition( operation_would_block ); - #endif - default: return error_condition( ev, system_category() ); - } - } - -# if !defined( BOOST_WINDOWS_API ) - - BOOST_SYSTEM_INLINE std::string system_error_category::message( int ev ) const - { - return generic_category().message( ev ); - } -# else - - BOOST_SYSTEM_INLINE std::string system_error_category::message( int ev ) const - { -#if defined(UNDER_CE) || BOOST_PLAT_WINDOWS_RUNTIME || defined(BOOST_NO_ANSI_APIS) - std::wstring buf(128, wchar_t()); - for (;;) - { - boost::winapi::DWORD_ retval = boost::winapi::FormatMessageW( - boost::winapi::FORMAT_MESSAGE_FROM_SYSTEM_ | - boost::winapi::FORMAT_MESSAGE_IGNORE_INSERTS_, - NULL, - ev, - boost::winapi::MAKELANGID_(boost::winapi::LANG_NEUTRAL_, - boost::winapi::SUBLANG_DEFAULT_), // Default language - &buf[0], - static_cast<boost::winapi::DWORD_>(buf.size()), - NULL - ); - - if (retval > 0) - { - buf.resize(retval); - break; - } - else if (boost::winapi::GetLastError() != - boost::winapi::ERROR_INSUFFICIENT_BUFFER_) - { - return std::string("Unknown error"); - } - else - { - buf.resize(buf.size() + buf.size() / 2); - } - } - - int num_chars = static_cast<int>(buf.size() + 1) * 2; - - boost::winapi::LPSTR_ narrow_buffer = -#if defined(__GNUC__) - (boost::winapi::LPSTR_)__builtin_alloca(num_chars); -#else - (boost::winapi::LPSTR_)_alloca(num_chars); -#endif - - if (boost::winapi::WideCharToMultiByte(boost::winapi::CP_ACP_, 0, - buf.c_str(), -1, narrow_buffer, num_chars, NULL, NULL) == 0) - { - return std::string("Unknown error"); - } - - std::string str( narrow_buffer ); -#else - boost::winapi::LPVOID_ lpMsgBuf = 0; - boost::winapi::DWORD_ retval = boost::winapi::FormatMessageA( - boost::winapi::FORMAT_MESSAGE_ALLOCATE_BUFFER_ | - boost::winapi::FORMAT_MESSAGE_FROM_SYSTEM_ | - boost::winapi::FORMAT_MESSAGE_IGNORE_INSERTS_, - NULL, - ev, - boost::winapi::MAKELANGID_(boost::winapi::LANG_NEUTRAL_, - boost::winapi::SUBLANG_DEFAULT_), // Default language - (boost::winapi::LPSTR_) &lpMsgBuf, - 0, - NULL - ); - detail::local_free_on_destruction lfod(lpMsgBuf); - if (retval == 0) - return std::string("Unknown error"); - - std::string str(static_cast<boost::winapi::LPCSTR_>(lpMsgBuf)); -# endif - while ( str.size() - && (str[str.size()-1] == '\n' || str[str.size()-1] == '\r') ) - str.erase( str.size()-1 ); - if ( str.size() && str[str.size()-1] == '.' ) - { str.erase( str.size()-1 ); } - return str; - } -# endif - -#undef BOOST_SYSTEM_INLINE - -} // namespace detail - - -# ifdef BOOST_SYSTEM_ENABLE_DEPRECATED - BOOST_SYSTEM_DECL error_code throws; // "throw on error" special error_code; - // note that it doesn't matter if this - // isn't initialized before use since - // the only use is to take its - // address for comparison purposes -# endif - -# ifdef BOOST_ERROR_CODE_HEADER_ONLY -# define BOOST_SYSTEM_LINKAGE inline -# else -# define BOOST_SYSTEM_LINKAGE BOOST_SYSTEM_DECL -# endif - - BOOST_SYSTEM_LINKAGE const error_category & system_category() BOOST_SYSTEM_NOEXCEPT - { - static const detail::system_error_category system_category_const; - return system_category_const; - } - - BOOST_SYSTEM_LINKAGE const error_category & generic_category() BOOST_SYSTEM_NOEXCEPT - { - static const detail::generic_error_category generic_category_const; - return generic_category_const; - } - - } // namespace system -} // namespace boost diff --git a/contrib/restricted/boost/system/include/boost/system/detail/error_condition.hpp b/contrib/restricted/boost/system/include/boost/system/detail/error_condition.hpp new file mode 100644 index 0000000000..a7e35abaf2 --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/detail/error_condition.hpp @@ -0,0 +1,297 @@ +#ifndef BOOST_SYSTEM_DETAIL_ERROR_CONDITION_HPP_INCLUDED +#define BOOST_SYSTEM_DETAIL_ERROR_CONDITION_HPP_INCLUDED + +// Copyright Beman Dawes 2006, 2007 +// Copyright Christoper Kohlhoff 2007 +// Copyright Peter Dimov 2017-2021 +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See library home page at http://www.boost.org/libs/system + +#include <boost/system/detail/error_category.hpp> +#include <boost/system/detail/generic_category.hpp> +#include <boost/system/detail/enable_if.hpp> +#include <boost/system/detail/is_same.hpp> +#include <boost/system/detail/errc.hpp> +#include <boost/system/detail/append_int.hpp> +#include <boost/system/is_error_condition_enum.hpp> +#include <boost/system/detail/config.hpp> +#include <boost/config.hpp> + +namespace boost +{ + +namespace system +{ + +// class error_condition + +// error_conditions are portable, error_codes are system or library specific + +namespace detail +{ + +struct generic_value_tag +{ + int value; + BOOST_SYSTEM_CONSTEXPR explicit generic_value_tag( int v ): value( v ) {} +}; + +} // namespace detail + +class error_condition +{ +private: + + int val_; + error_category const * cat_; + +private: + + boost::ulong_long_type cat_id() const BOOST_NOEXCEPT + { + return cat_? cat_->id_: detail::generic_category_id; + } + +public: + + // constructors: + + BOOST_SYSTEM_CONSTEXPR error_condition() BOOST_NOEXCEPT: + val_( 0 ), cat_( 0 ) + { + } + + BOOST_SYSTEM_CONSTEXPR error_condition( int val, const error_category & cat ) BOOST_NOEXCEPT: + val_( val ), cat_( &cat ) + { + } + + BOOST_SYSTEM_CONSTEXPR explicit error_condition( boost::system::detail::generic_value_tag vt ) BOOST_NOEXCEPT: + val_( vt.value ), cat_( 0 ) + { + } + + template<class ErrorConditionEnum> BOOST_SYSTEM_CONSTEXPR error_condition( ErrorConditionEnum e, + typename detail::enable_if< + is_error_condition_enum<ErrorConditionEnum>::value && !boost::system::detail::is_same<ErrorConditionEnum, errc::errc_t>::value + >::type* = 0) BOOST_NOEXCEPT + { + *this = make_error_condition( e ); + } + + template<class ErrorConditionEnum> BOOST_SYSTEM_CONSTEXPR error_condition( ErrorConditionEnum e, + typename detail::enable_if<boost::system::detail::is_same<ErrorConditionEnum, errc::errc_t>::value>::type* = 0) BOOST_NOEXCEPT: + val_( e ), cat_( 0 ) + { + } + + // modifiers: + + BOOST_SYSTEM_CONSTEXPR void assign( int val, const error_category & cat ) BOOST_NOEXCEPT + { + val_ = val; + cat_ = &cat; + } + + template<typename ErrorConditionEnum> + BOOST_SYSTEM_CONSTEXPR typename detail::enable_if<is_error_condition_enum<ErrorConditionEnum>::value, error_condition>::type & + operator=( ErrorConditionEnum val ) BOOST_NOEXCEPT + { + *this = error_condition( val ); + return *this; + } + + BOOST_SYSTEM_CONSTEXPR void clear() BOOST_NOEXCEPT + { + val_ = 0; + cat_ = 0; + } + + // observers: + + BOOST_SYSTEM_CONSTEXPR int value() const BOOST_NOEXCEPT + { + return val_; + } + + BOOST_SYSTEM_CONSTEXPR const error_category & category() const BOOST_NOEXCEPT + { + return cat_? *cat_: generic_category(); + } + + std::string message() const + { + if( cat_ ) + { + return cat_->message( value() ); + } + else + { + return detail::generic_error_category_message( value() ); + } + } + + char const * message( char * buffer, std::size_t len ) const BOOST_NOEXCEPT + { + if( cat_ ) + { + return cat_->message( value(), buffer, len ); + } + else + { + return detail::generic_error_category_message( value(), buffer, len ); + } + } + + BOOST_SYSTEM_CONSTEXPR bool failed() const BOOST_NOEXCEPT + { + if( cat_ ) + { + return detail::failed_impl( val_, *cat_ ); + } + else + { + return val_ != 0; + } + } + +#if !defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) + + BOOST_SYSTEM_CONSTEXPR explicit operator bool() const BOOST_NOEXCEPT // true if error + { + return failed(); + } + +#else + + typedef void (*unspecified_bool_type)(); + static void unspecified_bool_true() {} + + BOOST_SYSTEM_CONSTEXPR operator unspecified_bool_type() const BOOST_NOEXCEPT // true if error + { + return failed()? unspecified_bool_true: 0; + } + + BOOST_SYSTEM_CONSTEXPR bool operator!() const BOOST_NOEXCEPT // true if no error + { + return !failed(); + } + +#endif + + // relationals: + // the more symmetrical non-member syntax allows enum + // conversions work for both rhs and lhs. + + BOOST_SYSTEM_CONSTEXPR inline friend bool operator==( const error_condition & lhs, const error_condition & rhs ) BOOST_NOEXCEPT + { + if( lhs.val_ != rhs.val_ ) + { + return false; + } + else if( lhs.cat_ == 0 ) + { + return rhs.cat_id() == detail::generic_category_id; + } + else if( rhs.cat_ == 0 ) + { + return lhs.cat_id() == detail::generic_category_id; + } + else + { + return *lhs.cat_ == *rhs.cat_; + } + } + + BOOST_SYSTEM_CONSTEXPR inline friend bool operator<( const error_condition & lhs, const error_condition & rhs ) BOOST_NOEXCEPT + { + error_category const& lcat = lhs.category(); + error_category const& rcat = rhs.category(); + return lcat < rcat || ( lcat == rcat && lhs.val_ < rhs.val_ ); + } + + BOOST_SYSTEM_CONSTEXPR inline friend bool operator!=( const error_condition & lhs, const error_condition & rhs ) BOOST_NOEXCEPT + { + return !( lhs == rhs ); + } + +#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) + + operator std::error_condition () const + { +// This condition must be the same as the one in error_category_impl.hpp +#if defined(BOOST_SYSTEM_AVOID_STD_GENERIC_CATEGORY) + + return std::error_condition( value(), category() ); + +#else + + if( cat_ ) + { + return std::error_condition( val_, *cat_ ); + } + else + { + return std::error_condition( val_, std::generic_category() ); + } + +#endif + } + + inline friend bool operator==( std::error_code const & lhs, error_condition const & rhs ) BOOST_NOEXCEPT + { + return lhs == static_cast< std::error_condition >( rhs ); + } + + inline friend bool operator==( error_condition const & lhs, std::error_code const & rhs ) BOOST_NOEXCEPT + { + return static_cast< std::error_condition >( lhs ) == rhs; + } + + inline friend bool operator!=( std::error_code const & lhs, error_condition const & rhs ) BOOST_NOEXCEPT + { + return !( lhs == rhs ); + } + + inline friend bool operator!=( error_condition const & lhs, std::error_code const & rhs ) BOOST_NOEXCEPT + { + return !( lhs == rhs ); + } + +#endif + + std::string to_string() const + { + std::string r( "cond:" ); + + if( cat_ ) + { + r += cat_->name(); + } + else + { + r += "generic"; + } + + detail::append_int( r, value() ); + + return r; + } + + template<class Ch, class Tr> + inline friend std::basic_ostream<Ch, Tr>& + operator<< (std::basic_ostream<Ch, Tr>& os, error_condition const & en) + { + os << en.to_string(); + return os; + } +}; + +} // namespace system + +} // namespace boost + +#endif // #ifndef BOOST_SYSTEM_DETAIL_ERROR_CONDITION_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/detail/generic_category.hpp b/contrib/restricted/boost/system/include/boost/system/detail/generic_category.hpp new file mode 100644 index 0000000000..0a41b67773 --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/detail/generic_category.hpp @@ -0,0 +1,123 @@ +#ifndef BOOST_SYSTEM_DETAIL_GENERIC_CATEGORY_HPP_INCLUDED +#define BOOST_SYSTEM_DETAIL_GENERIC_CATEGORY_HPP_INCLUDED + +// Copyright Beman Dawes 2006, 2007 +// Copyright Christoper Kohlhoff 2007 +// Copyright Peter Dimov 2017, 2018 +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See library home page at http://www.boost.org/libs/system + +#include <boost/system/detail/error_category.hpp> +#include <boost/system/detail/generic_category_message.hpp> +#include <boost/system/detail/config.hpp> +#include <boost/config.hpp> + +namespace boost +{ + +namespace system +{ + +namespace detail +{ + +// generic_error_category + +#if ( defined( BOOST_GCC ) && BOOST_GCC >= 40600 ) || defined( BOOST_CLANG ) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wnon-virtual-dtor" +#endif + +class BOOST_SYMBOL_VISIBLE generic_error_category: public error_category +{ +public: + + BOOST_SYSTEM_CONSTEXPR generic_error_category() BOOST_NOEXCEPT: + error_category( detail::generic_category_id ) + { + } + + const char * name() const BOOST_NOEXCEPT BOOST_OVERRIDE + { + return "generic"; + } + + std::string message( int ev ) const BOOST_OVERRIDE; + char const * message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT BOOST_OVERRIDE; +}; + +#if ( defined( BOOST_GCC ) && BOOST_GCC >= 40600 ) || defined( BOOST_CLANG ) +#pragma GCC diagnostic pop +#endif + +// generic_error_category::message + +inline char const * generic_error_category::message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT +{ + return generic_error_category_message( ev, buffer, len ); +} + +inline std::string generic_error_category::message( int ev ) const +{ + return generic_error_category_message( ev ); +} + +} // namespace detail + +// generic_category() + +#if defined(BOOST_SYSTEM_HAS_CONSTEXPR) + +namespace detail +{ + +template<class T> struct BOOST_SYMBOL_VISIBLE generic_cat_holder +{ + static constexpr generic_error_category instance{}; +}; + +// Before C++17 it was mandatory to redeclare all static constexpr +#if defined(BOOST_NO_CXX17_INLINE_VARIABLES) +template<class T> constexpr generic_error_category generic_cat_holder<T>::instance; +#endif + +} // namespace detail + +constexpr error_category const & generic_category() BOOST_NOEXCEPT +{ + return detail::generic_cat_holder<void>::instance; +} + +#else // #if defined(BOOST_SYSTEM_HAS_CONSTEXPR) + +#if !defined(__SUNPRO_CC) // trailing __global is not supported +inline error_category const & generic_category() BOOST_NOEXCEPT BOOST_SYMBOL_VISIBLE; +#endif + +inline error_category const & generic_category() BOOST_NOEXCEPT +{ + static const detail::generic_error_category instance; + return instance; +} + +#endif // #if defined(BOOST_SYSTEM_HAS_CONSTEXPR) + +// deprecated synonyms + +#ifdef BOOST_SYSTEM_ENABLE_DEPRECATED + +BOOST_SYSTEM_DEPRECATED("please use generic_category()") inline const error_category & get_generic_category() { return generic_category(); } +BOOST_SYSTEM_DEPRECATED("please use generic_category()") inline const error_category & get_posix_category() { return generic_category(); } +BOOST_SYSTEM_DEPRECATED("please use generic_category()") static const error_category & posix_category BOOST_ATTRIBUTE_UNUSED = generic_category(); +BOOST_SYSTEM_DEPRECATED("please use generic_category()") static const error_category & errno_ecat BOOST_ATTRIBUTE_UNUSED = generic_category(); + +#endif + +} // namespace system + +} // namespace boost + +#endif // #ifndef BOOST_SYSTEM_DETAIL_GENERIC_CATEGORY_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/detail/generic_category_message.hpp b/contrib/restricted/boost/system/include/boost/system/detail/generic_category_message.hpp new file mode 100644 index 0000000000..fbdb41a3c3 --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/detail/generic_category_message.hpp @@ -0,0 +1,108 @@ +#ifndef BOOST_SYSTEM_DETAIL_GENERIC_CATEGORY_MESSAGE_HPP_INCLUDED +#define BOOST_SYSTEM_DETAIL_GENERIC_CATEGORY_MESSAGE_HPP_INCLUDED + +// Implementation of generic_error_category_message +// +// Copyright 2018 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See library home page at http://www.boost.org/libs/system + +#include <boost/config.hpp> +#include <string> +#include <cstring> + +namespace boost +{ + +namespace system +{ + +namespace detail +{ + +#if defined(__GLIBC__) + +// glibc has two incompatible strerror_r definitions + +inline char const * strerror_r_helper( char const * r, char const * ) BOOST_NOEXCEPT +{ + return r; +} + +inline char const * strerror_r_helper( int r, char const * buffer ) BOOST_NOEXCEPT +{ + return r == 0? buffer: "Unknown error"; +} + +inline char const * generic_error_category_message( int ev, char * buffer, std::size_t len ) BOOST_NOEXCEPT +{ + return strerror_r_helper( strerror_r( ev, buffer, len ), buffer ); +} + +inline std::string generic_error_category_message( int ev ) +{ + char buffer[ 128 ]; + return generic_error_category_message( ev, buffer, sizeof( buffer ) ); +} + +#else // #if defined(__GLIBC__) + +// std::strerror is thread-safe on everything else, incl. Windows + +# if defined( BOOST_MSVC ) +# pragma warning( push ) +# pragma warning( disable: 4996 ) +# elif defined(__clang__) && defined(__has_warning) +# pragma clang diagnostic push +# if __has_warning("-Wdeprecated-declarations") +# pragma clang diagnostic ignored "-Wdeprecated-declarations" +# endif +# endif + +inline std::string generic_error_category_message( int ev ) +{ + char const * m = std::strerror( ev ); + return m? m: "Unknown error"; +} + +inline char const * generic_error_category_message( int ev, char * buffer, std::size_t len ) BOOST_NOEXCEPT +{ + if( len == 0 ) + { + return buffer; + } + + if( len == 1 ) + { + buffer[0] = 0; + return buffer; + } + + char const * m = std::strerror( ev ); + + if( m == 0 ) return "Unknown error"; + + std::strncpy( buffer, m, len - 1 ); + buffer[ len-1 ] = 0; + + return buffer; +} + +# if defined( BOOST_MSVC ) +# pragma warning( pop ) +# elif defined(__clang__) && defined(__has_warning) +# pragma clang diagnostic pop +# endif + +#endif // #if defined(__GLIBC__) + +} // namespace detail + +} // namespace system + +} // namespace boost + +#endif // #ifndef BOOST_SYSTEM_DETAIL_GENERIC_CATEGORY_MESSAGE_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/detail/interop_category.hpp b/contrib/restricted/boost/system/include/boost/system/detail/interop_category.hpp new file mode 100644 index 0000000000..9755ad5a59 --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/detail/interop_category.hpp @@ -0,0 +1,107 @@ +#ifndef BOOST_SYSTEM_DETAIL_INTEROP_CATEGORY_HPP_INCLUDED +#define BOOST_SYSTEM_DETAIL_INTEROP_CATEGORY_HPP_INCLUDED + +// Copyright Beman Dawes 2006, 2007 +// Copyright Christoper Kohlhoff 2007 +// Copyright Peter Dimov 2017, 2018, 2021 +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See library home page at http://www.boost.org/libs/system + +#include <boost/system/detail/error_category.hpp> +#include <boost/system/detail/snprintf.hpp> +#include <boost/system/detail/config.hpp> +#include <boost/config.hpp> + +namespace boost +{ + +namespace system +{ + +namespace detail +{ + +// interop_error_category, used for std::error_code + +#if ( defined( BOOST_GCC ) && BOOST_GCC >= 40600 ) || defined( BOOST_CLANG ) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wnon-virtual-dtor" +#endif + +class BOOST_SYMBOL_VISIBLE interop_error_category: public error_category +{ +public: + + BOOST_SYSTEM_CONSTEXPR interop_error_category() BOOST_NOEXCEPT: + error_category( detail::interop_category_id ) + { + } + + const char * name() const BOOST_NOEXCEPT BOOST_OVERRIDE + { + return "std:unknown"; + } + + std::string message( int ev ) const BOOST_OVERRIDE; + char const * message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT BOOST_OVERRIDE; +}; + +#if ( defined( BOOST_GCC ) && BOOST_GCC >= 40600 ) || defined( BOOST_CLANG ) +#pragma GCC diagnostic pop +#endif + +inline char const * interop_error_category::message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT +{ + detail::snprintf( buffer, len, "Unknown interop error %d", ev ); + return buffer; +} + +inline std::string interop_error_category::message( int ev ) const +{ + char buffer[ 48 ]; + return message( ev, buffer, sizeof( buffer ) ); +} + +// interop_category() + +#if defined(BOOST_SYSTEM_HAS_CONSTEXPR) + +template<class T> struct BOOST_SYMBOL_VISIBLE interop_cat_holder +{ + static constexpr interop_error_category instance{}; +}; + +// Before C++17 it was mandatory to redeclare all static constexpr +#if defined(BOOST_NO_CXX17_INLINE_VARIABLES) +template<class T> constexpr interop_error_category interop_cat_holder<T>::instance; +#endif + +constexpr error_category const & interop_category() BOOST_NOEXCEPT +{ + return interop_cat_holder<void>::instance; +} + +#else // #if defined(BOOST_SYSTEM_HAS_CONSTEXPR) + +#if !defined(__SUNPRO_CC) // trailing __global is not supported +inline error_category const & interop_category() BOOST_NOEXCEPT BOOST_SYMBOL_VISIBLE; +#endif + +inline error_category const & interop_category() BOOST_NOEXCEPT +{ + static const detail::interop_error_category instance; + return instance; +} + +#endif // #if defined(BOOST_SYSTEM_HAS_CONSTEXPR) + +} // namespace detail + +} // namespace system + +} // namespace boost + +#endif // #ifndef BOOST_SYSTEM_DETAIL_INTEROP_CATEGORY_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/detail/is_same.hpp b/contrib/restricted/boost/system/include/boost/system/detail/is_same.hpp new file mode 100644 index 0000000000..dc466f8ee3 --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/detail/is_same.hpp @@ -0,0 +1,33 @@ +#ifndef BOOST_SYSTEM_DETAIL_IS_SAME_HPP_INCLUDED +#define BOOST_SYSTEM_DETAIL_IS_SAME_HPP_INCLUDED + +// Copyright 2021 Peter Dimov +// Distributed under the Boost Software License, Version 1.0 +// http://www.boost.org/LICENSE_1_0.txt + +namespace boost +{ + +namespace system +{ + +namespace detail +{ + +template<class T1, class T2> struct is_same +{ + enum _vt { value = 0 }; +}; + +template<class T> struct is_same<T, T> +{ + enum _vt { value = 1 }; +}; + +} // namespace detail + +} // namespace system + +} // namespace boost + +#endif // #ifndef BOOST_SYSTEM_DETAIL_IS_SAME_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/detail/local_free_on_destruction.hpp b/contrib/restricted/boost/system/include/boost/system/detail/local_free_on_destruction.hpp deleted file mode 100644 index 9016e7402d..0000000000 --- a/contrib/restricted/boost/system/include/boost/system/detail/local_free_on_destruction.hpp +++ /dev/null @@ -1,42 +0,0 @@ -// local_free_on_exit.hpp ------------------------------------------------------------// - -// Copyright (c) 2003-2010 Christopher M. Kohlhoff (chris at kohlhoff dot com) -// Copyright (c) 2010 Beman Dawes - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - -// This is derived from boost/asio/detail/local_free_on_block_exit.hpp to avoid -// a dependency on asio. Thanks to Chris Kohlhoff for pointing it out. - -#ifndef BOOST_SYSTEM_LOCAL_FREE_ON_EXIT_HPP -#define BOOST_SYSTEM_LOCAL_FREE_ON_EXIT_HPP - -#include <boost/winapi/local_memory.hpp> - -namespace boost { -namespace system { -namespace detail { - -class local_free_on_destruction -{ -public: - explicit local_free_on_destruction(void* p) - : p_(p) {} - - ~local_free_on_destruction() - { - boost::winapi::LocalFree(p_); - } - -private: - void* p_; - local_free_on_destruction(const local_free_on_destruction&); // = deleted - local_free_on_destruction& operator=(const local_free_on_destruction&); // = deleted -}; - -} // namespace detail -} // namespace system -} // namespace boost - -#endif // BOOST_SYSTEM_LOCAL_FREE_ON_EXIT_HPP diff --git a/contrib/restricted/boost/system/include/boost/system/detail/snprintf.hpp b/contrib/restricted/boost/system/include/boost/system/detail/snprintf.hpp new file mode 100644 index 0000000000..f54a3514ff --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/detail/snprintf.hpp @@ -0,0 +1,73 @@ +#ifndef BOOST_SYSTEM_DETAIL_SNPRINTF_HPP_INCLUDED +#define BOOST_SYSTEM_DETAIL_SNPRINTF_HPP_INCLUDED + +// Copyright 2018, 2020, 2021 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See library home page at http://www.boost.org/libs/system + +#include <boost/config.hpp> +#include <cstdio> +#include <cstdarg> + +// + +namespace boost +{ + +namespace system +{ + +namespace detail +{ + +#if ( defined(_MSC_VER) && _MSC_VER < 1900 ) || ( defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) ) + +inline void snprintf( char * buffer, std::size_t len, char const * format, ... ) +{ +# if defined( BOOST_MSVC ) +# pragma warning( push ) +# pragma warning( disable: 4996 ) +# endif + + if( len == 0 ) return; + + va_list args; + va_start( args, format ); + + _vsnprintf( buffer, len - 1, format, args ); + buffer[ len - 1 ] = 0; + + va_end( args ); + +# if defined( BOOST_MSVC ) +# pragma warning( pop ) +# endif +} + +#else + +#if defined(__GNUC__) && __GNUC__ >= 3 +__attribute__((__format__ (__printf__, 3, 4))) +#endif +inline void snprintf( char * buffer, std::size_t len, char const * format, ... ) +{ + va_list args; + va_start( args, format ); + + std::vsnprintf( buffer, len, format, args ); + + va_end( args ); +} + +#endif + +} // namespace detail + +} // namespace system + +} // namespace boost + +#endif // #ifndef BOOST_SYSTEM_DETAIL_SNPRINTF_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/detail/std_category.hpp b/contrib/restricted/boost/system/include/boost/system/detail/std_category.hpp new file mode 100644 index 0000000000..e8f70e13b2 --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/detail/std_category.hpp @@ -0,0 +1,141 @@ +#ifndef BOOST_SYSTEM_DETAIL_STD_CATEGORY_HPP_INCLUDED +#define BOOST_SYSTEM_DETAIL_STD_CATEGORY_HPP_INCLUDED + +// Support for interoperability between Boost.System and <system_error> +// +// Copyright 2018, 2021 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See library home page at http://www.boost.org/libs/system + +#include <boost/system/detail/error_category.hpp> +#include <boost/system/detail/error_condition.hpp> +#include <boost/system/detail/error_code.hpp> +#include <boost/system/detail/generic_category.hpp> +#include <system_error> + +// + +namespace boost +{ + +namespace system +{ + +namespace detail +{ + +class BOOST_SYMBOL_VISIBLE std_category: public std::error_category +{ +private: + + boost::system::error_category const * pc_; + +public: + + explicit std_category( boost::system::error_category const * pc, unsigned id ): pc_( pc ) + { + if( id != 0 ) + { +#if defined(_MSC_VER) && defined(_CPPLIB_VER) && _MSC_VER >= 1900 && _MSC_VER < 2000 + + // Poking into the protected _Addr member of std::error_category + // is not a particularly good programming practice, but what can + // you do + + _Addr = id; + +#endif + } + } + + const char * name() const BOOST_NOEXCEPT BOOST_OVERRIDE + { + return pc_->name(); + } + + std::string message( int ev ) const BOOST_OVERRIDE + { + return pc_->message( ev ); + } + + std::error_condition default_error_condition( int ev ) const BOOST_NOEXCEPT BOOST_OVERRIDE + { + return pc_->default_error_condition( ev ); + } + + bool equivalent( int code, const std::error_condition & condition ) const BOOST_NOEXCEPT BOOST_OVERRIDE; + bool equivalent( const std::error_code & code, int condition ) const BOOST_NOEXCEPT BOOST_OVERRIDE; +}; + +inline bool std_category::equivalent( int code, const std::error_condition & condition ) const BOOST_NOEXCEPT +{ + if( condition.category() == *this ) + { + boost::system::error_condition bn( condition.value(), *pc_ ); + return pc_->equivalent( code, bn ); + } + else if( condition.category() == std::generic_category() || condition.category() == boost::system::generic_category() ) + { + boost::system::error_condition bn( condition.value(), boost::system::generic_category() ); + return pc_->equivalent( code, bn ); + } + +#ifndef BOOST_NO_RTTI + + else if( std_category const* pc2 = dynamic_cast< std_category const* >( &condition.category() ) ) + { + boost::system::error_condition bn( condition.value(), *pc2->pc_ ); + return pc_->equivalent( code, bn ); + } + +#endif + + else + { + return default_error_condition( code ) == condition; + } +} + +inline bool std_category::equivalent( const std::error_code & code, int condition ) const BOOST_NOEXCEPT +{ + if( code.category() == *this ) + { + boost::system::error_code bc( code.value(), *pc_ ); + return pc_->equivalent( bc, condition ); + } + else if( code.category() == std::generic_category() || code.category() == boost::system::generic_category() ) + { + boost::system::error_code bc( code.value(), boost::system::generic_category() ); + return pc_->equivalent( bc, condition ); + } + +#ifndef BOOST_NO_RTTI + + else if( std_category const* pc2 = dynamic_cast< std_category const* >( &code.category() ) ) + { + boost::system::error_code bc( code.value(), *pc2->pc_ ); + return pc_->equivalent( bc, condition ); + } + +#endif + + else if( *pc_ == boost::system::generic_category() ) + { + return std::generic_category().equivalent( code, condition ); + } + else + { + return false; + } +} + +} // namespace detail + +} // namespace system + +} // namespace boost + +#endif // #ifndef BOOST_SYSTEM_DETAIL_STD_CATEGORY_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/detail/system_category.hpp b/contrib/restricted/boost/system/include/boost/system/detail/system_category.hpp new file mode 100644 index 0000000000..ae8c9530e0 --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/detail/system_category.hpp @@ -0,0 +1,110 @@ +#ifndef BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_HPP_INCLUDED +#define BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_HPP_INCLUDED + +// Copyright Beman Dawes 2006, 2007 +// Copyright Christoper Kohlhoff 2007 +// Copyright Peter Dimov 2017, 2018 +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See library home page at http://www.boost.org/libs/system + +#include <boost/system/detail/error_category.hpp> +#include <boost/system/detail/config.hpp> +#include <boost/config.hpp> + +namespace boost +{ + +namespace system +{ + +namespace detail +{ + +// system_error_category + +#if ( defined( BOOST_GCC ) && BOOST_GCC >= 40600 ) || defined( BOOST_CLANG ) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wnon-virtual-dtor" +#endif + +class BOOST_SYMBOL_VISIBLE system_error_category: public error_category +{ +public: + + BOOST_SYSTEM_CONSTEXPR system_error_category() BOOST_NOEXCEPT: + error_category( detail::system_category_id ) + { + } + + const char * name() const BOOST_NOEXCEPT BOOST_OVERRIDE + { + return "system"; + } + + error_condition default_error_condition( int ev ) const BOOST_NOEXCEPT BOOST_OVERRIDE; + + std::string message( int ev ) const BOOST_OVERRIDE; + char const * message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT BOOST_OVERRIDE; +}; + +#if ( defined( BOOST_GCC ) && BOOST_GCC >= 40600 ) || defined( BOOST_CLANG ) +#pragma GCC diagnostic pop +#endif + +} // namespace detail + +// system_category() + +#if defined(BOOST_SYSTEM_HAS_CONSTEXPR) + +namespace detail +{ + +template<class T> struct BOOST_SYMBOL_VISIBLE system_cat_holder +{ + static constexpr system_error_category instance{}; +}; + +// Before C++17 it was mandatory to redeclare all static constexpr +#if defined(BOOST_NO_CXX17_INLINE_VARIABLES) +template<class T> constexpr system_error_category system_cat_holder<T>::instance; +#endif + +} // namespace detail + +constexpr error_category const & system_category() BOOST_NOEXCEPT +{ + return detail::system_cat_holder<void>::instance; +} + +#else // #if defined(BOOST_SYSTEM_HAS_CONSTEXPR) + +#if !defined(__SUNPRO_CC) // trailing __global is not supported +inline error_category const & system_category() BOOST_NOEXCEPT BOOST_SYMBOL_VISIBLE; +#endif + +inline error_category const & system_category() BOOST_NOEXCEPT +{ + static const detail::system_error_category instance; + return instance; +} + +#endif // #if defined(BOOST_SYSTEM_HAS_CONSTEXPR) + +// deprecated synonyms + +#ifdef BOOST_SYSTEM_ENABLE_DEPRECATED + +BOOST_SYSTEM_DEPRECATED("please use system_category()") inline const error_category & get_system_category() { return system_category(); } +BOOST_SYSTEM_DEPRECATED("please use system_category()") static const error_category & native_ecat BOOST_ATTRIBUTE_UNUSED = system_category(); + +#endif + +} // namespace system + +} // namespace boost + +#endif // #ifndef BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/detail/system_category_condition_win32.hpp b/contrib/restricted/boost/system/include/boost/system/detail/system_category_condition_win32.hpp new file mode 100644 index 0000000000..408c697dc0 --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/detail/system_category_condition_win32.hpp @@ -0,0 +1,151 @@ +#ifndef BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_CONDITION_WIN32_HPP_INCLUDED +#define BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_CONDITION_WIN32_HPP_INCLUDED + +// Copyright Beman Dawes 2002, 2006 +// Copyright (c) Microsoft Corporation 2014 +// Copyright 2018 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See library home page at http://www.boost.org/libs/system + +#include <boost/system/detail/errc.hpp> +#include <boost/winapi/error_codes.hpp> +#include <boost/config.hpp> + +// + +namespace boost +{ + +namespace system +{ + +namespace detail +{ + +inline int system_category_condition_win32( int ev ) BOOST_NOEXCEPT +{ + // When using the Windows Runtime, most system errors are reported as HRESULTs. + // We want to map the common Win32 errors to their equivalent error condition, + // whether or not they are reported via an HRESULT. + +#define BOOST_SYSTEM_FAILED(hr) ((hr) < 0) +#define BOOST_SYSTEM_HRESULT_FACILITY(hr) (((hr) >> 16) & 0x1fff) +#define BOOST_SYSTEM_HRESULT_CODE(hr) ((hr) & 0xFFFF) +#define BOOST_SYSTEM_FACILITY_WIN32 7 + + if( BOOST_SYSTEM_FAILED( ev ) && BOOST_SYSTEM_HRESULT_FACILITY( ev ) == BOOST_SYSTEM_FACILITY_WIN32 ) + { + ev = BOOST_SYSTEM_HRESULT_CODE( ev ); + } + +#undef BOOST_SYSTEM_FAILED +#undef BOOST_SYSTEM_HRESULT_FACILITY +#undef BOOST_SYSTEM_HRESULT_CODE +#undef BOOST_SYSTEM_FACILITY_WIN32 + + using namespace boost::winapi; + using namespace errc; + + // Windows system -> posix_errno decode table + // see WinError.h comments for descriptions of errors + + switch ( ev ) + { + case 0: return success; + + case ERROR_ACCESS_DENIED_: return permission_denied; + case ERROR_ALREADY_EXISTS_: return file_exists; + case ERROR_BAD_NETPATH_: return no_such_file_or_directory; + case ERROR_BAD_UNIT_: return no_such_device; + case ERROR_BROKEN_PIPE_: return broken_pipe; + case ERROR_BUFFER_OVERFLOW_: return filename_too_long; + case ERROR_BUSY_: return device_or_resource_busy; + case ERROR_BUSY_DRIVE_: return device_or_resource_busy; + case ERROR_CANNOT_MAKE_: return permission_denied; + case ERROR_CANTOPEN_: return io_error; + case ERROR_CANTREAD_: return io_error; + case ERROR_CANTWRITE_: return io_error; + case ERROR_CONNECTION_ABORTED_: return connection_aborted; + case ERROR_CURRENT_DIRECTORY_: return permission_denied; + case ERROR_DEV_NOT_EXIST_: return no_such_device; + case ERROR_DEVICE_IN_USE_: return device_or_resource_busy; + case ERROR_DIR_NOT_EMPTY_: return directory_not_empty; + case ERROR_DIRECTORY_: return invalid_argument; // WinError.h: "The directory name is invalid" + case ERROR_DISK_FULL_: return no_space_on_device; + case ERROR_FILE_EXISTS_: return file_exists; + case ERROR_FILE_NOT_FOUND_: return no_such_file_or_directory; + case ERROR_HANDLE_DISK_FULL_: return no_space_on_device; + case ERROR_INVALID_ACCESS_: return permission_denied; + case ERROR_INVALID_DRIVE_: return no_such_device; + case ERROR_INVALID_FUNCTION_: return function_not_supported; + case ERROR_INVALID_HANDLE_: return invalid_argument; + case ERROR_INVALID_NAME_: return no_such_file_or_directory; + case ERROR_INVALID_PARAMETER_: return invalid_argument; + case ERROR_LOCK_VIOLATION_: return no_lock_available; + case ERROR_LOCKED_: return no_lock_available; + case ERROR_NEGATIVE_SEEK_: return invalid_argument; + case ERROR_NOACCESS_: return permission_denied; + case ERROR_NOT_ENOUGH_MEMORY_: return not_enough_memory; + case ERROR_NOT_READY_: return resource_unavailable_try_again; + case ERROR_NOT_SAME_DEVICE_: return cross_device_link; + case ERROR_OPEN_FAILED_: return io_error; + case ERROR_OPEN_FILES_: return device_or_resource_busy; + case ERROR_OPERATION_ABORTED_: return operation_canceled; + case ERROR_OUTOFMEMORY_: return not_enough_memory; + case ERROR_PATH_NOT_FOUND_: return no_such_file_or_directory; + case ERROR_READ_FAULT_: return io_error; + case ERROR_REPARSE_TAG_INVALID_: return invalid_argument; + case ERROR_RETRY_: return resource_unavailable_try_again; + case ERROR_SEEK_: return io_error; + case ERROR_SHARING_VIOLATION_: return permission_denied; + case ERROR_NOT_SUPPORTED_: return not_supported; // WinError.h: "The request is not supported." + case ERROR_TOO_MANY_OPEN_FILES_: return too_many_files_open; + case ERROR_WRITE_FAULT_: return io_error; + case ERROR_WRITE_PROTECT_: return permission_denied; + + case WSAEACCES_: return permission_denied; + case WSAEADDRINUSE_: return address_in_use; + case WSAEADDRNOTAVAIL_: return address_not_available; + case WSAEAFNOSUPPORT_: return address_family_not_supported; + case WSAEALREADY_: return connection_already_in_progress; + case WSAEBADF_: return bad_file_descriptor; + case WSAECONNABORTED_: return connection_aborted; + case WSAECONNREFUSED_: return connection_refused; + case WSAECONNRESET_: return connection_reset; + case WSAEDESTADDRREQ_: return destination_address_required; + case WSAEFAULT_: return bad_address; + case WSAEHOSTUNREACH_: return host_unreachable; + case WSAEINPROGRESS_: return operation_in_progress; + case WSAEINTR_: return interrupted; + case WSAEINVAL_: return invalid_argument; + case WSAEISCONN_: return already_connected; + case WSAEMFILE_: return too_many_files_open; + case WSAEMSGSIZE_: return message_size; + case WSAENAMETOOLONG_: return filename_too_long; + case WSAENETDOWN_: return network_down; + case WSAENETRESET_: return network_reset; + case WSAENETUNREACH_: return network_unreachable; + case WSAENOBUFS_: return no_buffer_space; + case WSAENOPROTOOPT_: return no_protocol_option; + case WSAENOTCONN_: return not_connected; + case WSAENOTSOCK_: return not_a_socket; + case WSAEOPNOTSUPP_: return operation_not_supported; + case WSAEPROTONOSUPPORT_: return protocol_not_supported; + case WSAEPROTOTYPE_: return wrong_protocol_type; + case WSAETIMEDOUT_: return timed_out; + case WSAEWOULDBLOCK_: return operation_would_block; + + default: return -1; + } +} + +} // namespace detail + +} // namespace system + +} // namespace boost + +#endif // #ifndef BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_CONDITION_WIN32_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/detail/system_category_impl.hpp b/contrib/restricted/boost/system/include/boost/system/detail/system_category_impl.hpp new file mode 100644 index 0000000000..fc3933e2fd --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/detail/system_category_impl.hpp @@ -0,0 +1,61 @@ +#ifndef BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_IMPL_HPP_INCLUDED +#define BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_IMPL_HPP_INCLUDED + +// Copyright Beman Dawes 2006, 2007 +// Copyright Christoper Kohlhoff 2007 +// Copyright Peter Dimov 2017, 2018, 2020 +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See library home page at http://www.boost.org/libs/system + +#include <boost/system/detail/system_category.hpp> +#include <boost/system/detail/system_category_message.hpp> +#include <boost/system/detail/error_condition.hpp> +#include <boost/system/api_config.hpp> + +#if !defined(BOOST_POSIX_API) && !defined(BOOST_WINDOWS_API) +# error BOOST_POSIX_API or BOOST_WINDOWS_API must be defined +#endif + +// system_error_category implementation + +#if defined(BOOST_WINDOWS_API) + +#include <boost/system/detail/system_category_condition_win32.hpp> + +inline boost::system::error_condition boost::system::detail::system_error_category::default_error_condition( int ev ) const BOOST_NOEXCEPT +{ + int e2 = system_category_condition_win32( ev ); + + if( e2 == -1 ) + { + return error_condition( ev, *this ); + } + else + { + return error_condition( boost::system::detail::generic_value_tag( e2 ) ); + } +} + +#else // #if defined(BOOST_WINDOWS_API) + +inline boost::system::error_condition boost::system::detail::system_error_category::default_error_condition( int ev ) const BOOST_NOEXCEPT +{ + return error_condition( boost::system::detail::generic_value_tag( ev ) ); +} + +#endif // #if defined(BOOST_WINDOWS_API) + +inline std::string boost::system::detail::system_error_category::message( int ev ) const +{ + return system_error_category_message( ev ); +} + +inline char const * boost::system::detail::system_error_category::message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT +{ + return system_error_category_message( ev, buffer, len ); +} + +#endif // #ifndef BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_IMPL_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/detail/system_category_message.hpp b/contrib/restricted/boost/system/include/boost/system/detail/system_category_message.hpp new file mode 100644 index 0000000000..203e75aa9e --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/detail/system_category_message.hpp @@ -0,0 +1,71 @@ +#ifndef BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_MESSAGE_HPP_INCLUDED +#define BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_MESSAGE_HPP_INCLUDED + +// Implementation of system_error_category_message +// +// Copyright 2018, 2022 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See library home page at http://www.boost.org/libs/system + +#include <boost/system/api_config.hpp> + +#if !defined(BOOST_POSIX_API) && !defined(BOOST_WINDOWS_API) +# error BOOST_POSIX_API or BOOST_WINDOWS_API must be defined +#endif + +#if defined(BOOST_WINDOWS_API) + +#include <boost/system/detail/system_category_message_win32.hpp> + +namespace boost +{ +namespace system +{ +namespace detail +{ + +inline std::string system_error_category_message( int ev ) +{ + return system_category_message_win32( ev ); +} + +inline char const * system_error_category_message( int ev, char * buffer, std::size_t len ) BOOST_NOEXCEPT +{ + return system_category_message_win32( ev, buffer, len ); +} + +} // namespace detail +} // namespace system +} // namespace boost + +#else // #if defined(BOOST_WINDOWS_API) + +#include <boost/system/detail/generic_category_message.hpp> + +namespace boost +{ +namespace system +{ +namespace detail +{ + +inline std::string system_error_category_message( int ev ) +{ + return generic_error_category_message( ev ); +} + +inline char const * system_error_category_message( int ev, char * buffer, std::size_t len ) BOOST_NOEXCEPT +{ + return generic_error_category_message( ev, buffer, len ); +} + +} // namespace detail +} // namespace system +} // namespace boost + +#endif // #if defined(BOOST_WINDOWS_API) + +#endif // #ifndef BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_MESSAGE_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/detail/system_category_message_win32.hpp b/contrib/restricted/boost/system/include/boost/system/detail/system_category_message_win32.hpp new file mode 100644 index 0000000000..e5f544ccd9 --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/detail/system_category_message_win32.hpp @@ -0,0 +1,211 @@ +#ifndef BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_MESSAGE_WIN32_HPP_INCLUDED +#define BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_MESSAGE_WIN32_HPP_INCLUDED + +// Copyright Beman Dawes 2002, 2006 +// Copyright (c) Microsoft Corporation 2014 +// Copyright 2018, 2020 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See library home page at http://www.boost.org/libs/system + +#include <boost/system/detail/snprintf.hpp> +#include <boost/winapi/error_handling.hpp> +#include <boost/winapi/character_code_conversion.hpp> +#include <boost/winapi/local_memory.hpp> +#include <boost/config.hpp> +#include <cstdio> + +// + +namespace boost +{ + +namespace system +{ + +namespace detail +{ + +inline char const * unknown_message_win32( int ev, char * buffer, std::size_t len ) +{ + detail::snprintf( buffer, len, "Unknown error (%d)", ev ); + return buffer; +} + +inline boost::winapi::UINT_ message_cp_win32() +{ +#if defined(BOOST_SYSTEM_USE_UTF8) + + return boost::winapi::CP_UTF8_; + +#else + + return boost::winapi::CP_ACP_; + +#endif +} + +inline char const * system_category_message_win32( int ev, char * buffer, std::size_t len ) BOOST_NOEXCEPT +{ + if( len == 0 ) + { + return buffer; + } + + if( len == 1 ) + { + buffer[0] = 0; + return buffer; + } + + boost::winapi::UINT_ const code_page = message_cp_win32(); + + int r = 0; + +#if !defined(BOOST_NO_ANSI_APIS) + + if( code_page == boost::winapi::CP_ACP_ ) + { + using namespace boost::winapi; + + DWORD_ retval = boost::winapi::FormatMessageA( + FORMAT_MESSAGE_FROM_SYSTEM_ | FORMAT_MESSAGE_IGNORE_INSERTS_, + NULL, + ev, + MAKELANGID_( LANG_NEUTRAL_, SUBLANG_DEFAULT_ ), // Default language + buffer, + static_cast<DWORD_>( len ), + NULL + ); + + r = static_cast<int>( retval ); + } + else + +#endif + + { + using namespace boost::winapi; + + wchar_t * lpMsgBuf = 0; + + DWORD_ retval = boost::winapi::FormatMessageW( + FORMAT_MESSAGE_ALLOCATE_BUFFER_ | FORMAT_MESSAGE_FROM_SYSTEM_ | FORMAT_MESSAGE_IGNORE_INSERTS_, + NULL, + ev, + MAKELANGID_( LANG_NEUTRAL_, SUBLANG_DEFAULT_ ), // Default language + (LPWSTR_) &lpMsgBuf, + 0, + NULL + ); + + if( retval != 0 ) + { + r = boost::winapi::WideCharToMultiByte( code_page, 0, lpMsgBuf, -1, buffer, static_cast<int>( len ), NULL, NULL ); + boost::winapi::LocalFree( lpMsgBuf ); + if ( r != 0 ) --r; // exclude null terminator + } + } + + if( r == 0 ) + { + return unknown_message_win32( ev, buffer, len ); + } + + while( r > 0 && ( buffer[ r-1 ] == '\n' || buffer[ r-1 ] == '\r' ) ) + { + buffer[ --r ] = 0; + } + + if( r > 0 && buffer[ r-1 ] == '.' ) + { + buffer[ --r ] = 0; + } + + return buffer; +} + +struct local_free +{ + void * p_; + + ~local_free() + { + boost::winapi::LocalFree( p_ ); + } +}; + +inline std::string unknown_message_win32( int ev ) +{ + char buffer[ 38 ]; + return unknown_message_win32( ev, buffer, sizeof( buffer ) ); +} + +inline std::string system_category_message_win32( int ev ) +{ + using namespace boost::winapi; + + wchar_t * lpMsgBuf = 0; + + DWORD_ retval = boost::winapi::FormatMessageW( + FORMAT_MESSAGE_ALLOCATE_BUFFER_ | FORMAT_MESSAGE_FROM_SYSTEM_ | FORMAT_MESSAGE_IGNORE_INSERTS_, + NULL, + ev, + MAKELANGID_( LANG_NEUTRAL_, SUBLANG_DEFAULT_ ), // Default language + (LPWSTR_) &lpMsgBuf, + 0, + NULL + ); + + if( retval == 0 ) + { + return unknown_message_win32( ev ); + } + + local_free lf_ = { lpMsgBuf }; + (void)lf_; + + UINT_ const code_page = message_cp_win32(); + + int r = boost::winapi::WideCharToMultiByte( code_page, 0, lpMsgBuf, -1, 0, 0, NULL, NULL ); + + if( r == 0 ) + { + return unknown_message_win32( ev ); + } + + std::string buffer( r, char() ); + + r = boost::winapi::WideCharToMultiByte( code_page, 0, lpMsgBuf, -1, &buffer[0], r, NULL, NULL ); + + if( r == 0 ) + { + return unknown_message_win32( ev ); + } + + --r; // exclude null terminator + + while( r > 0 && ( buffer[ r-1 ] == '\n' || buffer[ r-1 ] == '\r' ) ) + { + --r; + } + + if( r > 0 && buffer[ r-1 ] == '.' ) + { + --r; + } + + buffer.resize( r ); + + return buffer; +} + +} // namespace detail + +} // namespace system + +} // namespace boost + +#endif // #ifndef BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_MESSAGE_WIN32_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/detail/throws.hpp b/contrib/restricted/boost/system/include/boost/system/detail/throws.hpp new file mode 100644 index 0000000000..1a224980c9 --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/detail/throws.hpp @@ -0,0 +1,59 @@ +#ifndef BOOST_SYSTEM_DETAIL_THROWS_HPP_INCLUDED +#define BOOST_SYSTEM_DETAIL_THROWS_HPP_INCLUDED + +// Copyright Beman Dawes 2006, 2007 +// Copyright Christoper Kohlhoff 2007 +// Copyright Peter Dimov 2017, 2018 +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See library home page at http://www.boost.org/libs/system + +namespace boost +{ + +namespace system +{ + +class error_code; + +} // namespace system + +// boost::throws() + +namespace detail +{ + +// Misuse of the error_code object is turned into a noisy failure by +// poisoning the reference. This particular implementation doesn't +// produce warnings or errors from popular compilers, is very efficient +// (as determined by inspecting generated code), and does not suffer +// from order of initialization problems. In practice, it also seems +// cause user function error handling implementation errors to be detected +// very early in the development cycle. + +inline system::error_code* throws() +{ + // See github.com/boostorg/system/pull/12 by visigoth for why the return + // is poisoned with nonzero rather than (0). A test, test_throws_usage(), + // has been added to error_code_test.cpp, and as visigoth mentioned it + // fails on clang for release builds with a return of 0 but works fine + // with (1). + // Since the undefined behavior sanitizer (-fsanitize=undefined) does not + // allow a reference to be formed to the unaligned address of (1), we use + // (8) instead. + + return reinterpret_cast<system::error_code*>(8); +} + +} // namespace detail + +inline system::error_code& throws() +{ + return *detail::throws(); +} + +} // namespace boost + +#endif // #ifndef BOOST_SYSTEM_DETAIL_THROWS_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/errc.hpp b/contrib/restricted/boost/system/include/boost/system/errc.hpp new file mode 100644 index 0000000000..2b642cd764 --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/errc.hpp @@ -0,0 +1,57 @@ +#ifndef BOOST_SYSTEM_ERRC_HPP_INCLUDED +#define BOOST_SYSTEM_ERRC_HPP_INCLUDED + +// Copyright Beman Dawes 2006, 2007 +// Copyright Christoper Kohlhoff 2007 +// Copyright Peter Dimov 2017, 2018, 2020 +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See library home page at http://www.boost.org/libs/system + +#include <boost/system/detail/errc.hpp> +#include <boost/system/detail/error_code.hpp> +#include <boost/system/detail/error_condition.hpp> +#include <boost/system/detail/generic_category.hpp> +#include <boost/system/detail/error_category_impl.hpp> +#include <boost/system/detail/config.hpp> +#include <boost/assert/source_location.hpp> +#include <boost/config.hpp> + +namespace boost +{ + +namespace system +{ + +// make_* functions for errc::errc_t + +namespace errc +{ + +// explicit conversion: +BOOST_SYSTEM_CONSTEXPR inline error_code make_error_code( errc_t e ) BOOST_NOEXCEPT +{ + return error_code( e, generic_category() ); +} + +// explicit conversion: +inline error_code make_error_code( errc_t e, boost::source_location const * loc ) BOOST_NOEXCEPT +{ + return error_code( e, generic_category(), loc ); +} + +// implicit conversion: +BOOST_SYSTEM_CONSTEXPR inline error_condition make_error_condition( errc_t e ) BOOST_NOEXCEPT +{ + return error_condition( e, generic_category() ); +} + +} // namespace errc + +} // namespace system + +} // namespace boost + +#endif // #ifndef BOOST_SYSTEM_ERRC_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/error_category.hpp b/contrib/restricted/boost/system/include/boost/system/error_category.hpp new file mode 100644 index 0000000000..5b6199bc44 --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/error_category.hpp @@ -0,0 +1,13 @@ +#ifndef BOOST_SYSTEM_ERROR_CATEGORY_HPP_INCLUDED +#define BOOST_SYSTEM_ERROR_CATEGORY_HPP_INCLUDED + +// Copyright 2020 Peter Dimov +// Distributed under the Boost Software License, Version 1.0 +// http://www.boost.org/LICENSE_1_0.txt +// +// See library home page at http://www.boost.org/libs/system + +#include <boost/system/detail/error_category.hpp> +#include <boost/system/detail/error_category_impl.hpp> + +#endif // #ifndef BOOST_SYSTEM_ERROR_CATEGORY_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/error_code.hpp b/contrib/restricted/boost/system/include/boost/system/error_code.hpp index f31155d61f..751195c9aa 100644 --- a/contrib/restricted/boost/system/include/boost/system/error_code.hpp +++ b/contrib/restricted/boost/system/include/boost/system/error_code.hpp @@ -1,769 +1,21 @@ -// boost/system/error_code.hpp -------------------------------------------------------// +#ifndef BOOST_SYSTEM_ERROR_CODE_HPP_INCLUDED +#define BOOST_SYSTEM_ERROR_CODE_HPP_INCLUDED // Copyright Beman Dawes 2006, 2007 // Copyright Christoper Kohlhoff 2007 // Copyright Peter Dimov 2017, 2018 - +// // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - +// // See library home page at http://www.boost.org/libs/system -#ifndef BOOST_SYSTEM_ERROR_CODE_HPP -#define BOOST_SYSTEM_ERROR_CODE_HPP - -#include <boost/system/config.hpp> -#include <boost/cstdint.hpp> -#include <boost/assert.hpp> -#include <boost/noncopyable.hpp> -#include <boost/utility/enable_if.hpp> -#include <ostream> -#include <string> -#include <stdexcept> -#include <functional> - -// TODO: undef these macros if not already defined -#include <boost/cerrno.hpp> - -#if !defined(BOOST_POSIX_API) && !defined(BOOST_WINDOWS_API) -# error BOOST_POSIX_API or BOOST_WINDOWS_API must be defined -#endif - -#ifndef BOOST_NO_CXX11_HDR_SYSTEM_ERROR -#include <system_error> -#endif - -#include <boost/config/abi_prefix.hpp> // must be the last #include - -#ifndef BOOST_SYSTEM_NOEXCEPT -#define BOOST_SYSTEM_NOEXCEPT BOOST_NOEXCEPT -#endif - -namespace boost -{ - namespace system - { - - class error_code; // values defined by the operating system - class error_condition; // portable generic values defined below, but ultimately - // based on the POSIX standard - - // "Concept" helpers -------------------------------------------------------------// - - template< class T > - struct is_error_code_enum { static const bool value = false; }; - - template< class T > - struct is_error_condition_enum { static const bool value = false; }; - - // generic error_conditions ------------------------------------------------------// - - namespace errc - { - enum errc_t - { - success = 0, - address_family_not_supported = EAFNOSUPPORT, - address_in_use = EADDRINUSE, - address_not_available = EADDRNOTAVAIL, - already_connected = EISCONN, - argument_list_too_long = E2BIG, - argument_out_of_domain = EDOM, - bad_address = EFAULT, - bad_file_descriptor = EBADF, - bad_message = EBADMSG, - broken_pipe = EPIPE, - connection_aborted = ECONNABORTED, - connection_already_in_progress = EALREADY, - connection_refused = ECONNREFUSED, - connection_reset = ECONNRESET, - cross_device_link = EXDEV, - destination_address_required = EDESTADDRREQ, - device_or_resource_busy = EBUSY, - directory_not_empty = ENOTEMPTY, - executable_format_error = ENOEXEC, - file_exists = EEXIST, - file_too_large = EFBIG, - filename_too_long = ENAMETOOLONG, - function_not_supported = ENOSYS, - host_unreachable = EHOSTUNREACH, - identifier_removed = EIDRM, - illegal_byte_sequence = EILSEQ, - inappropriate_io_control_operation = ENOTTY, - interrupted = EINTR, - invalid_argument = EINVAL, - invalid_seek = ESPIPE, - io_error = EIO, - is_a_directory = EISDIR, - message_size = EMSGSIZE, - network_down = ENETDOWN, - network_reset = ENETRESET, - network_unreachable = ENETUNREACH, - no_buffer_space = ENOBUFS, - no_child_process = ECHILD, - no_link = ENOLINK, - no_lock_available = ENOLCK, - no_message_available = ENODATA, - no_message = ENOMSG, - no_protocol_option = ENOPROTOOPT, - no_space_on_device = ENOSPC, - no_stream_resources = ENOSR, - no_such_device_or_address = ENXIO, - no_such_device = ENODEV, - no_such_file_or_directory = ENOENT, - no_such_process = ESRCH, - not_a_directory = ENOTDIR, - not_a_socket = ENOTSOCK, - not_a_stream = ENOSTR, - not_connected = ENOTCONN, - not_enough_memory = ENOMEM, - not_supported = ENOTSUP, - operation_canceled = ECANCELED, - operation_in_progress = EINPROGRESS, - operation_not_permitted = EPERM, - operation_not_supported = EOPNOTSUPP, - operation_would_block = EWOULDBLOCK, - owner_dead = EOWNERDEAD, - permission_denied = EACCES, - protocol_error = EPROTO, - protocol_not_supported = EPROTONOSUPPORT, - read_only_file_system = EROFS, - resource_deadlock_would_occur = EDEADLK, - resource_unavailable_try_again = EAGAIN, - result_out_of_range = ERANGE, - state_not_recoverable = ENOTRECOVERABLE, - stream_timeout = ETIME, - text_file_busy = ETXTBSY, - timed_out = ETIMEDOUT, - too_many_files_open_in_system = ENFILE, - too_many_files_open = EMFILE, - too_many_links = EMLINK, - too_many_symbolic_link_levels = ELOOP, - value_too_large = EOVERFLOW, - wrong_protocol_type = EPROTOTYPE - }; - - } // namespace errc - -# ifdef BOOST_SYSTEM_ENABLE_DEPRECATED - namespace posix = errc; - namespace posix_error = errc; -# endif - - template<> struct is_error_condition_enum<errc::errc_t> - { static const bool value = true; }; - - - // --------------------------------------------------------------------------------// - - // Operating system specific interfaces ------------------------------------------// - - - // The interface is divided into general and system-specific portions to - // meet these requirements: - // - // * Code calling an operating system API can create an error_code with - // a single category (system_category), even for POSIX-like operating - // systems that return some POSIX errno values and some native errno - // values. This code should not have to pay the cost of distinguishing - // between categories, since it is not yet known if that is needed. - // - // * Users wishing to write system-specific code should be given enums for - // at least the common error cases. - // - // * System specific code should fail at compile time if moved to another - // operating system. - - // The system specific portions of the interface are located in headers - // with names reflecting the operating system. For example, - // - // <boost/system/cygwin_error.hpp> - // <boost/system/linux_error.hpp> - // <boost/system/windows_error.hpp> - // - // These headers are effectively empty for compiles on operating systems - // where they are not applicable. - - // --------------------------------------------------------------------------------// - - class error_category; - - // predefined error categories ---------------------------------------------------// - -#ifdef BOOST_ERROR_CODE_HEADER_ONLY - inline const error_category & system_category() BOOST_SYSTEM_NOEXCEPT; - inline const error_category & generic_category() BOOST_SYSTEM_NOEXCEPT; -#else - BOOST_SYSTEM_DECL const error_category & system_category() BOOST_SYSTEM_NOEXCEPT; - BOOST_SYSTEM_DECL const error_category & generic_category() BOOST_SYSTEM_NOEXCEPT; -#endif - // deprecated synonyms ------------------------------------------------------------// - -#ifdef BOOST_SYSTEM_ENABLE_DEPRECATED - inline const error_category & get_system_category() { return system_category(); } - inline const error_category & get_generic_category() { return generic_category(); } - inline const error_category & get_posix_category() { return generic_category(); } - static const error_category & posix_category BOOST_ATTRIBUTE_UNUSED - = generic_category(); - static const error_category & errno_ecat BOOST_ATTRIBUTE_UNUSED - = generic_category(); - static const error_category & native_ecat BOOST_ATTRIBUTE_UNUSED - = system_category(); -#endif - -#ifdef BOOST_MSVC -#pragma warning(push) -// 'this' : used in base member initializer list -#pragma warning(disable: 4355) -#endif - - // class error_category ------------------------------------------------// - - class error_category : public noncopyable - { -#ifndef BOOST_NO_CXX11_HDR_SYSTEM_ERROR - - private: - - class std_category: public std::error_category - { - private: - - boost::system::error_category const * pc_; - - public: - - explicit std_category( boost::system::error_category const * pc ): pc_( pc ) - { - } - - virtual const char * name() const BOOST_NOEXCEPT - { - return pc_->name(); - } - - virtual std::string message( int ev ) const - { - return pc_->message( ev ); - } - - virtual std::error_condition default_error_condition( int ev ) const - BOOST_NOEXCEPT; - virtual bool equivalent( int code, const std::error_condition & condition ) const - BOOST_NOEXCEPT; - virtual bool equivalent( const std::error_code & code, int condition ) const - BOOST_NOEXCEPT; - }; - - std_category std_cat_; - - public: - - error_category() BOOST_SYSTEM_NOEXCEPT: std_cat_( this ) {} - - operator std::error_category const & () const BOOST_SYSTEM_NOEXCEPT - { - // do not map generic to std::generic on purpose; occasionally, - // there are two std::generic categories in a program, which leads - // to error codes/conditions mysteriously not being equal to themselves - return std_cat_; - } - -#else - - // to maintain ABI compatibility between 03 and 11, - // define a class with the same layout - - private: - - class std_category - { - private: - - boost::system::error_category const * pc_; - - public: - - explicit std_category( boost::system::error_category const * pc ): pc_( pc ) - { - } - - virtual ~std_category() {} - - virtual const char * name() const BOOST_NOEXCEPT - { - return pc_->name(); - } - - // we can't define message, because (1) it returns an std::string, - // which can be different between 03 and 11, and (2) on mingw, there - // are actually two `message` functions, not one, so it doesn't work - // even if we do - - // neither can we define default_error_condition or equivalent - - // if these functions are called, it will crash, but that's still - // better than the alternative of having the class layout change - }; - - std_category std_cat_; - - public: - - error_category() BOOST_SYSTEM_NOEXCEPT: std_cat_( this ) {} - -#endif - - public: - virtual ~error_category(){} - - virtual const char * name() const BOOST_SYSTEM_NOEXCEPT = 0; - virtual std::string message( int ev ) const = 0; - inline virtual error_condition default_error_condition( int ev ) const - BOOST_SYSTEM_NOEXCEPT; - inline virtual bool equivalent( int code, - const error_condition & condition ) const - BOOST_SYSTEM_NOEXCEPT; - inline virtual bool equivalent( const error_code & code, - int condition ) const BOOST_SYSTEM_NOEXCEPT; - - bool operator==(const error_category & rhs) const BOOST_SYSTEM_NOEXCEPT - { return this == &rhs; } - bool operator!=(const error_category & rhs) const BOOST_SYSTEM_NOEXCEPT - { return this != &rhs; } - bool operator<( const error_category & rhs ) const BOOST_SYSTEM_NOEXCEPT - { return std::less<const error_category*>()( this, &rhs ); } - }; - -#ifdef BOOST_MSVC -#pragma warning(pop) -#endif - - // class error_condition ---------------------------------------------------------// - - // error_conditions are portable, error_codes are system or library specific - - class error_condition - { - public: - - // constructors: - error_condition() BOOST_SYSTEM_NOEXCEPT : m_val(0), m_cat(&generic_category()) {} - error_condition( int val, const error_category & cat ) BOOST_SYSTEM_NOEXCEPT - : m_val(val), m_cat(&cat) {} - - template <class ErrorConditionEnum> - error_condition(ErrorConditionEnum e, - typename boost::enable_if<is_error_condition_enum<ErrorConditionEnum> >::type* - = 0) BOOST_SYSTEM_NOEXCEPT - { - *this = make_error_condition(e); - } - - // modifiers: - - void assign( int val, const error_category & cat ) BOOST_SYSTEM_NOEXCEPT - { - m_val = val; - m_cat = &cat; - } - - template<typename ErrorConditionEnum> - typename boost::enable_if<is_error_condition_enum<ErrorConditionEnum>, - error_condition>::type & - operator=( ErrorConditionEnum val ) BOOST_SYSTEM_NOEXCEPT - { - *this = make_error_condition(val); - return *this; - } - - void clear() BOOST_SYSTEM_NOEXCEPT - { - m_val = 0; - m_cat = &generic_category(); - } - - // observers: - int value() const BOOST_SYSTEM_NOEXCEPT { return m_val; } - const error_category & category() const BOOST_SYSTEM_NOEXCEPT { return *m_cat; } - std::string message() const { return m_cat->message(value()); } - -#if !defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) - - explicit operator bool() const BOOST_SYSTEM_NOEXCEPT // true if error - { - return m_val != 0; - } - -#else - - typedef void (*unspecified_bool_type)(); - static void unspecified_bool_true() {} - - operator unspecified_bool_type() const BOOST_SYSTEM_NOEXCEPT // true if error - { - return m_val == 0 ? 0 : unspecified_bool_true; - } - - bool operator!() const BOOST_SYSTEM_NOEXCEPT // true if no error - { - return m_val == 0; - } - -#endif - - // relationals: - // the more symmetrical non-member syntax allows enum - // conversions work for both rhs and lhs. - inline friend bool operator==( const error_condition & lhs, - const error_condition & rhs ) BOOST_SYSTEM_NOEXCEPT - { - return lhs.m_cat == rhs.m_cat && lhs.m_val == rhs.m_val; - } - - inline friend bool operator<( const error_condition & lhs, - const error_condition & rhs ) BOOST_SYSTEM_NOEXCEPT - // the more symmetrical non-member syntax allows enum - // conversions work for both rhs and lhs. - { - return lhs.m_cat < rhs.m_cat - || (lhs.m_cat == rhs.m_cat && lhs.m_val < rhs.m_val); - } - -#ifndef BOOST_NO_CXX11_HDR_SYSTEM_ERROR - - operator std::error_condition () const BOOST_SYSTEM_NOEXCEPT - { - return std::error_condition( value(), category() ); - } - -#endif - - private: - int m_val; - const error_category * m_cat; - - }; - - // class error_code --------------------------------------------------------------// - - // We want error_code to be a value type that can be copied without slicing - // and without requiring heap allocation, but we also want it to have - // polymorphic behavior based on the error category. This is achieved by - // abstract base class error_category supplying the polymorphic behavior, - // and error_code containing a pointer to an object of a type derived - // from error_category. - class error_code - { - public: - - // constructors: - error_code() BOOST_SYSTEM_NOEXCEPT : m_val(0), m_cat(&system_category()) {} - error_code( int val, const error_category & cat ) BOOST_SYSTEM_NOEXCEPT - : m_val(val), m_cat(&cat) {} - - template <class ErrorCodeEnum> - error_code(ErrorCodeEnum e, - typename boost::enable_if<is_error_code_enum<ErrorCodeEnum> >::type* = 0) - BOOST_SYSTEM_NOEXCEPT - { - *this = make_error_code(e); - } - - // modifiers: - void assign( int val, const error_category & cat ) BOOST_SYSTEM_NOEXCEPT - { - m_val = val; - m_cat = &cat; - } - - template<typename ErrorCodeEnum> - typename boost::enable_if<is_error_code_enum<ErrorCodeEnum>, error_code>::type & - operator=( ErrorCodeEnum val ) BOOST_SYSTEM_NOEXCEPT - { - *this = make_error_code(val); - return *this; - } - - void clear() BOOST_SYSTEM_NOEXCEPT - { - m_val = 0; - m_cat = &system_category(); - } - - // observers: - int value() const BOOST_SYSTEM_NOEXCEPT { return m_val; } - const error_category & category() const BOOST_SYSTEM_NOEXCEPT { return *m_cat; } - error_condition default_error_condition() const BOOST_SYSTEM_NOEXCEPT - { return m_cat->default_error_condition(value()); } - std::string message() const { return m_cat->message(value()); } - -#if !defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) - - explicit operator bool() const BOOST_SYSTEM_NOEXCEPT // true if error - { - return m_val != 0; - } - -#else - - typedef void (*unspecified_bool_type)(); - static void unspecified_bool_true() {} - - operator unspecified_bool_type() const BOOST_SYSTEM_NOEXCEPT // true if error - { - return m_val == 0 ? 0 : unspecified_bool_true; - } - - bool operator!() const BOOST_SYSTEM_NOEXCEPT // true if no error - { - return m_val == 0; - } - -#endif - - // relationals: - inline friend bool operator==( const error_code & lhs, - const error_code & rhs ) BOOST_SYSTEM_NOEXCEPT - // the more symmetrical non-member syntax allows enum - // conversions work for both rhs and lhs. - { - return lhs.m_cat == rhs.m_cat && lhs.m_val == rhs.m_val; - } - - inline friend bool operator<( const error_code & lhs, - const error_code & rhs ) BOOST_SYSTEM_NOEXCEPT - // the more symmetrical non-member syntax allows enum - // conversions work for both rhs and lhs. - { - return lhs.m_cat < rhs.m_cat - || (lhs.m_cat == rhs.m_cat && lhs.m_val < rhs.m_val); - } - -#ifndef BOOST_NO_CXX11_HDR_SYSTEM_ERROR - - operator std::error_code () const BOOST_SYSTEM_NOEXCEPT - { - return std::error_code( value(), category() ); - } - -#endif - - private: - int m_val; - const error_category * m_cat; - - }; - - // predefined error_code object used as "throw on error" tag -# ifdef BOOST_SYSTEM_ENABLE_DEPRECATED - BOOST_SYSTEM_DECL extern error_code throws; -# endif - - // Moving from a "throws" object to a "throws" function without breaking - // existing code is a bit of a problem. The workaround is to place the - // "throws" function in namespace boost rather than namespace boost::system. - - } // namespace system - - namespace detail - { - // Misuse of the error_code object is turned into a noisy failure by - // poisoning the reference. This particular implementation doesn't - // produce warnings or errors from popular compilers, is very efficient - // (as determined by inspecting generated code), and does not suffer - // from order of initialization problems. In practice, it also seems - // cause user function error handling implementation errors to be detected - // very early in the development cycle. - inline system::error_code* throws() - { - // See github.com/boostorg/system/pull/12 by visigoth for why the return - // is poisoned with nonzero rather than (0). A test, test_throws_usage(), - // has been added to error_code_test.cpp, and as visigoth mentioned it - // fails on clang for release builds with a return of 0 but works fine - // with (1). - // Since the undefined behavior sanitizer (-fsanitize=undefined) does not - // allow a reference to be formed to the unaligned address of (1), we use - // (8) instead. - return reinterpret_cast<system::error_code*>(8); - } - } - - inline system::error_code& throws() - { return *detail::throws(); } - - namespace system - { - // non-member functions ------------------------------------------------// - - inline bool operator!=( const error_code & lhs, - const error_code & rhs ) BOOST_SYSTEM_NOEXCEPT - { - return !(lhs == rhs); - } - - inline bool operator!=( const error_condition & lhs, - const error_condition & rhs ) BOOST_SYSTEM_NOEXCEPT - { - return !(lhs == rhs); - } - - inline bool operator==( const error_code & code, - const error_condition & condition ) BOOST_SYSTEM_NOEXCEPT - { - return code.category().equivalent( code.value(), condition ) - || condition.category().equivalent( code, condition.value() ); - } - - inline bool operator!=( const error_code & lhs, - const error_condition & rhs ) BOOST_SYSTEM_NOEXCEPT - { - return !(lhs == rhs); - } - - inline bool operator==( const error_condition & condition, - const error_code & code ) BOOST_SYSTEM_NOEXCEPT - { - return condition.category().equivalent( code, condition.value() ) - || code.category().equivalent( code.value(), condition ); - } - - inline bool operator!=( const error_condition & lhs, - const error_code & rhs ) BOOST_SYSTEM_NOEXCEPT - { - return !(lhs == rhs); - } - - // TODO: both of these may move elsewhere, but the LWG hasn't spoken yet. - - template <class charT, class traits> - inline std::basic_ostream<charT,traits>& - operator<< (std::basic_ostream<charT,traits>& os, error_code ec) - { - os << ec.category().name() << ':' << ec.value(); - return os; - } - - inline std::size_t hash_value( const error_code & ec ) - { - return static_cast<std::size_t>(ec.value()) - + reinterpret_cast<std::size_t>(&ec.category()); - } - - // make_* functions for errc::errc_t ---------------------------------------------// - - namespace errc - { - // explicit conversion: - inline error_code make_error_code( errc_t e ) BOOST_SYSTEM_NOEXCEPT - { return error_code( e, generic_category() ); } - - // implicit conversion: - inline error_condition make_error_condition( errc_t e ) BOOST_SYSTEM_NOEXCEPT - { return error_condition( e, generic_category() ); } - } - - // error_category default implementation -----------------------------------------// - - error_condition error_category::default_error_condition( int ev ) const - BOOST_SYSTEM_NOEXCEPT - { - return error_condition( ev, *this ); - } - - bool error_category::equivalent( int code, - const error_condition & condition ) const BOOST_SYSTEM_NOEXCEPT - { - return default_error_condition( code ) == condition; - } - - bool error_category::equivalent( const error_code & code, - int condition ) const BOOST_SYSTEM_NOEXCEPT - { - return *this == code.category() && code.value() == condition; - } - -#ifndef BOOST_NO_CXX11_HDR_SYSTEM_ERROR - - inline std::error_condition error_category::std_category::default_error_condition( - int ev ) const BOOST_NOEXCEPT - { - return pc_->default_error_condition( ev ); - } - - inline bool error_category::std_category::equivalent( int code, - const std::error_condition & condition ) const BOOST_NOEXCEPT - { - if( condition.category() == *this ) - { - boost::system::error_condition bn( condition.value(), *pc_ ); - return pc_->equivalent( code, bn ); - } - else if( condition.category() == std::generic_category() - || condition.category() == boost::system::generic_category() ) - { - boost::system::error_condition bn( condition.value(), - boost::system::generic_category() ); - - return pc_->equivalent( code, bn ); - } -#ifndef BOOST_NO_RTTI - else if( std_category const* pc2 = dynamic_cast< std_category const* >( - &condition.category() ) ) - { - boost::system::error_condition bn( condition.value(), *pc2->pc_ ); - return pc_->equivalent( code, bn ); - } -#endif - else - { - return default_error_condition( code ) == condition; - } - } - - inline bool error_category::std_category::equivalent( const std::error_code & code, - int condition ) const BOOST_NOEXCEPT - { - if( code.category() == *this ) - { - boost::system::error_code bc( code.value(), *pc_ ); - return pc_->equivalent( bc, condition ); - } - else if( code.category() == std::generic_category() - || code.category() == boost::system::generic_category() ) - { - boost::system::error_code bc( code.value(), - boost::system::generic_category() ); - - return pc_->equivalent( bc, condition ); - } -#ifndef BOOST_NO_RTTI - else if( std_category const* pc2 = dynamic_cast< std_category const* >( - &code.category() ) ) - { - boost::system::error_code bc( code.value(), *pc2->pc_ ); - return pc_->equivalent( bc, condition ); - } -#endif - else if( *pc_ == boost::system::generic_category() ) - { - return std::generic_category().equivalent( code, condition ); - } - else - { - return false; - } - } - -#endif - - } // namespace system -} // namespace boost - -#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas - -# ifdef BOOST_ERROR_CODE_HEADER_ONLY -# include <boost/system/detail/error_code.ipp> -# endif +#include <boost/system/detail/error_code.hpp> +#include <boost/system/error_category.hpp> +#include <boost/system/error_condition.hpp> +#include <boost/system/errc.hpp> +#include <boost/system/generic_category.hpp> +#include <boost/system/system_category.hpp> +#include <boost/system/detail/throws.hpp> -#endif // BOOST_SYSTEM_ERROR_CODE_HPP +#endif // BOOST_SYSTEM_ERROR_CODE_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/error_condition.hpp b/contrib/restricted/boost/system/include/boost/system/error_condition.hpp new file mode 100644 index 0000000000..2a8cec162a --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/error_condition.hpp @@ -0,0 +1,13 @@ +#ifndef BOOST_SYSTEM_ERROR_CONDITION_HPP_INCLUDED +#define BOOST_SYSTEM_ERROR_CONDITION_HPP_INCLUDED + +// Copyright 2020 Peter Dimov +// Distributed under the Boost Software License, Version 1.0 +// http://www.boost.org/LICENSE_1_0.txt +// +// See library home page at http://www.boost.org/libs/system + +#include <boost/system/detail/error_condition.hpp> +#include <boost/system/detail/error_category_impl.hpp> + +#endif // #ifndef BOOST_SYSTEM_ERROR_CONDITION_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/generic_category.hpp b/contrib/restricted/boost/system/include/boost/system/generic_category.hpp new file mode 100644 index 0000000000..f374c2a7e6 --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/generic_category.hpp @@ -0,0 +1,13 @@ +#ifndef BOOST_SYSTEM_GENERIC_CATEGORY_HPP_INCLUDED +#define BOOST_SYSTEM_GENERIC_CATEGORY_HPP_INCLUDED + +// Copyright 2020 Peter Dimov +// Distributed under the Boost Software License, Version 1.0 +// http://www.boost.org/LICENSE_1_0.txt +// +// See library home page at http://www.boost.org/libs/system + +#include <boost/system/detail/generic_category.hpp> +#include <boost/system/detail/error_category_impl.hpp> + +#endif // #ifndef BOOST_SYSTEM_GENERIC_CATEGORY_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/is_error_code_enum.hpp b/contrib/restricted/boost/system/include/boost/system/is_error_code_enum.hpp new file mode 100644 index 0000000000..789a5b0ae6 --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/is_error_code_enum.hpp @@ -0,0 +1,30 @@ +#ifndef BOOST_SYSTEM_IS_ERROR_CODE_ENUM_HPP_INCLUDED +#define BOOST_SYSTEM_IS_ERROR_CODE_ENUM_HPP_INCLUDED + +// Copyright Beman Dawes 2006, 2007 +// Copyright Christoper Kohlhoff 2007 +// Copyright Peter Dimov 2017, 2018 +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See library home page at http://www.boost.org/libs/system + +namespace boost +{ + +namespace system +{ + +class error_code; + +template<class T> struct is_error_code_enum +{ + static const bool value = false; +}; + +} // namespace system + +} // namespace boost + +#endif // #ifndef BOOST_SYSTEM_IS_ERROR_CODE_ENUM_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/is_error_condition_enum.hpp b/contrib/restricted/boost/system/include/boost/system/is_error_condition_enum.hpp new file mode 100644 index 0000000000..15fb6d4f5a --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/is_error_condition_enum.hpp @@ -0,0 +1,30 @@ +#ifndef BOOST_SYSTEM_IS_ERROR_CONDITION_ENUM_HPP_INCLUDED +#define BOOST_SYSTEM_IS_ERROR_CONDITION_ENUM_HPP_INCLUDED + +// Copyright Beman Dawes 2006, 2007 +// Copyright Christoper Kohlhoff 2007 +// Copyright Peter Dimov 2017, 2018 +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See library home page at http://www.boost.org/libs/system + +namespace boost +{ + +namespace system +{ + +class error_condition; + +template<class T> struct is_error_condition_enum +{ + static const bool value = false; +}; + +} // namespace system + +} // namespace boost + +#endif // #ifndef BOOST_SYSTEM_IS_ERROR_CONDITION_ENUM_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/system_category.hpp b/contrib/restricted/boost/system/include/boost/system/system_category.hpp new file mode 100644 index 0000000000..fe08bc68dc --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/system_category.hpp @@ -0,0 +1,14 @@ +#ifndef BOOST_SYSTEM_SYSTEM_CATEGORY_HPP_INCLUDED +#define BOOST_SYSTEM_SYSTEM_CATEGORY_HPP_INCLUDED + +// Copyright 2020 Peter Dimov +// Distributed under the Boost Software License, Version 1.0 +// http://www.boost.org/LICENSE_1_0.txt +// +// See library home page at http://www.boost.org/libs/system + +#include <boost/system/detail/system_category.hpp> +#include <boost/system/detail/system_category_impl.hpp> +#include <boost/system/detail/error_category_impl.hpp> + +#endif // #ifndef BOOST_SYSTEM_SYSTEM_CATEGORY_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/system_error.hpp b/contrib/restricted/boost/system/include/boost/system/system_error.hpp index c5e7e402ba..09d65e2ac6 100644 --- a/contrib/restricted/boost/system/include/boost/system/system_error.hpp +++ b/contrib/restricted/boost/system/include/boost/system/system_error.hpp @@ -1,84 +1,55 @@ -// Boost system_error.hpp --------------------------------------------------// - -// Copyright Beman Dawes 2006 - -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - #ifndef BOOST_SYSTEM_SYSTEM_ERROR_HPP #define BOOST_SYSTEM_SYSTEM_ERROR_HPP +// Copyright Beman Dawes 2006 +// Copyright Peter Dimov 2021 +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#include <boost/system/errc.hpp> +#include <boost/system/detail/error_code.hpp> #include <string> #include <stdexcept> #include <cassert> -#include <boost/system/error_code.hpp> namespace boost { - namespace system - { - // class system_error ------------------------------------------------------------// - - class BOOST_SYMBOL_VISIBLE system_error : public std::runtime_error - // BOOST_SYMBOL_VISIBLE is needed by GCC to ensure system_error thrown from a shared - // library can be caught. See svn.boost.org/trac/boost/ticket/3697 - { - public: - system_error( error_code ec ) - : std::runtime_error(""), m_error_code(ec) {} +namespace system +{ - system_error( error_code ec, const std::string & what_arg ) - : std::runtime_error(what_arg), m_error_code(ec) {} +class BOOST_SYMBOL_VISIBLE system_error: public std::runtime_error +{ +private: - system_error( error_code ec, const char* what_arg ) - : std::runtime_error(what_arg), m_error_code(ec) {} + error_code code_; - system_error( int ev, const error_category & ecat ) - : std::runtime_error(""), m_error_code(ev,ecat) {} +public: - system_error( int ev, const error_category & ecat, - const std::string & what_arg ) - : std::runtime_error(what_arg), m_error_code(ev,ecat) {} + explicit system_error( error_code const & ec ): + std::runtime_error( ec.what() ), code_( ec ) {} - system_error( int ev, const error_category & ecat, - const char * what_arg ) - : std::runtime_error(what_arg), m_error_code(ev,ecat) {} + system_error( error_code const & ec, std::string const & prefix ): + std::runtime_error( prefix + ": " + ec.what() ), code_( ec ) {} - virtual ~system_error() BOOST_NOEXCEPT_OR_NOTHROW {} + system_error( error_code const & ec, char const * prefix ): + std::runtime_error( std::string( prefix ) + ": " + ec.what() ), code_( ec ) {} - const error_code & code() const BOOST_NOEXCEPT_OR_NOTHROW { return m_error_code; } - const char * what() const BOOST_NOEXCEPT_OR_NOTHROW; + system_error( int ev, error_category const & ecat ): + std::runtime_error( error_code( ev, ecat ).what() ), code_( ev, ecat ) {} - private: - error_code m_error_code; - mutable std::string m_what; - }; + system_error( int ev, error_category const & ecat, std::string const & prefix ): + std::runtime_error( prefix + ": " + error_code( ev, ecat ).what() ), code_( ev, ecat ) {} - // implementation ------------------------------------------------------// + system_error( int ev, error_category const & ecat, char const * prefix ): + std::runtime_error( std::string( prefix ) + ": " + error_code( ev, ecat ).what() ), code_( ev, ecat ) {} - inline const char * system_error::what() const BOOST_NOEXCEPT_OR_NOTHROW - // see http://www.boost.org/more/error_handling.html for lazy build rationale + error_code code() const BOOST_NOEXCEPT { - if ( m_what.empty() ) - { -#ifndef BOOST_NO_EXCEPTIONS - try -#endif - { - m_what = this->std::runtime_error::what(); - if ( !m_what.empty() ) m_what += ": "; - m_what += m_error_code.message(); - } -#ifndef BOOST_NO_EXCEPTIONS - catch (...) { return std::runtime_error::what(); } -#endif - } - return m_what.c_str(); + return code_; } +}; - } // namespace system +} // namespace system } // namespace boost #endif // BOOST_SYSTEM_SYSTEM_ERROR_HPP - - diff --git a/contrib/restricted/boost/system/src/error_code.cpp b/contrib/restricted/boost/system/src/error_code.cpp deleted file mode 100644 index aa628ab304..0000000000 --- a/contrib/restricted/boost/system/src/error_code.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// error_code support implementation file ----------------------------------// - -// Copyright Beman Dawes 2002, 2006 - -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -// See library home page at http://www.boost.org/libs/system - -//----------------------------------------------------------------------------// - -// define BOOST_SYSTEM_SOURCE so that <boost/system/config.hpp> knows -// the library is being built (possibly exporting rather than importing code) -#define BOOST_SYSTEM_SOURCE - -#include <boost/system/error_code.hpp> - -#ifndef BOOST_ERROR_CODE_HEADER_ONLY -#include <boost/system/detail/error_code.ipp> -#endif |