diff options
author | robot-contrib <robot-contrib@yandex-team.com> | 2023-08-15 13:46:11 +0300 |
---|---|---|
committer | robot-contrib <robot-contrib@yandex-team.com> | 2023-08-15 15:52:52 +0300 |
commit | 7fa11d68e1ce457f7336212b40f087a95cc43eab (patch) | |
tree | 28f3b55f5d19939b519e218a893a69c4e25ab492 /contrib | |
parent | a45a8362ded3284c0a986297bb1f3b54eadc7f7a (diff) | |
download | ydb-7fa11d68e1ce457f7336212b40f087a95cc43eab.tar.gz |
Update contrib/restricted/boost/smart_ptr to 1.83.0
Diffstat (limited to 'contrib')
10 files changed, 166 insertions, 113 deletions
diff --git a/contrib/restricted/boost/core/include/boost/core/detail/sp_thread_pause.hpp b/contrib/restricted/boost/core/include/boost/core/detail/sp_thread_pause.hpp new file mode 100644 index 0000000000..01be1a0638 --- /dev/null +++ b/contrib/restricted/boost/core/include/boost/core/detail/sp_thread_pause.hpp @@ -0,0 +1,71 @@ +#ifndef BOOST_CORE_DETAIL_SP_THREAD_PAUSE_HPP_INCLUDED +#define BOOST_CORE_DETAIL_SP_THREAD_PAUSE_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// boost/core/detail/sp_thread_pause.hpp +// +// inline void bost::core::sp_thread_pause(); +// +// Emits a "pause" instruction. +// +// Copyright 2008, 2020, 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(__has_builtin) +# if __has_builtin(__builtin_ia32_pause) && !defined(_INTEL_COMPILER) +# define BOOST_CORE_HAS_BUILTIN_IA32_PAUSE +# endif +#endif + +#if defined(BOOST_CORE_HAS_BUILTIN_IA32_PAUSE) + +# define BOOST_CORE_SP_PAUSE() __builtin_ia32_pause() + +#elif defined(_MSC_VER) && ( defined(_M_IX86) || defined(_M_X64) ) + +# include <intrin.h> +# define BOOST_CORE_SP_PAUSE() _mm_pause() + +#elif defined(_MSC_VER) && ( defined(_M_ARM) || defined(_M_ARM64) ) + +# include <intrin.h> +# define BOOST_CORE_SP_PAUSE() __yield() + +#elif defined(__GNUC__) && ( defined(__i386__) || defined(__x86_64__) ) + +# define BOOST_CORE_SP_PAUSE() __asm__ __volatile__( "rep; nop" : : : "memory" ) + +#elif defined(__GNUC__) && ( (defined(__ARM_ARCH) && __ARM_ARCH >= 8) || defined(__ARM_ARCH_8A__) || defined(__aarch64__) ) + +# define BOOST_CORE_SP_PAUSE() __asm__ __volatile__( "yield" : : : "memory" ) + +#else + +# define BOOST_CORE_SP_PAUSE() ((void)0) + +#endif + +namespace boost +{ +namespace core +{ + +BOOST_FORCEINLINE void sp_thread_pause() BOOST_NOEXCEPT +{ + BOOST_CORE_SP_PAUSE(); +} + +} // namespace core +} // namespace boost + +#undef BOOST_CORE_SP_PAUSE + +#endif // #ifndef BOOST_CORE_DETAIL_SP_THREAD_PAUSE_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_thread_sleep.hpp b/contrib/restricted/boost/core/include/boost/core/detail/sp_thread_sleep.hpp index ff1d168808..f461c3fd1e 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_thread_sleep.hpp +++ b/contrib/restricted/boost/core/include/boost/core/detail/sp_thread_sleep.hpp @@ -1,5 +1,5 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_THREAD_SLEEP_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_THREAD_SLEEP_HPP_INCLUDED +#ifndef BOOST_CORE_DETAIL_SP_THREAD_SLEEP_HPP_INCLUDED +#define BOOST_CORE_DETAIL_SP_THREAD_SLEEP_HPP_INCLUDED // MS compatible compilers support #pragma once @@ -7,41 +7,45 @@ # pragma once #endif -// boost/smart_ptr/detail/sp_thread_sleep.hpp +// boost/core/detail/sp_thread_sleep.hpp // -// inline void bost::detail::sp_thread_sleep(); +// inline void bost::core::sp_thread_sleep(); // // Cease execution for a while to yield to other threads, // as if by calling nanosleep() with an appropriate interval. // -// Copyright 2008, 2020 Peter Dimov +// Copyright 2008, 2020, 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( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ ) +#if defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ ) #if defined(BOOST_SP_REPORT_IMPLEMENTATION) BOOST_PRAGMA_MESSAGE("Using Sleep(1) in sp_thread_sleep") #endif -#include <boost/smart_ptr/detail/sp_win32_sleep.hpp> +#include <boost/core/detail/sp_win32_sleep.hpp> namespace boost { - +namespace core +{ namespace detail { -inline void sp_thread_sleep() +inline void sp_thread_sleep() BOOST_NOEXCEPT { Sleep( 1 ); } } // namespace detail +using boost::core::detail::sp_thread_sleep; + +} // namespace core } // namespace boost #elif defined(BOOST_HAS_NANOSLEEP) @@ -52,14 +56,24 @@ inline void sp_thread_sleep() #include <time.h> +#if defined(BOOST_HAS_PTHREADS) && !defined(__ANDROID__) +# include <pthread.h> +#endif + namespace boost { - -namespace detail +namespace core { -inline void sp_thread_sleep() +inline void sp_thread_sleep() BOOST_NOEXCEPT { +#if defined(BOOST_HAS_PTHREADS) && !defined(__ANDROID__) + + int oldst; + pthread_setcancelstate( PTHREAD_CANCEL_DISABLE, &oldst ); + +#endif + // g++ -Wextra warns on {} or {0} struct timespec rqtp = { 0, 0 }; @@ -70,10 +84,16 @@ inline void sp_thread_sleep() rqtp.tv_nsec = 1000; nanosleep( &rqtp, 0 ); -} -} // namespace detail +#if defined(BOOST_HAS_PTHREADS) && !defined(__ANDROID__) + + pthread_setcancelstate( oldst, &oldst ); +#endif + +} + +} // namespace core } // namespace boost #else @@ -82,23 +102,21 @@ inline void sp_thread_sleep() BOOST_PRAGMA_MESSAGE("Using sp_thread_yield() in sp_thread_sleep") #endif -#include <boost/smart_ptr/detail/sp_thread_yield.hpp> +#include <boost/core/detail/sp_thread_yield.hpp> namespace boost { - -namespace detail +namespace core { -inline void sp_thread_sleep() +inline void sp_thread_sleep() BOOST_NOEXCEPT { sp_thread_yield(); } -} // namespace detail - +} // namespace core } // namespace boost #endif -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_THREAD_SLEEP_HPP_INCLUDED +#endif // #ifndef BOOST_CORE_DETAIL_SP_THREAD_SLEEP_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_thread_yield.hpp b/contrib/restricted/boost/core/include/boost/core/detail/sp_thread_yield.hpp index 9a221cc274..25127e8a0b 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_thread_yield.hpp +++ b/contrib/restricted/boost/core/include/boost/core/detail/sp_thread_yield.hpp @@ -1,5 +1,5 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_THREAD_YIELD_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_THREAD_YIELD_HPP_INCLUDED +#ifndef BOOST_CORE_DETAIL_SP_THREAD_YIELD_HPP_INCLUDED +#define BOOST_CORE_DETAIL_SP_THREAD_YIELD_HPP_INCLUDED // MS compatible compilers support #pragma once @@ -7,9 +7,9 @@ # pragma once #endif -// boost/smart_ptr/detail/sp_thread_yield.hpp +// boost/core/detail/sp_thread_yield.hpp // -// inline void bost::detail::sp_thread_yield(); +// inline void bost::core::sp_thread_yield(); // // Gives up the remainder of the time slice, // as if by calling sched_yield(). @@ -21,27 +21,31 @@ #include <boost/config.hpp> #include <boost/config/pragma_message.hpp> -#if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ ) +#if defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ ) #if defined(BOOST_SP_REPORT_IMPLEMENTATION) - BOOST_PRAGMA_MESSAGE("Using Sleep(0) in sp_thread_yield") + BOOST_PRAGMA_MESSAGE("Using SwitchToThread() in sp_thread_yield") #endif -#include <boost/smart_ptr/detail/sp_win32_sleep.hpp> +#include <boost/core/detail/sp_win32_sleep.hpp> namespace boost { - +namespace core +{ namespace detail { -inline void sp_thread_yield() +inline void sp_thread_yield() BOOST_NOEXCEPT { - Sleep( 0 ); + SwitchToThread(); } } // namespace detail +using boost::core::detail::sp_thread_yield; + +} // namespace core } // namespace boost #elif defined(BOOST_HAS_SCHED_YIELD) @@ -59,17 +63,15 @@ inline void sp_thread_yield() namespace boost { - -namespace detail +namespace core { -inline void sp_thread_yield() +inline void sp_thread_yield() BOOST_NOEXCEPT { sched_yield(); } -} // namespace detail - +} // namespace core } // namespace boost #else @@ -78,23 +80,21 @@ inline void sp_thread_yield() BOOST_PRAGMA_MESSAGE("Using sp_thread_pause() in sp_thread_yield") #endif -#include <boost/smart_ptr/detail/sp_thread_pause.hpp> +#include <boost/core/detail/sp_thread_pause.hpp> namespace boost { - -namespace detail +namespace core { -inline void sp_thread_yield() +inline void sp_thread_yield() BOOST_NOEXCEPT { sp_thread_pause(); } -} // namespace detail - +} // namespace core } // namespace boost #endif -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_THREAD_YIELD_HPP_INCLUDED +#endif // #ifndef BOOST_CORE_DETAIL_SP_THREAD_YIELD_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_win32_sleep.hpp b/contrib/restricted/boost/core/include/boost/core/detail/sp_win32_sleep.hpp index 139a569fb7..adec53e4a5 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_win32_sleep.hpp +++ b/contrib/restricted/boost/core/include/boost/core/detail/sp_win32_sleep.hpp @@ -1,5 +1,5 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_WIN32_SLEEP_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_WIN32_SLEEP_HPP_INCLUDED +#ifndef BOOST_CORE_DETAIL_SP_WIN32_SLEEP_HPP_INCLUDED +#define BOOST_CORE_DETAIL_SP_WIN32_SLEEP_HPP_INCLUDED // MS compatible compilers support #pragma once @@ -7,7 +7,7 @@ # pragma once #endif -// boost/smart_ptr/detail/sp_win32_sleep.hpp +// boost/core/detail/sp_win32_sleep.hpp // // Declares the Win32 Sleep() function. // @@ -21,6 +21,8 @@ namespace boost { +namespace core +{ namespace detail { @@ -28,22 +30,25 @@ namespace detail #if defined(__clang__) && defined(__x86_64__) // clang x64 warns that __stdcall is ignored -# define BOOST_SP_STDCALL +# define BOOST_CORE_SP_STDCALL #else -# define BOOST_SP_STDCALL __stdcall +# define BOOST_CORE_SP_STDCALL __stdcall #endif #if defined(__LP64__) // Cygwin 64 - extern "C" __declspec(dllimport) void BOOST_SP_STDCALL Sleep( unsigned int ms ); + extern "C" __declspec(dllimport) void BOOST_CORE_SP_STDCALL Sleep( unsigned int ms ); #else - extern "C" __declspec(dllimport) void BOOST_SP_STDCALL Sleep( unsigned long ms ); + extern "C" __declspec(dllimport) void BOOST_CORE_SP_STDCALL Sleep( unsigned long ms ); #endif -#undef BOOST_SP_STDCALL +extern "C" __declspec(dllimport) int BOOST_CORE_SP_STDCALL SwitchToThread(); + +#undef BOOST_CORE_SP_STDCALL #endif // !defined( BOOST_USE_WINDOWS_H ) } // namespace detail +} // namespace core } // namespace boost -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_WIN32_SLEEP_HPP_INCLUDED +#endif // #ifndef BOOST_CORE_DETAIL_SP_WIN32_SLEEP_HPP_INCLUDED diff --git a/contrib/restricted/boost/core/include/boost/core/yield_primitives.hpp b/contrib/restricted/boost/core/include/boost/core/yield_primitives.hpp new file mode 100644 index 0000000000..899453e5a7 --- /dev/null +++ b/contrib/restricted/boost/core/include/boost/core/yield_primitives.hpp @@ -0,0 +1,12 @@ +#ifndef BOOST_CORE_YIELD_PRIMITIVES_HPP_INCLUDED +#define BOOST_CORE_YIELD_PRIMITIVES_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/core/detail/sp_thread_pause.hpp> +#include <boost/core/detail/sp_thread_yield.hpp> +#include <boost/core/detail/sp_thread_sleep.hpp> + +#endif // #ifndef BOOST_CORE_YIELD_PRIMITIVES_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/requires_cxx11.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/requires_cxx11.hpp index fb4d61ceeb..732cc40394 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/requires_cxx11.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/requires_cxx11.hpp @@ -16,7 +16,7 @@ defined(BOOST_NO_CXX11_NULLPTR) || \ defined(BOOST_NO_CXX11_SMART_PTR) -BOOST_PRAGMA_MESSAGE("C++03 support is deprecated in Boost.SmartPtr 1.82 and will be removed in Boost.SmartPtr 1.84.") +BOOST_PRAGMA_MESSAGE("C++03 support was deprecated in Boost.SmartPtr 1.82 and will be removed in Boost.SmartPtr 1.84. Please open an issue in https://github.com/boostorg/smart_ptr if you want it retained.") #endif diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_atomic.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_atomic.hpp index 99ded0d4f2..57de800661 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_atomic.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_atomic.hpp @@ -137,7 +137,7 @@ public: long use_count() const // nothrow { - return atomic_load( &use_count_ ); + return static_cast<long>( atomic_load( &use_count_ ) ); } }; diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_thread_pause.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_thread_pause.hpp deleted file mode 100644 index 2cddd90b01..0000000000 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_thread_pause.hpp +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_THREAD_PAUSE_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_THREAD_PAUSE_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// boost/smart_ptr/detail/sp_thread_pause.hpp -// -// inline void bost::detail::sp_thread_pause(); -// -// Emits a "pause" instruction. -// -// Copyright 2008, 2020 Peter Dimov -// Distributed under the Boost Software License, Version 1.0 -// https://www.boost.org/LICENSE_1_0.txt - -#if defined(_MSC_VER) && _MSC_VER >= 1310 && ( defined(_M_IX86) || defined(_M_X64) ) && !defined(__c2__) - -extern "C" void _mm_pause(); - -#define BOOST_SP_PAUSE _mm_pause(); - -#elif defined(__GNUC__) && ( defined(__i386__) || defined(__x86_64__) ) - -#define BOOST_SP_PAUSE __asm__ __volatile__( "rep; nop" : : : "memory" ); - -#else - -#define BOOST_SP_PAUSE - -#endif - -namespace boost -{ -namespace detail -{ - -inline void sp_thread_pause() -{ - BOOST_SP_PAUSE -} - -} // namespace detail -} // namespace boost - -#undef BOOST_SP_PAUSE - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_THREAD_PAUSE_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/yield_k.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/yield_k.hpp index d9a1b46ab6..7f6c645919 100644 --- a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/yield_k.hpp +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/yield_k.hpp @@ -19,9 +19,7 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include <boost/smart_ptr/detail/sp_thread_pause.hpp> -#include <boost/smart_ptr/detail/sp_thread_sleep.hpp> -#include <boost/config.hpp> +#include <boost/core/yield_primitives.hpp> namespace boost { @@ -34,13 +32,13 @@ inline void yield( unsigned k ) // Experiments on Windows and Fedora 32 show that a single pause, // followed by an immediate sp_thread_sleep(), is best. - if( k == 0 ) + if( k & 1 ) { - sp_thread_pause(); + boost::core::sp_thread_sleep(); } else { - sp_thread_sleep(); + boost::core::sp_thread_pause(); } } diff --git a/contrib/restricted/boost/smart_ptr/ya.make b/contrib/restricted/boost/smart_ptr/ya.make index 4b0fe82e32..497a94c040 100644 --- a/contrib/restricted/boost/smart_ptr/ya.make +++ b/contrib/restricted/boost/smart_ptr/ya.make @@ -6,9 +6,9 @@ LICENSE(BSL-1.0) LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -VERSION(1.82.0) +VERSION(1.83.0) -ORIGINAL_SOURCE(https://github.com/boostorg/smart_ptr/archive/boost-1.82.0.tar.gz) +ORIGINAL_SOURCE(https://github.com/boostorg/smart_ptr/archive/boost-1.83.0.tar.gz) PEERDIR( contrib/restricted/boost/assert |