aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/restricted
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2024-08-17 21:54:09 +0300
committerrobot-contrib <robot-contrib@yandex-team.com>2024-08-17 22:12:23 +0300
commit9a72e397e1a56c74a33f261815d0743e015d5547 (patch)
tree699eb1c948034dd5e808998bdfd6fce15129ba43 /contrib/restricted
parentee9edbd8878888bafcd0eeb3b528f3ec4311560b (diff)
downloadydb-9a72e397e1a56c74a33f261815d0743e015d5547.tar.gz
Update contrib/restricted/boost/lexical_cast to 1.86.0
c3619440b31905731e88ad8f27cb90fb5fd9c91a
Diffstat (limited to 'contrib/restricted')
-rw-r--r--contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_lexical.hpp54
-rw-r--r--contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_lexical_streams.hpp132
-rw-r--r--contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_numeric.hpp156
-rw-r--r--contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/lcast_unsigned_converters.hpp6
-rw-r--r--contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/try_lexical_convert.hpp138
-rw-r--r--contrib/restricted/boost/lexical_cast/ya.make5
6 files changed, 195 insertions, 296 deletions
diff --git a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_lexical.hpp b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_lexical.hpp
index 0347d54e2d..cd9f76f542 100644
--- a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_lexical.hpp
+++ b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_lexical.hpp
@@ -42,6 +42,10 @@
#include <array>
+#ifndef BOOST_NO_CXX17_HDR_STRING_VIEW
+#include <string_view>
+#endif
+
#include <boost/lexical_cast/detail/buffer_view.hpp>
#include <boost/container/container_fwd.hpp>
@@ -55,6 +59,9 @@ namespace boost {
template<class IteratorT>
class iterator_range;
+ // Forward declaration of boost::basic_string_view from Utility
+ template<class Ch, class Tr> class basic_string_view;
+
namespace detail // normalize_single_byte_char<Char>
{
// Converts signed/unsigned char to char
@@ -172,6 +179,19 @@ namespace boost {
> {};
#endif
+#ifndef BOOST_NO_CXX17_HDR_STRING_VIEW
+ template < class Char, class Traits >
+ struct stream_char_common< std::basic_string_view< Char, Traits > >
+ {
+ typedef Char type;
+ };
+#endif
+ template < class Char, class Traits >
+ struct stream_char_common< boost::basic_string_view< Char, Traits > >
+ {
+ typedef Char type;
+ };
+
#ifdef BOOST_HAS_INT128
template <> struct stream_char_common< boost::int128_type >: public boost::type_identity< char > {};
template <> struct stream_char_common< boost::uint128_type >: public boost::type_identity< char > {};
@@ -302,32 +322,6 @@ namespace boost {
};
}
- namespace detail // extract_char_traits template
- {
- // We are attempting to get char_traits<> from T
- // template parameter. Otherwise we'll be using std::char_traits<Char>
- template < class Char, class T >
- struct extract_char_traits
- : boost::false_type
- {
- typedef std::char_traits< Char > trait_t;
- };
-
- template < class Char, class Traits, class Alloc >
- struct extract_char_traits< Char, std::basic_string< Char, Traits, Alloc > >
- : boost::true_type
- {
- typedef Traits trait_t;
- };
-
- template < class Char, class Traits, class Alloc>
- struct extract_char_traits< Char, boost::container::basic_string< Char, Traits, Alloc > >
- : boost::true_type
- {
- typedef Traits trait_t;
- };
- }
-
namespace detail // array_to_pointer_decay<T>
{
template<class T>
@@ -431,11 +425,7 @@ namespace boost {
"Your compiler does not have full support for char32_t" );
#endif
- typedef typename boost::conditional<
- boost::detail::extract_char_traits<char_type, Target>::value,
- typename boost::detail::extract_char_traits<char_type, Target>,
- typename boost::detail::extract_char_traits<char_type, no_cv_src>
- >::type::trait_t traits;
+ typedef std::char_traits<char_type> traits;
typedef boost::detail::lcast_src_length<no_cv_src> len_t;
};
@@ -474,7 +464,7 @@ namespace boost {
return false;
to_target_stream out(src_stream.cbegin(), src_stream.cend());
- if(!(out.stream_out(result)))
+ if (!out.stream_out(result))
return false;
return true;
diff --git a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_lexical_streams.hpp b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_lexical_streams.hpp
index e7cabef760..192051df27 100644
--- a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_lexical_streams.hpp
+++ b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_lexical_streams.hpp
@@ -77,7 +77,6 @@
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/is_reference.hpp>
#include <boost/container/container_fwd.hpp>
-#include <boost/core/noncopyable.hpp>
#include <boost/core/enable_if.hpp>
#ifndef BOOST_NO_CWCHAR
# include <cwchar>
@@ -89,6 +88,9 @@ namespace boost {
class array;
template<class IteratorT>
class iterator_range;
+
+ // forward declaration of boost::basic_string_view from Utility
+ template<class Ch, class Tr> class basic_string_view;
}
namespace boost { namespace detail { namespace lcast {
@@ -105,7 +107,7 @@ namespace boost { namespace detail { namespace lcast {
, class Traits
, std::size_t CharacterBufferSize
>
- class optimized_src_stream: boost::noncopyable {
+ class optimized_src_stream {
CharT buffer[CharacterBufferSize];
// After the `stream_in(` finishes, `[start, finish)` is
@@ -113,6 +115,11 @@ namespace boost { namespace detail { namespace lcast {
const CharT* start;
const CharT* finish;
public:
+ optimized_src_stream(optimized_src_stream&&) = delete;
+ optimized_src_stream(const optimized_src_stream&) = delete;
+ optimized_src_stream& operator=(optimized_src_stream&&) = delete;
+ optimized_src_stream& operator=(const optimized_src_stream&) = delete;
+
optimized_src_stream() noexcept
: start(buffer)
, finish(buffer + CharacterBufferSize)
@@ -191,7 +198,6 @@ namespace boost { namespace detail { namespace lcast {
}
bool shl_real_type(float val, char* begin) {
- using namespace std;
const double val_as_double = val;
finish = start +
boost::core::snprintf(begin, CharacterBufferSize,
@@ -200,7 +206,6 @@ namespace boost { namespace detail { namespace lcast {
}
bool shl_real_type(double val, char* begin) {
- using namespace std;
finish = start +
boost::core::snprintf(begin, CharacterBufferSize,
"%.*g", static_cast<int>(boost::detail::lcast_get_precision<double>()), val);
@@ -209,7 +214,6 @@ namespace boost { namespace detail { namespace lcast {
#ifndef __MINGW32__
bool shl_real_type(long double val, char* begin) {
- using namespace std;
finish = start +
boost::core::snprintf(begin, CharacterBufferSize,
"%.*Lg", static_cast<int>(boost::detail::lcast_get_precision<long double>()), val );
@@ -221,41 +225,55 @@ namespace boost { namespace detail { namespace lcast {
}
#endif
-#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(BOOST_NO_SWPRINTF) && !defined(__MINGW32__)
+#if !defined(BOOST_LCAST_NO_WCHAR_T)
bool shl_real_type(float val, wchar_t* begin) {
- using namespace std;
const double val_as_double = val;
- finish = start + swprintf(begin, CharacterBufferSize,
- L"%.*g",
- static_cast<int>(boost::detail::lcast_get_precision<float >()),
- val_as_double );
+ finish = start + boost::core::swprintf(
+ begin, CharacterBufferSize, L"%.*g",
+ static_cast<int>(boost::detail::lcast_get_precision<float >()),
+ val_as_double
+ );
return finish > start;
}
bool shl_real_type(double val, wchar_t* begin) {
- using namespace std;
- finish = start + swprintf(begin, CharacterBufferSize,
- L"%.*g", static_cast<int>(boost::detail::lcast_get_precision<double >()), val );
+ finish = start + boost::core::swprintf(
+ begin, CharacterBufferSize, L"%.*g",
+ static_cast<int>(boost::detail::lcast_get_precision<double>()),
+ val
+ );
return finish > start;
}
bool shl_real_type(long double val, wchar_t* begin) {
- using namespace std;
- finish = start + swprintf(begin, CharacterBufferSize,
- L"%.*Lg", static_cast<int>(boost::detail::lcast_get_precision<long double >()), val );
+ finish = start + boost::core::swprintf(
+ begin, CharacterBufferSize, L"%.*Lg",
+ static_cast<int>(boost::detail::lcast_get_precision<long double>()),
+ val
+ );
return finish > start;
}
#endif
public:
- template<class Alloc>
- bool stream_in(lcast::exact<std::basic_string<CharT,Traits,Alloc>> x) noexcept {
+ template <class C>
+ using enable_if_compatible_char_t = typename boost::enable_if_c<
+ boost::is_same<const C, const CharT>::value || (
+ boost::is_same<const char, const CharT>::value && (
+ boost::is_same<const C, const unsigned char>::value ||
+ boost::is_same<const C, const signed char>::value
+ )
+ ), bool
+ >::type;
+
+ template<class CharTraits, class Alloc>
+ bool stream_in(lcast::exact<std::basic_string<CharT,CharTraits,Alloc>> x) noexcept {
start = x.payload.data();
finish = start + x.payload.length();
return true;
}
- template<class Alloc>
- bool stream_in(lcast::exact<boost::container::basic_string<CharT,Traits,Alloc>> x) noexcept {
+ template<class CharTraits, class Alloc>
+ bool stream_in(lcast::exact<boost::container::basic_string<CharT,CharTraits,Alloc>> x) noexcept {
start = x.payload.data();
finish = start + x.payload.length();
return true;
@@ -275,19 +293,12 @@ namespace boost { namespace detail { namespace lcast {
}
template <class C>
- typename boost::enable_if_c<boost::detail::is_character<C>::value && sizeof(CharT) == sizeof(C), bool>::type
+ enable_if_compatible_char_t<C>
stream_in(lcast::exact<boost::iterator_range<C*>> x) noexcept {
auto buf = boost::conversion::detail::make_buffer_view(x.payload.begin(), x.payload.end());
return stream_in(lcast::exact<decltype(buf)>{buf});
}
- template <class C>
- typename boost::enable_if_c<boost::detail::is_character<C>::value && sizeof(CharT) == sizeof(C), bool>::type
- stream_in(lcast::exact<boost::iterator_range<const C*>> x) noexcept {
- auto buf = boost::conversion::detail::make_buffer_view(x.payload.begin(), x.payload.end());
- return stream_in(lcast::exact<decltype(buf)>{buf});
- }
-
bool stream_in(lcast::exact<char> x) { return shl_char(x.payload); }
bool stream_in(lcast::exact<unsigned char> x) { return shl_char(static_cast<char>(x.payload)); }
bool stream_in(lcast::exact<signed char> x) { return shl_char(static_cast<char>(x.payload)); }
@@ -297,12 +308,8 @@ namespace boost { namespace detail { namespace lcast {
stream_in(lcast::exact<C> x) { return shl_char(x.payload); }
template <class Type>
- typename boost::enable_if_c<boost::detail::is_character<Type>::value && sizeof(CharT) == sizeof(Type), bool>::type
- stream_in(lcast::exact<const Type*> x) { return shl_char_array(reinterpret_cast<CharT const*>(x.payload)); }
-
- template <class Type>
- typename boost::enable_if_c<boost::detail::is_character<Type>::value && sizeof(CharT) == sizeof(Type), bool>::type
- stream_in(lcast::exact<Type*> x) { return shl_char_array(reinterpret_cast<CharT*>(x.payload)); }
+ enable_if_compatible_char_t<Type>
+ stream_in(lcast::exact<Type*> x) { return shl_char_array(reinterpret_cast<CharT const*>(x.payload)); }
template <class Type>
typename boost::enable_if_c<boost::is_signed<Type>::value && !boost::is_enum<Type>::value, bool>::type
@@ -324,27 +331,32 @@ namespace boost { namespace detail { namespace lcast {
}
template <class C, std::size_t N>
- typename boost::enable_if_c<boost::detail::is_character<C>::value && sizeof(CharT) == sizeof(C), bool>::type
+ enable_if_compatible_char_t<C>
stream_in(lcast::exact<boost::array<C, N>> x) noexcept {
return shl_char_array_limited(reinterpret_cast<const CharT*>(x.payload.data()), N);
}
template <class C, std::size_t N>
- typename boost::enable_if_c<boost::detail::is_character<C>::value && sizeof(CharT) == sizeof(C), bool>::type
- stream_in(lcast::exact<boost::array<const C, N>> x) noexcept {
- return shl_char_array_limited(reinterpret_cast<const CharT*>(x.payload.data()), N);
- }
-
- template <class C, std::size_t N>
- typename boost::enable_if_c<boost::detail::is_character<C>::value && sizeof(CharT) == sizeof(C), bool>::type
+ enable_if_compatible_char_t<C>
stream_in(lcast::exact<std::array<C, N>> x) noexcept {
return shl_char_array_limited(reinterpret_cast<const CharT*>(x.payload.data()), N);
}
- template <class C, std::size_t N>
- typename boost::enable_if_c<boost::detail::is_character<C>::value && sizeof(CharT) == sizeof(C), bool>::type
- stream_in(lcast::exact<std::array<const C, N>> x) noexcept {
- return shl_char_array_limited(reinterpret_cast<const CharT*>(x.payload.data()), N);
+#ifndef BOOST_NO_CXX17_HDR_STRING_VIEW
+ template <class C, class CharTraits>
+ enable_if_compatible_char_t<C>
+ stream_in(lcast::exact<std::basic_string_view<C, CharTraits>> x) noexcept {
+ start = reinterpret_cast<const CharT*>(x.payload.data());
+ finish = start + x.payload.size();
+ return true;
+ }
+#endif
+ template <class C, class CharTraits>
+ enable_if_compatible_char_t<C>
+ stream_in(lcast::exact<boost::basic_string_view<C, CharTraits>> x) noexcept {
+ start = reinterpret_cast<const CharT*>(x.payload.data());
+ finish = start + x.payload.size();
+ return true;
}
};
@@ -360,6 +372,11 @@ namespace boost { namespace detail { namespace lcast {
const CharT* start = nullptr;
const CharT* finish = nullptr;
public:
+ ios_src_stream(ios_src_stream&&) = delete;
+ ios_src_stream(const ios_src_stream&) = delete;
+ ios_src_stream& operator=(ios_src_stream&&) = delete;
+ ios_src_stream& operator=(const ios_src_stream&) = delete;
+
ios_src_stream(): out_buffer(), out_stream(&out_buffer) {}
const CharT* cbegin() const noexcept {
@@ -460,12 +477,17 @@ namespace boost { namespace detail { namespace lcast {
template <class CharT, class Traits>
- class to_target_stream: boost::noncopyable {
+ class to_target_stream {
//`[start, finish)` is the range to output by `operator >>`
const CharT* start;
const CharT* const finish;
public:
+ to_target_stream(to_target_stream&&) = delete;
+ to_target_stream(const to_target_stream&) = delete;
+ to_target_stream& operator=(to_target_stream&&) = delete;
+ to_target_stream& operator=(const to_target_stream&) = delete;
+
to_target_stream(const CharT* begin, const CharT* end) noexcept
: start(begin)
, finish(end)
@@ -473,6 +495,9 @@ namespace boost { namespace detail { namespace lcast {
private:
template <typename Type>
+#if defined(__clang__) && (__clang_major__ > 3 || __clang_minor__ > 6)
+ __attribute__((no_sanitize("unsigned-integer-overflow")))
+#endif
bool shr_unsigned(Type& output) {
if (start == finish) return false;
CharT const minus = lcast_char_constants<CharT>::minus;
@@ -494,6 +519,9 @@ namespace boost { namespace detail { namespace lcast {
}
template <typename Type>
+#if defined(__clang__) && (__clang_major__ > 3 || __clang_minor__ > 6)
+ __attribute__((no_sanitize("unsigned-integer-overflow")))
+#endif
bool shr_signed(Type& output) {
if (start == finish) return false;
CharT const minus = lcast_char_constants<CharT>::minus;
@@ -625,13 +653,13 @@ namespace boost { namespace detail { namespace lcast {
#if !defined(BOOST_NO_CXX11_CHAR32_T) && !defined(BOOST_NO_CXX11_UNICODE_LITERALS)
bool stream_out(char32_t& output) { return shr_xchar(output); }
#endif
- template<class Alloc>
- bool stream_out(std::basic_string<CharT,Traits,Alloc>& str) {
+ template<class CharTraits, class Alloc>
+ bool stream_out(std::basic_string<CharT,CharTraits,Alloc>& str) {
str.assign(start, finish); return true;
}
- template<class Alloc>
- bool stream_out(boost::container::basic_string<CharT,Traits,Alloc>& str) {
+ template<class CharTraits, class Alloc>
+ bool stream_out(boost::container::basic_string<CharT,CharTraits,Alloc>& str) {
str.assign(start, finish); return true;
}
diff --git a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_numeric.hpp b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_numeric.hpp
index 95b0334a9f..167473b363 100644
--- a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_numeric.hpp
+++ b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_numeric.hpp
@@ -23,101 +23,107 @@
# pragma once
#endif
+#include <boost/core/cmath.hpp>
+#include <boost/core/enable_if.hpp>
#include <boost/limits.hpp>
#include <boost/type_traits/type_identity.hpp>
#include <boost/type_traits/conditional.hpp>
#include <boost/type_traits/make_unsigned.hpp>
#include <boost/type_traits/is_signed.hpp>
-#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/is_arithmetic.hpp>
-#include <boost/type_traits/is_base_of.hpp>
#include <boost/type_traits/is_float.hpp>
-#include <boost/type_traits/remove_volatile.hpp>
-
-#include <boost/numeric/conversion/cast.hpp>
namespace boost { namespace detail {
-template <class Source >
-struct detect_precision_loss
-{
- typedef Source source_type;
- typedef boost::numeric::Trunc<Source> Rounder;
- typedef typename conditional<
- boost::is_arithmetic<Source>::value, Source, Source const&
- >::type argument_type ;
-
- static inline source_type nearbyint(argument_type s, bool& is_ok) noexcept {
- const source_type near_int = Rounder::nearbyint(s);
- if (near_int && is_ok) {
- const source_type orig_div_round = s / near_int;
- const source_type eps = std::numeric_limits<source_type>::epsilon();
-
- is_ok = !((orig_div_round > 1 ? orig_div_round - 1 : 1 - orig_div_round) > eps);
- }
+template <class Source, class Target>
+bool ios_numeric_comparer_float(Source x, Source y) noexcept {
+ return x == y
+ || (boost::core::isnan(x) && boost::core::isnan(y))
+ || (x < (std::numeric_limits<Target>::min)())
+ ;
+}
+
+template <class RangeType, class T>
+constexpr bool is_out_of_range_for(T value) noexcept {
+ return value > static_cast<T>((std::numeric_limits<RangeType>::max)())
+ || value < static_cast<T>((std::numeric_limits<RangeType>::min)());
+}
+
- return s;
+// integral -> integral
+template <typename Target, typename Source>
+typename boost::enable_if_c<
+ !boost::is_floating_point<Source>::value && !boost::is_floating_point<Target>::value, bool
+>::type noexcept_numeric_convert(Source arg, Target& result) noexcept {
+ const Target target_tmp = static_cast<Target>(arg);
+ const Source arg_restored = static_cast<Source>(target_tmp);
+ if (arg == arg_restored) {
+ result = target_tmp;
+ return true;
}
+ return false;
+}
- typedef typename Rounder::round_style round_style;
-};
+// integral -> floating point
+template <typename Target, typename Source>
+typename boost::enable_if_c<
+ !boost::is_floating_point<Source>::value && boost::is_floating_point<Target>::value, bool
+>::type noexcept_numeric_convert(Source arg, Target& result) noexcept {
+ const Target target_tmp = static_cast<Target>(arg);
+ result = target_tmp;
+ return true;
+}
-template <typename Base, class Source>
-struct fake_precision_loss: public Base
-{
- typedef Source source_type ;
- typedef typename conditional<
- boost::is_arithmetic<Source>::value, Source, Source const&
- >::type argument_type ;
- static inline source_type nearbyint(argument_type s, bool& /*is_ok*/) noexcept {
- return s;
+// floating point -> floating point
+template <typename Target, typename Source>
+typename boost::enable_if_c<
+ boost::is_floating_point<Source>::value && boost::is_floating_point<Target>::value, bool
+>::type noexcept_numeric_convert(Source arg, Target& result) noexcept {
+ const Target target_tmp = static_cast<Target>(arg);
+ const Source arg_restored = static_cast<Source>(target_tmp);
+ if (detail::ios_numeric_comparer_float<Source, Target>(arg, arg_restored)) {
+ result = target_tmp;
+ return true;
}
-};
-struct nothrow_overflow_handler
-{
- inline bool operator() ( boost::numeric::range_check_result r ) const noexcept {
- return (r == boost::numeric::cInRange);
- }
-};
+ return false;
+}
+// floating point -> integral
template <typename Target, typename Source>
-inline bool noexcept_numeric_convert(const Source& arg, Target& result) noexcept {
- typedef boost::numeric::converter<
- Target,
- Source,
- boost::numeric::conversion_traits<Target, Source >,
- nothrow_overflow_handler,
- detect_precision_loss<Source >
- > converter_orig_t;
-
- typedef typename boost::conditional<
- boost::is_base_of< detect_precision_loss<Source >, converter_orig_t >::value,
- converter_orig_t,
- fake_precision_loss<converter_orig_t, Source>
- >::type converter_t;
-
- bool res = nothrow_overflow_handler()(converter_t::out_of_range(arg));
- if (res) {
- result = converter_t::low_level_convert(converter_t::nearbyint(arg, res));
+typename boost::enable_if_c<
+ boost::is_floating_point<Source>::value && !boost::is_floating_point<Target>::value, bool
+>::type noexcept_numeric_convert(Source arg, Target& result) noexcept {
+ if (detail::is_out_of_range_for<Target>(arg)) {
+ return false;
}
- return res;
+ const Target target_tmp = static_cast<Target>(arg);
+ const Source arg_restored = static_cast<Source>(target_tmp);
+ if (detail::ios_numeric_comparer_float<Source, Target>(arg, arg_restored)) {
+ result = target_tmp;
+ return true;
+ }
+
+ return false;
}
-template <typename Target, typename Source>
struct lexical_cast_dynamic_num_not_ignoring_minus
{
- static inline bool try_convert(const Source &arg, Target& result) noexcept {
- return noexcept_numeric_convert<Target, Source >(arg, result);
+ template <typename Target, typename Source>
+ static inline bool try_convert(Source arg, Target& result) noexcept {
+ return boost::detail::noexcept_numeric_convert<Target, Source >(arg, result);
}
};
-template <typename Target, typename Source>
struct lexical_cast_dynamic_num_ignoring_minus
{
- static inline bool try_convert(const Source &arg, Target& result) noexcept {
+ template <typename Target, typename Source>
+#if defined(__clang__) && (__clang_major__ > 3 || __clang_minor__ > 6)
+ __attribute__((no_sanitize("unsigned-integer-overflow")))
+#endif
+ static inline bool try_convert(Source arg, Target& result) noexcept {
typedef typename boost::conditional<
boost::is_float<Source>::value,
boost::type_identity<Source>,
@@ -126,17 +132,19 @@ struct lexical_cast_dynamic_num_ignoring_minus
typedef typename usource_lazy_t::type usource_t;
if (arg < 0) {
- const bool res = noexcept_numeric_convert<Target, usource_t>(0u - arg, result);
+ const bool res = boost::detail::noexcept_numeric_convert<Target, usource_t>(
+ static_cast<usource_t>(0u - static_cast<usource_t>(arg)), result
+ );
result = static_cast<Target>(0u - result);
return res;
} else {
- return noexcept_numeric_convert<Target, usource_t>(arg, result);
+ return boost::detail::noexcept_numeric_convert<Target, usource_t>(arg, result);
}
}
};
/*
- * lexical_cast_dynamic_num follows the rules:
+ * dynamic_num_converter_impl follows the rules:
* 1) If Source can be converted to Target without precision loss and
* without overflows, then assign Source to Target and return
*
@@ -156,16 +164,14 @@ struct lexical_cast_dynamic_num_ignoring_minus
template <typename Target, typename Source>
struct dynamic_num_converter_impl
{
- typedef typename boost::remove_volatile<Source>::type source_type;
-
- static inline bool try_convert(source_type arg, Target& result) noexcept {
+ static inline bool try_convert(Source arg, Target& result) noexcept {
typedef typename boost::conditional<
boost::is_unsigned<Target>::value &&
- (boost::is_signed<source_type>::value || boost::is_float<source_type>::value) &&
- !(boost::is_same<source_type, bool>::value) &&
+ (boost::is_signed<Source>::value || boost::is_float<Source>::value) &&
+ !(boost::is_same<Source, bool>::value) &&
!(boost::is_same<Target, bool>::value),
- lexical_cast_dynamic_num_ignoring_minus<Target, source_type>,
- lexical_cast_dynamic_num_not_ignoring_minus<Target, source_type>
+ lexical_cast_dynamic_num_ignoring_minus,
+ lexical_cast_dynamic_num_not_ignoring_minus
>::type caster_type;
return caster_type::try_convert(arg, result);
diff --git a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/lcast_unsigned_converters.hpp b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/lcast_unsigned_converters.hpp
index b7ab305773..21656e8466 100644
--- a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/lcast_unsigned_converters.hpp
+++ b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/lcast_unsigned_converters.hpp
@@ -56,6 +56,9 @@ namespace boost
namespace detail // lcast_to_unsigned
{
template<class T>
+#if defined(__clang__) && (__clang_major__ > 3 || __clang_minor__ > 6)
+ __attribute__((no_sanitize("unsigned-integer-overflow")))
+#endif
inline
typename boost::make_unsigned<T>::type lcast_to_unsigned(const T value) noexcept {
typedef typename boost::make_unsigned<T>::type result_type;
@@ -251,6 +254,9 @@ namespace boost
private:
// Iteration that does not care about grouping/separators and assumes that all
// input characters are digits
+#if defined(__clang__) && (__clang_major__ > 3 || __clang_minor__ > 6)
+ __attribute__((no_sanitize("unsigned-integer-overflow")))
+#endif
inline bool main_convert_iteration() noexcept {
CharT const czero = lcast_char_constants<CharT>::zero;
T const maxv = (std::numeric_limits<T>::max)();
diff --git a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/try_lexical_convert.hpp b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/try_lexical_convert.hpp
index ffc092643b..35cc68703e 100644
--- a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/try_lexical_convert.hpp
+++ b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/try_lexical_convert.hpp
@@ -23,20 +23,7 @@
# pragma once
#endif
-#if defined(__clang__) || (defined(__GNUC__) && \
- !(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) && \
- (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)))
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wuninitialized"
-#pragma GCC diagnostic ignored "-Wsign-conversion"
-#endif
-
-
-#include <string>
-#include <boost/type_traits/is_integral.hpp>
-#include <boost/type_traits/type_identity.hpp>
#include <boost/type_traits/conditional.hpp>
-#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/is_arithmetic.hpp>
#include <boost/lexical_cast/detail/buffer_view.hpp>
@@ -44,33 +31,9 @@
#include <boost/lexical_cast/detail/converter_numeric.hpp>
#include <boost/lexical_cast/detail/converter_lexical.hpp>
-#include <boost/container/container_fwd.hpp>
-
namespace boost {
namespace detail
{
- template<typename T>
- struct is_stdstring
- : boost::false_type
- {};
-
- template<typename CharT, typename Traits, typename Alloc>
- struct is_stdstring< std::basic_string<CharT, Traits, Alloc> >
- : boost::true_type
- {};
-
- // Sun Studio has problem with partial specialization of templates differing only in namespace.
- // We workaround that by making `is_booststring` trait, instead of specializing `is_stdstring` for `boost::container::basic_string`.
- template<typename T>
- struct is_booststring
- : boost::false_type
- {};
-
- template<typename CharT, typename Traits, typename Alloc>
- struct is_booststring< boost::container::basic_string<CharT, Traits, Alloc> >
- : boost::true_type
- {};
-
template<typename Target, typename Source>
using is_arithmetic_and_not_xchars = boost::integral_constant<
bool,
@@ -79,70 +42,6 @@ namespace boost {
boost::is_arithmetic<Source>::value &&
boost::is_arithmetic<Target>::value
>;
-
- /*
- * is_xchar_to_xchar<Target, Source>::value is true,
- * Target and Souce are char types of the same size 1 (char, signed char, unsigned char).
- */
- template<typename Target, typename Source>
- using is_xchar_to_xchar = boost::integral_constant<
- bool,
- sizeof(Source) == sizeof(Target) &&
- sizeof(Source) == sizeof(char) &&
- boost::detail::is_character<Target>::value &&
- boost::detail::is_character<Source>::value
- >;
-
- template<typename Target, typename Source>
- struct is_char_array_to_stdstring
- : boost::false_type
- {};
-
- template<typename CharT, typename Traits, typename Alloc>
- struct is_char_array_to_stdstring< std::basic_string<CharT, Traits, Alloc>, CharT* >
- : boost::true_type
- {};
-
- template<typename CharT, typename Traits, typename Alloc>
- struct is_char_array_to_stdstring< std::basic_string<CharT, Traits, Alloc>, const CharT* >
- : boost::true_type
- {};
-
- // Sun Studio has problem with partial specialization of templates differing only in namespace.
- // We workaround that by making `is_char_array_to_booststring` trait, instead of specializing `is_char_array_to_stdstring` for `boost::container::basic_string`.
- template<typename Target, typename Source>
- struct is_char_array_to_booststring
- : boost::false_type
- {};
-
- template<typename CharT, typename Traits, typename Alloc>
- struct is_char_array_to_booststring< boost::container::basic_string<CharT, Traits, Alloc>, CharT* >
- : boost::true_type
- {};
-
- template<typename CharT, typename Traits, typename Alloc>
- struct is_char_array_to_booststring< boost::container::basic_string<CharT, Traits, Alloc>, const CharT* >
- : boost::true_type
- {};
-
- template <typename Target, typename Source>
- struct copy_converter_impl
- {
-// MSVC fail to forward an array (DevDiv#555157 "SILENT BAD CODEGEN triggered by perfect forwarding",
-// fixed in 2013 RTM).
-#if !defined(BOOST_MSVC) || BOOST_MSVC >= 1800
- template <class T>
- static inline bool try_convert(T&& arg, Target& result) {
- result = static_cast<T&&>(arg); // eqaul to `result = std::forward<T>(arg);`
- return true;
- }
-#else
- static inline bool try_convert(const Source& arg, Target& result) {
- result = arg;
- return true;
- }
-#endif
- };
}
namespace conversion { namespace detail {
@@ -156,37 +55,14 @@ namespace boost {
typedef typename boost::detail::array_to_pointer_decay<Source>::type src;
- typedef boost::integral_constant<
- bool,
- boost::detail::is_xchar_to_xchar<Target, src >::value ||
- boost::detail::is_char_array_to_stdstring<Target, src >::value ||
- boost::detail::is_char_array_to_booststring<Target, src >::value ||
- (
- boost::is_same<Target, src >::value &&
- (boost::detail::is_stdstring<Target >::value || boost::detail::is_booststring<Target >::value)
- ) ||
- (
- boost::is_same<Target, src >::value &&
- boost::detail::is_character<Target >::value
- )
- > shall_we_copy_t;
-
typedef boost::detail::is_arithmetic_and_not_xchars<Target, src >
shall_we_copy_with_dynamic_check_t;
- // We do evaluate second `if_` lazily to avoid unnecessary instantiations
- // of `shall_we_copy_with_dynamic_check_t` and improve compilation times.
typedef typename boost::conditional<
- shall_we_copy_t::value,
- boost::type_identity<boost::detail::copy_converter_impl<Target, src > >,
- boost::conditional<
- shall_we_copy_with_dynamic_check_t::value,
- boost::detail::dynamic_num_converter_impl<Target, src >,
- boost::detail::lexical_converter_impl<Target, src >
- >
- >::type caster_type_lazy;
-
- typedef typename caster_type_lazy::type caster_type;
+ shall_we_copy_with_dynamic_check_t::value,
+ boost::detail::dynamic_num_converter_impl<Target, src >,
+ boost::detail::lexical_converter_impl<Target, src >
+ >::type caster_type;
return caster_type::try_convert(arg, result);
}
@@ -213,11 +89,5 @@ namespace boost {
} // namespace boost
-#if defined(__clang__) || (defined(__GNUC__) && \
- !(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) && \
- (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)))
-#pragma GCC diagnostic pop
-#endif
-
#endif // BOOST_LEXICAL_CAST_TRY_LEXICAL_CONVERT_HPP
diff --git a/contrib/restricted/boost/lexical_cast/ya.make b/contrib/restricted/boost/lexical_cast/ya.make
index 4d4ce8f067..4524b542d8 100644
--- a/contrib/restricted/boost/lexical_cast/ya.make
+++ b/contrib/restricted/boost/lexical_cast/ya.make
@@ -6,16 +6,15 @@ LICENSE(BSL-1.0)
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-VERSION(2024-01-24)
+VERSION(1.86.0)
-ORIGINAL_SOURCE(https://github.com/boostorg/lexical_cast/archive/f0862bb60ddd56c3e5b4e413605c4e2528540ed6.tar.gz)
+ORIGINAL_SOURCE(https://github.com/boostorg/lexical_cast/archive/boost-1.86.0.tar.gz)
PEERDIR(
contrib/restricted/boost/config
contrib/restricted/boost/container
contrib/restricted/boost/core
contrib/restricted/boost/integer
- contrib/restricted/boost/numeric_conversion
contrib/restricted/boost/throw_exception
contrib/restricted/boost/type_traits
)