diff options
author | thegeorg <thegeorg@yandex-team.com> | 2023-05-10 11:45:27 +0300 |
---|---|---|
committer | thegeorg <thegeorg@yandex-team.com> | 2023-05-10 11:45:27 +0300 |
commit | 1749dfa5623d0dc631585a665b8f32dfd32354af (patch) | |
tree | 50e691aa158837dd63d65493eed9dd8fc3635dd9 | |
parent | 832415b6bf33a23a003195441f74d66164038084 (diff) | |
download | ydb-1749dfa5623d0dc631585a665b8f32dfd32354af.tar.gz |
Update contrib/restricted/boost/system to 1.82.0
8 files changed, 189 insertions, 40 deletions
diff --git a/contrib/restricted/boost/system/include/boost/system/detail/config.hpp b/contrib/restricted/boost/system/include/boost/system/detail/config.hpp index 2dbb2f99ba..1231291414 100644 --- a/contrib/restricted/boost/system/include/boost/system/detail/config.hpp +++ b/contrib/restricted/boost/system/include/boost/system/detail/config.hpp @@ -8,6 +8,7 @@ // // See http://www.boost.org/libs/system for documentation. +#include <boost/system/detail/requires_cxx11.hpp> #include <boost/config.hpp> #include <boost/config/workaround.hpp> @@ -64,7 +65,9 @@ // BOOST_SYSTEM_CLANG_6 -#if defined(__clang__) && (__clang_major__ < 7 || (defined(__APPLE__) && __clang_major__ < 11)) +// Android NDK r18b has Clang 7.0.2 that still needs the workaround +// https://github.com/boostorg/system/issues/100 +#if defined(__clang__) && (__clang_major__ < 7 || (defined(__APPLE__) && __clang_major__ < 11) || (defined(__ANDROID__) && __clang_major__ == 7)) # define BOOST_SYSTEM_CLANG_6 #endif 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 index 40b65f431d..acc349435d 100644 --- a/contrib/restricted/boost/system/include/boost/system/detail/error_category.hpp +++ b/contrib/restricted/boost/system/include/boost/system/detail/error_category.hpp @@ -13,6 +13,7 @@ #include <boost/system/detail/config.hpp> #include <boost/cstdint.hpp> #include <boost/config.hpp> +#include <boost/config/workaround.hpp> #include <string> #include <functional> #include <cstddef> @@ -116,11 +117,18 @@ protected: #endif - BOOST_SYSTEM_CONSTEXPR error_category() BOOST_NOEXCEPT: id_( 0 ), stdcat_(), sc_init_() +#if !BOOST_WORKAROUND(BOOST_GCC, < 40800) + BOOST_CONSTEXPR +#endif + error_category() BOOST_NOEXCEPT: id_( 0 ), stdcat_(), sc_init_() { } - explicit BOOST_SYSTEM_CONSTEXPR error_category( boost::ulong_long_type id ) BOOST_NOEXCEPT: id_( id ), stdcat_(), sc_init_() + explicit +#if !BOOST_WORKAROUND(BOOST_GCC, < 40800) + BOOST_CONSTEXPR +#endif + error_category( boost::ulong_long_type id ) BOOST_NOEXCEPT: id_( id ), stdcat_(), sc_init_() { } 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 index 904a3a6cb6..2005397a46 100644 --- 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 @@ -98,33 +98,14 @@ inline char const * error_category::message( int ev, char * buffer, std::size_t #if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) #include <boost/system/detail/std_category_impl.hpp> +#include <boost/system/detail/mutex.hpp> #include <new> -#if !defined(BOOST_SYSTEM_DISABLE_THREADS) -# include <mutex> -#endif - namespace boost { namespace system { -#if !defined(BOOST_SYSTEM_DISABLE_THREADS) - -namespace detail -{ - -template<class = void> struct stdcat_mx_holder -{ - static std::mutex mx_; -}; - -template<class T> std::mutex stdcat_mx_holder<T>::mx_; - -} // namespace detail - -#endif - inline void error_category::init_stdcat() const { static_assert( sizeof( stdcat_ ) >= sizeof( boost::system::detail::std_category ), "sizeof(stdcat_) is not enough for std_category" ); @@ -137,13 +118,17 @@ inline void error_category::init_stdcat() const #endif -#if !defined(BOOST_SYSTEM_DISABLE_THREADS) - std::lock_guard<std::mutex> lk( boost::system::detail::stdcat_mx_holder<>::mx_ ); -#endif + // detail::mutex has a constexpr default constructor, + // and therefore guarantees static initialization, on + // everything except VS 2013 (msvc-12.0) + + static system::detail::mutex mx_; + + system::detail::lock_guard<system::detail::mutex> lk( mx_ ); if( sc_init_.load( std::memory_order_acquire ) == 0 ) { - ::new( static_cast<void*>( stdcat_ ) ) boost::system::detail::std_category( this, 0 ); + ::new( static_cast<void*>( stdcat_ ) ) boost::system::detail::std_category( this, system::detail::id_wrapper<0>() ); sc_init_.store( 1, std::memory_order_release ); } } @@ -160,7 +145,7 @@ inline BOOST_NOINLINE error_category::operator std::error_category const & () co // 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 ); + static const boost::system::detail::std_category generic_instance( this, system::detail::id_wrapper<0x1F4D3>() ); return generic_instance; #else @@ -175,7 +160,7 @@ inline BOOST_NOINLINE error_category::operator std::error_category const & () co // 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 ); + static const boost::system::detail::std_category system_instance( this, system::detail::id_wrapper<0x1F4D7>() ); return system_instance; #else 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 index 1189fb4490..2b387fb60a 100644 --- a/contrib/restricted/boost/system/include/boost/system/detail/error_code.hpp +++ b/contrib/restricted/boost/system/include/boost/system/detail/error_code.hpp @@ -403,7 +403,12 @@ public: { #if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) - if( lhs.lc_flags_ == 1 && rhs.lc_flags_ == 1 ) + bool s1 = lhs.lc_flags_ == 1; + bool s2 = rhs.lc_flags_ == 1; + + if( s1 != s2 ) return false; + + if( s1 && s2 ) { 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_ ); @@ -421,7 +426,13 @@ public: { #if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) - if( lhs.lc_flags_ == 1 && rhs.lc_flags_ == 1 ) + bool s1 = lhs.lc_flags_ == 1; + bool s2 = rhs.lc_flags_ == 1; + + if( s1 < s2 ) return true; + if( s2 < s1 ) return false; + + if( s1 && s2 ) { 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_ ); diff --git a/contrib/restricted/boost/system/include/boost/system/detail/mutex.hpp b/contrib/restricted/boost/system/include/boost/system/detail/mutex.hpp new file mode 100644 index 0000000000..4c2b0fa9e6 --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/detail/mutex.hpp @@ -0,0 +1,110 @@ +#ifndef BOOST_SYSTEM_DETAIL_MUTEX_HPP_INCLUDED +#define BOOST_SYSTEM_DETAIL_MUTEX_HPP_INCLUDED + +// Copyright 2023 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt) + +#include <boost/config.hpp> + +#if defined(BOOST_SYSTEM_DISABLE_THREADS) + +namespace boost +{ +namespace system +{ +namespace detail +{ + +struct mutex +{ + void lock() + { + } + + void unlock() + { + } +}; + +} // namespace detail +} // namespace system +} // namespace boost + +#elif defined(BOOST_MSSTL_VERSION) && BOOST_MSSTL_VERSION >= 140 + +// Under the MS STL, std::mutex::mutex() is not constexpr, as is +// required by the standard, which leads to initialization order +// issues. However, shared_mutex is based on SRWLock and its +// default constructor is constexpr, so we use that instead. + +#include <shared_mutex> + +namespace boost +{ +namespace system +{ +namespace detail +{ + +typedef std::shared_mutex mutex; + +} // namespace detail +} // namespace system +} // namespace boost + +#else + +#include <mutex> + +namespace boost +{ +namespace system +{ +namespace detail +{ + +using std::mutex; + +} // namespace detail +} // namespace system +} // namespace boost + +#endif + +namespace boost +{ +namespace system +{ +namespace detail +{ + +template<class Mtx> class lock_guard +{ +private: + + Mtx& mtx_; + +private: + + lock_guard( lock_guard const& ); + lock_guard& operator=( lock_guard const& ); + +public: + + explicit lock_guard( Mtx& mtx ): mtx_( mtx ) + { + mtx_.lock(); + } + + ~lock_guard() + { + mtx_.unlock(); + } +}; + +} // namespace detail +} // namespace system +} // namespace boost + +#endif // #ifndef BOOST_SYSTEM_DETAIL_MUTEX_HPP_INCLUDED diff --git a/contrib/restricted/boost/system/include/boost/system/detail/requires_cxx11.hpp b/contrib/restricted/boost/system/include/boost/system/detail/requires_cxx11.hpp new file mode 100644 index 0000000000..1bf6a1f13f --- /dev/null +++ b/contrib/restricted/boost/system/include/boost/system/detail/requires_cxx11.hpp @@ -0,0 +1,21 @@ +#ifndef BOOST_SYSTEM_DETAIL_REQUIRES_CXX11_HPP_INCLUDED +#define BOOST_SYSTEM_DETAIL_REQUIRES_CXX11_HPP_INCLUDED + +// Copyright 2023 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#include <boost/config.hpp> +#include <boost/config/pragma_message.hpp> + +#if defined(BOOST_NO_CXX11_CONSTEXPR) || \ + defined(BOOST_NO_CXX11_NOEXCEPT) || \ + defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) || \ + defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || \ + defined(BOOST_NO_CXX11_HDR_SYSTEM_ERROR) + +BOOST_PRAGMA_MESSAGE("C++03 support is deprecated in Boost.System 1.82 and will be removed in Boost.System 1.84.") + +#endif + +#endif // #ifndef BOOST_SYSTEM_DETAIL_REQUIRES_CXX11_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 index 63051e49a5..68073c1b92 100644 --- a/contrib/restricted/boost/system/include/boost/system/detail/std_category.hpp +++ b/contrib/restricted/boost/system/include/boost/system/detail/std_category.hpp @@ -11,6 +11,7 @@ // See library home page at http://www.boost.org/libs/system #include <boost/system/detail/error_category.hpp> +#include <boost/config.hpp> #include <system_error> // @@ -24,6 +25,8 @@ namespace system namespace detail { +template<unsigned Id> struct id_wrapper {}; + class BOOST_SYMBOL_VISIBLE std_category: public std::error_category { private: @@ -39,20 +42,22 @@ public: public: - explicit std_category( boost::system::error_category const * pc, unsigned id ): pc_( pc ) + template<unsigned Id> + explicit std_category( boost::system::error_category const * pc, id_wrapper<Id> ): pc_( pc ) { - if( id != 0 ) - { -#if defined(_MSC_VER) && defined(_CPPLIB_VER) && _MSC_VER >= 1900 && _MSC_VER < 2000 && !defined(_LIBCPP_VERSION) +#if defined(_MSC_VER) && defined(_CPPLIB_VER) && _MSC_VER >= 1900 && _MSC_VER < 2000 + + // We used to assign to the protected _Addr member of std::error_category + // here when Id != 0, but this should never happen now because this code + // path is no longer used - // Poking into the protected _Addr member of std::error_category - // is not a particularly good programming practice, but what can - // you do +#if !defined(BOOST_NO_CXX11_STATIC_ASSERT) - _Addr = id; + static_assert( Id == 0, "This constructor should only be called with Id == 0 under MS STL 14.0+" ); + +#endif #endif - } } const char * name() const BOOST_NOEXCEPT BOOST_OVERRIDE 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 index 408c697dc0..446a351942 100644 --- 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 @@ -59,6 +59,7 @@ inline int system_category_condition_win32( int ev ) BOOST_NOEXCEPT 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_NET_NAME_: 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; @@ -75,6 +76,7 @@ inline int system_category_condition_win32( int ev ) BOOST_NOEXCEPT 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_FILENAME_EXCED_RANGE_: return filename_too_long; 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; @@ -100,12 +102,16 @@ inline int system_category_condition_win32( int ev ) BOOST_NOEXCEPT case ERROR_REPARSE_TAG_INVALID_: return invalid_argument; case ERROR_RETRY_: return resource_unavailable_try_again; case ERROR_SEEK_: return io_error; + case ERROR_SEM_TIMEOUT_: return timed_out; case ERROR_SHARING_VIOLATION_: return permission_denied; case ERROR_NOT_SUPPORTED_: return not_supported; // WinError.h: "The request is not supported." + case ERROR_TIMEOUT_: return timed_out; 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 258: return timed_out; // WAIT_TIMEOUT + case WSAEACCES_: return permission_denied; case WSAEADDRINUSE_: return address_in_use; case WSAEADDRNOTAVAIL_: return address_not_available; |