Browse Source

Update contrib/restricted/abseil-cpp-tstring to 20240722.0
83a5727000e16bc5a94523a0cf1cce75fa86a191

thegeorg 7 months ago
parent
commit
de4d7efd88

+ 57 - 18
contrib/restricted/abseil-cpp-tstring/y_absl/algorithm/container.h

@@ -44,6 +44,7 @@
 #include <cassert>
 #include <cassert>
 #include <iterator>
 #include <iterator>
 #include <numeric>
 #include <numeric>
+#include <random>
 #include <type_traits>
 #include <type_traits>
 #include <unordered_map>
 #include <unordered_map>
 #include <unordered_set>
 #include <unordered_set>
@@ -51,6 +52,7 @@
 #include <vector>
 #include <vector>
 
 
 #include "y_absl/algorithm/algorithm.h"
 #include "y_absl/algorithm/algorithm.h"
+#include "y_absl/base/config.h"
 #include "y_absl/base/macros.h"
 #include "y_absl/base/macros.h"
 #include "y_absl/base/nullability.h"
 #include "y_absl/base/nullability.h"
 #include "y_absl/meta/type_traits.h"
 #include "y_absl/meta/type_traits.h"
@@ -92,17 +94,17 @@ using ContainerPointerType =
 //   using std::end;
 //   using std::end;
 //   std::foo(begin(c), end(c));
 //   std::foo(begin(c), end(c));
 // becomes
 // becomes
-//   std::foo(container_algorithm_internal::begin(c),
-//            container_algorithm_internal::end(c));
+//   std::foo(container_algorithm_internal::c_begin(c),
+//            container_algorithm_internal::c_end(c));
 // These are meant for internal use only.
 // These are meant for internal use only.
 
 
 template <typename C>
 template <typename C>
-ContainerIter<C> c_begin(C& c) {
+Y_ABSL_INTERNAL_CONSTEXPR_SINCE_CXX17 ContainerIter<C> c_begin(C& c) {
   return begin(c);
   return begin(c);
 }
 }
 
 
 template <typename C>
 template <typename C>
-ContainerIter<C> c_end(C& c) {
+Y_ABSL_INTERNAL_CONSTEXPR_SINCE_CXX17 ContainerIter<C> c_end(C& c) {
   return end(c);
   return end(c);
 }
 }
 
 
@@ -145,8 +147,9 @@ bool c_linear_search(const C& c, EqualityComparable&& value) {
 // Container-based version of the <iterator> `std::distance()` function to
 // Container-based version of the <iterator> `std::distance()` function to
 // return the number of elements within a container.
 // return the number of elements within a container.
 template <typename C>
 template <typename C>
-container_algorithm_internal::ContainerDifferenceType<const C> c_distance(
-    const C& c) {
+Y_ABSL_INTERNAL_CONSTEXPR_SINCE_CXX17
+    container_algorithm_internal::ContainerDifferenceType<const C>
+    c_distance(const C& c) {
   return std::distance(container_algorithm_internal::c_begin(c),
   return std::distance(container_algorithm_internal::c_begin(c),
                        container_algorithm_internal::c_end(c));
                        container_algorithm_internal::c_end(c));
 }
 }
@@ -210,6 +213,16 @@ container_algorithm_internal::ContainerIter<C> c_find(C& c, T&& value) {
                    std::forward<T>(value));
                    std::forward<T>(value));
 }
 }
 
 
+// c_contains()
+//
+// Container-based version of the <algorithm> `std::ranges::contains()` C++23
+// function to search a container for a value.
+template <typename Sequence, typename T>
+bool c_contains(const Sequence& sequence, T&& value) {
+  return y_absl::c_find(sequence, std::forward<T>(value)) !=
+         container_algorithm_internal::c_end(sequence);
+}
+
 // c_find_if()
 // c_find_if()
 //
 //
 // Container-based version of the <algorithm> `std::find_if()` function to find
 // Container-based version of the <algorithm> `std::find_if()` function to find
@@ -426,6 +439,26 @@ container_algorithm_internal::ContainerIter<Sequence1> c_search(
                      std::forward<BinaryPredicate>(pred));
                      std::forward<BinaryPredicate>(pred));
 }
 }
 
 
+// c_contains_subrange()
+//
+// Container-based version of the <algorithm> `std::ranges::contains_subrange()`
+// C++23 function to search a container for a subsequence.
+template <typename Sequence1, typename Sequence2>
+bool c_contains_subrange(Sequence1& sequence, Sequence2& subsequence) {
+  return y_absl::c_search(sequence, subsequence) !=
+         container_algorithm_internal::c_end(sequence);
+}
+
+// Overload of c_contains_subrange() for using a predicate evaluation other than
+// `==` as the function's test condition.
+template <typename Sequence1, typename Sequence2, typename BinaryPredicate>
+bool c_contains_subrange(Sequence1& sequence, Sequence2& subsequence,
+                         BinaryPredicate&& pred) {
+  return y_absl::c_search(sequence, subsequence,
+                        std::forward<BinaryPredicate>(pred)) !=
+         container_algorithm_internal::c_end(sequence);
+}
+
 // c_search_n()
 // c_search_n()
 //
 //
 // Container-based version of the <algorithm> `std::search_n()` function to
 // Container-based version of the <algorithm> `std::search_n()` function to
@@ -1500,8 +1533,9 @@ c_is_heap_until(RandomAccessContainer& sequence, LessThan&& comp) {
 // to return an iterator pointing to the element with the smallest value, using
 // to return an iterator pointing to the element with the smallest value, using
 // `operator<` to make the comparisons.
 // `operator<` to make the comparisons.
 template <typename Sequence>
 template <typename Sequence>
-container_algorithm_internal::ContainerIter<Sequence> c_min_element(
-    Sequence& sequence) {
+Y_ABSL_INTERNAL_CONSTEXPR_SINCE_CXX17
+    container_algorithm_internal::ContainerIter<Sequence>
+    c_min_element(Sequence& sequence) {
   return std::min_element(container_algorithm_internal::c_begin(sequence),
   return std::min_element(container_algorithm_internal::c_begin(sequence),
                           container_algorithm_internal::c_end(sequence));
                           container_algorithm_internal::c_end(sequence));
 }
 }
@@ -1509,8 +1543,9 @@ container_algorithm_internal::ContainerIter<Sequence> c_min_element(
 // Overload of c_min_element() for performing a `comp` comparison other than
 // Overload of c_min_element() for performing a `comp` comparison other than
 // `operator<`.
 // `operator<`.
 template <typename Sequence, typename LessThan>
 template <typename Sequence, typename LessThan>
-container_algorithm_internal::ContainerIter<Sequence> c_min_element(
-    Sequence& sequence, LessThan&& comp) {
+Y_ABSL_INTERNAL_CONSTEXPR_SINCE_CXX17
+    container_algorithm_internal::ContainerIter<Sequence>
+    c_min_element(Sequence& sequence, LessThan&& comp) {
   return std::min_element(container_algorithm_internal::c_begin(sequence),
   return std::min_element(container_algorithm_internal::c_begin(sequence),
                           container_algorithm_internal::c_end(sequence),
                           container_algorithm_internal::c_end(sequence),
                           std::forward<LessThan>(comp));
                           std::forward<LessThan>(comp));
@@ -1522,8 +1557,9 @@ container_algorithm_internal::ContainerIter<Sequence> c_min_element(
 // to return an iterator pointing to the element with the largest value, using
 // to return an iterator pointing to the element with the largest value, using
 // `operator<` to make the comparisons.
 // `operator<` to make the comparisons.
 template <typename Sequence>
 template <typename Sequence>
-container_algorithm_internal::ContainerIter<Sequence> c_max_element(
-    Sequence& sequence) {
+Y_ABSL_INTERNAL_CONSTEXPR_SINCE_CXX17
+    container_algorithm_internal::ContainerIter<Sequence>
+    c_max_element(Sequence& sequence) {
   return std::max_element(container_algorithm_internal::c_begin(sequence),
   return std::max_element(container_algorithm_internal::c_begin(sequence),
                           container_algorithm_internal::c_end(sequence));
                           container_algorithm_internal::c_end(sequence));
 }
 }
@@ -1531,8 +1567,9 @@ container_algorithm_internal::ContainerIter<Sequence> c_max_element(
 // Overload of c_max_element() for performing a `comp` comparison other than
 // Overload of c_max_element() for performing a `comp` comparison other than
 // `operator<`.
 // `operator<`.
 template <typename Sequence, typename LessThan>
 template <typename Sequence, typename LessThan>
-container_algorithm_internal::ContainerIter<Sequence> c_max_element(
-    Sequence& sequence, LessThan&& comp) {
+Y_ABSL_INTERNAL_CONSTEXPR_SINCE_CXX17
+    container_algorithm_internal::ContainerIter<Sequence>
+    c_max_element(Sequence& sequence, LessThan&& comp) {
   return std::max_element(container_algorithm_internal::c_begin(sequence),
   return std::max_element(container_algorithm_internal::c_begin(sequence),
                           container_algorithm_internal::c_end(sequence),
                           container_algorithm_internal::c_end(sequence),
                           std::forward<LessThan>(comp));
                           std::forward<LessThan>(comp));
@@ -1545,8 +1582,9 @@ container_algorithm_internal::ContainerIter<Sequence> c_max_element(
 // smallest and largest values, respectively, using `operator<` to make the
 // smallest and largest values, respectively, using `operator<` to make the
 // comparisons.
 // comparisons.
 template <typename C>
 template <typename C>
-container_algorithm_internal::ContainerIterPairType<C, C> c_minmax_element(
-    C& c) {
+Y_ABSL_INTERNAL_CONSTEXPR_SINCE_CXX17
+    container_algorithm_internal::ContainerIterPairType<C, C>
+    c_minmax_element(C& c) {
   return std::minmax_element(container_algorithm_internal::c_begin(c),
   return std::minmax_element(container_algorithm_internal::c_begin(c),
                              container_algorithm_internal::c_end(c));
                              container_algorithm_internal::c_end(c));
 }
 }
@@ -1554,8 +1592,9 @@ container_algorithm_internal::ContainerIterPairType<C, C> c_minmax_element(
 // Overload of c_minmax_element() for performing `comp` comparisons other than
 // Overload of c_minmax_element() for performing `comp` comparisons other than
 // `operator<`.
 // `operator<`.
 template <typename C, typename LessThan>
 template <typename C, typename LessThan>
-container_algorithm_internal::ContainerIterPairType<C, C> c_minmax_element(
-    C& c, LessThan&& comp) {
+Y_ABSL_INTERNAL_CONSTEXPR_SINCE_CXX17
+    container_algorithm_internal::ContainerIterPairType<C, C>
+    c_minmax_element(C& c, LessThan&& comp) {
   return std::minmax_element(container_algorithm_internal::c_begin(c),
   return std::minmax_element(container_algorithm_internal::c_begin(c),
                              container_algorithm_internal::c_end(c),
                              container_algorithm_internal::c_end(c),
                              std::forward<LessThan>(comp));
                              std::forward<LessThan>(comp));

+ 2 - 2
contrib/restricted/abseil-cpp-tstring/y_absl/algorithm/ya.make

@@ -6,9 +6,9 @@ LICENSE(Apache-2.0)
 
 
 LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
 LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
 
 
-VERSION(20240116.2)
+VERSION(20240722.0)
 
 
-ORIGINAL_SOURCE(https://github.com/abseil/abseil-cpp/archive/20240116.2.tar.gz)
+ORIGINAL_SOURCE(https://github.com/abseil/abseil-cpp/archive/20240722.0.tar.gz)
 
 
 NO_RUNTIME()
 NO_RUNTIME()
 
 

+ 84 - 0
contrib/restricted/abseil-cpp-tstring/y_absl/base/attributes.h

@@ -195,6 +195,9 @@
 // Y_ABSL_ATTRIBUTE_NORETURN
 // Y_ABSL_ATTRIBUTE_NORETURN
 //
 //
 // Tells the compiler that a given function never returns.
 // Tells the compiler that a given function never returns.
+//
+// Deprecated: Prefer the `[[noreturn]]` attribute standardized by C++11 over
+// this macro.
 #if Y_ABSL_HAVE_ATTRIBUTE(noreturn) || (defined(__GNUC__) && !defined(__clang__))
 #if Y_ABSL_HAVE_ATTRIBUTE(noreturn) || (defined(__GNUC__) && !defined(__clang__))
 #define Y_ABSL_ATTRIBUTE_NORETURN __attribute__((noreturn))
 #define Y_ABSL_ATTRIBUTE_NORETURN __attribute__((noreturn))
 #elif defined(_MSC_VER)
 #elif defined(_MSC_VER)
@@ -702,6 +705,11 @@
   _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
   _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
 #define Y_ABSL_INTERNAL_RESTORE_DEPRECATED_DECLARATION_WARNING \
 #define Y_ABSL_INTERNAL_RESTORE_DEPRECATED_DECLARATION_WARNING \
   _Pragma("GCC diagnostic pop")
   _Pragma("GCC diagnostic pop")
+#elif defined(_MSC_VER)
+#define Y_ABSL_INTERNAL_DISABLE_DEPRECATED_DECLARATION_WARNING \
+  _Pragma("warning(push)") _Pragma("warning(disable: 4996)")
+#define Y_ABSL_INTERNAL_RESTORE_DEPRECATED_DECLARATION_WARNING \
+  _Pragma("warning(pop)")
 #else
 #else
 #define Y_ABSL_INTERNAL_DISABLE_DEPRECATED_DECLARATION_WARNING
 #define Y_ABSL_INTERNAL_DISABLE_DEPRECATED_DECLARATION_WARNING
 #define Y_ABSL_INTERNAL_RESTORE_DEPRECATED_DECLARATION_WARNING
 #define Y_ABSL_INTERNAL_RESTORE_DEPRECATED_DECLARATION_WARNING
@@ -808,14 +816,43 @@
 //
 //
 // See also the upstream documentation:
 // See also the upstream documentation:
 // https://clang.llvm.org/docs/AttributeReference.html#lifetimebound
 // https://clang.llvm.org/docs/AttributeReference.html#lifetimebound
+// https://learn.microsoft.com/en-us/cpp/code-quality/c26816?view=msvc-170
 #if Y_ABSL_HAVE_CPP_ATTRIBUTE(clang::lifetimebound)
 #if Y_ABSL_HAVE_CPP_ATTRIBUTE(clang::lifetimebound)
 #define Y_ABSL_ATTRIBUTE_LIFETIME_BOUND [[clang::lifetimebound]]
 #define Y_ABSL_ATTRIBUTE_LIFETIME_BOUND [[clang::lifetimebound]]
+#elif Y_ABSL_HAVE_CPP_ATTRIBUTE(msvc::lifetimebound)
+#define Y_ABSL_ATTRIBUTE_LIFETIME_BOUND [[msvc::lifetimebound]]
 #elif Y_ABSL_HAVE_ATTRIBUTE(lifetimebound)
 #elif Y_ABSL_HAVE_ATTRIBUTE(lifetimebound)
 #define Y_ABSL_ATTRIBUTE_LIFETIME_BOUND __attribute__((lifetimebound))
 #define Y_ABSL_ATTRIBUTE_LIFETIME_BOUND __attribute__((lifetimebound))
 #else
 #else
 #define Y_ABSL_ATTRIBUTE_LIFETIME_BOUND
 #define Y_ABSL_ATTRIBUTE_LIFETIME_BOUND
 #endif
 #endif
 
 
+// Y_ABSL_INTERNAL_ATTRIBUTE_VIEW indicates that a type acts like a view i.e. a
+// raw (non-owning) pointer. This enables diagnoses similar to those enabled by
+// Y_ABSL_ATTRIBUTE_LIFETIME_BOUND.
+//
+// See the following links for details:
+// https://reviews.llvm.org/D64448
+// https://lists.llvm.org/pipermail/cfe-dev/2018-November/060355.html
+#if Y_ABSL_HAVE_CPP_ATTRIBUTE(gsl::Pointer)
+#define Y_ABSL_INTERNAL_ATTRIBUTE_VIEW [[gsl::Pointer]]
+#else
+#define Y_ABSL_INTERNAL_ATTRIBUTE_VIEW
+#endif
+
+// Y_ABSL_INTERNAL_ATTRIBUTE_OWNER indicates that a type acts like a smart
+// (owning) pointer. This enables diagnoses similar to those enabled by
+// Y_ABSL_ATTRIBUTE_LIFETIME_BOUND.
+//
+// See the following links for details:
+// https://reviews.llvm.org/D64448
+// https://lists.llvm.org/pipermail/cfe-dev/2018-November/060355.html
+#if Y_ABSL_HAVE_CPP_ATTRIBUTE(gsl::Owner)
+#define Y_ABSL_INTERNAL_ATTRIBUTE_OWNER [[gsl::Owner]]
+#else
+#define Y_ABSL_INTERNAL_ATTRIBUTE_OWNER
+#endif
+
 // Y_ABSL_ATTRIBUTE_TRIVIAL_ABI
 // Y_ABSL_ATTRIBUTE_TRIVIAL_ABI
 // Indicates that a type is "trivially relocatable" -- meaning it can be
 // Indicates that a type is "trivially relocatable" -- meaning it can be
 // relocated without invoking the constructor/destructor, using a form of move
 // relocated without invoking the constructor/destructor, using a form of move
@@ -871,4 +908,51 @@
 #define Y_ABSL_ATTRIBUTE_NO_UNIQUE_ADDRESS
 #define Y_ABSL_ATTRIBUTE_NO_UNIQUE_ADDRESS
 #endif
 #endif
 
 
+// Y_ABSL_ATTRIBUTE_UNINITIALIZED
+//
+// GCC and Clang support a flag `-ftrivial-auto-var-init=<option>` (<option>
+// can be "zero" or "pattern") that can be used to initialize automatic stack
+// variables. Variables with this attribute will be left uninitialized,
+// overriding the compiler flag.
+//
+// See https://clang.llvm.org/docs/AttributeReference.html#uninitialized
+// and https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-uninitialized-variable-attribute
+#if Y_ABSL_HAVE_CPP_ATTRIBUTE(clang::uninitialized)
+#define Y_ABSL_ATTRIBUTE_UNINITIALIZED [[clang::uninitialized]]
+#elif Y_ABSL_HAVE_CPP_ATTRIBUTE(gnu::uninitialized)
+#define Y_ABSL_ATTRIBUTE_UNINITIALIZED [[gnu::uninitialized]]
+#elif Y_ABSL_HAVE_ATTRIBUTE(uninitialized)
+#define Y_ABSL_ATTRIBUTE_UNINITIALIZED __attribute__((uninitialized))
+#else
+#define Y_ABSL_ATTRIBUTE_UNINITIALIZED
+#endif
+
+// Y_ABSL_ATTRIBUTE_WARN_UNUSED
+//
+// Compilers routinely warn about trivial variables that are unused.  For
+// non-trivial types, this warning is suppressed since the
+// constructor/destructor may be intentional and load-bearing, for example, with
+// a RAII scoped lock.
+//
+// For example:
+//
+// class Y_ABSL_ATTRIBUTE_WARN_UNUSED MyType {
+//  public:
+//   MyType();
+//   ~MyType();
+// };
+//
+// void foo() {
+//   // Warns with Y_ABSL_ATTRIBUTE_WARN_UNUSED attribute present.
+//   MyType unused;
+// }
+//
+// See https://clang.llvm.org/docs/AttributeReference.html#warn-unused and
+// https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attributes.html#index-warn_005funused-type-attribute
+#if Y_ABSL_HAVE_CPP_ATTRIBUTE(gnu::warn_unused)
+#define Y_ABSL_ATTRIBUTE_WARN_UNUSED [[gnu::warn_unused]]
+#else
+#define Y_ABSL_ATTRIBUTE_WARN_UNUSED
+#endif
+
 #endif  // Y_ABSL_BASE_ATTRIBUTES_H_
 #endif  // Y_ABSL_BASE_ATTRIBUTES_H_

+ 33 - 52
contrib/restricted/abseil-cpp-tstring/y_absl/base/config.h

@@ -117,8 +117,8 @@
 //
 //
 // LTS releases can be obtained from
 // LTS releases can be obtained from
 // https://github.com/abseil/abseil-cpp/releases.
 // https://github.com/abseil/abseil-cpp/releases.
-#define Y_ABSL_LTS_RELEASE_VERSION 20240116
-#define Y_ABSL_LTS_RELEASE_PATCH_LEVEL 2
+#define Y_ABSL_LTS_RELEASE_VERSION 20240722
+#define Y_ABSL_LTS_RELEASE_PATCH_LEVEL 0
 
 
 // Helper macro to convert a CPP variable to a string literal.
 // Helper macro to convert a CPP variable to a string literal.
 #define Y_ABSL_INTERNAL_DO_TOKEN_STR(x) #x
 #define Y_ABSL_INTERNAL_DO_TOKEN_STR(x) #x
@@ -231,12 +231,11 @@ static_assert(Y_ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
 #endif
 #endif
 
 
 // Y_ABSL_HAVE_TLS is defined to 1 when __thread should be supported.
 // Y_ABSL_HAVE_TLS is defined to 1 when __thread should be supported.
-// We assume __thread is supported on Linux or Asylo when compiled with Clang or
+// We assume __thread is supported on Linux when compiled with Clang or
 // compiled against libstdc++ with _GLIBCXX_HAVE_TLS defined.
 // compiled against libstdc++ with _GLIBCXX_HAVE_TLS defined.
 #ifdef Y_ABSL_HAVE_TLS
 #ifdef Y_ABSL_HAVE_TLS
 #error Y_ABSL_HAVE_TLS cannot be directly set
 #error Y_ABSL_HAVE_TLS cannot be directly set
-#elif (defined(__linux__) || defined(__ASYLO__)) && \
-    (defined(__clang__) || defined(_GLIBCXX_HAVE_TLS))
+#elif (defined(__linux__)) && (defined(__clang__) || defined(_GLIBCXX_HAVE_TLS))
 #define Y_ABSL_HAVE_TLS 1
 #define Y_ABSL_HAVE_TLS 1
 #endif
 #endif
 
 
@@ -275,53 +274,18 @@ static_assert(Y_ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
 #define Y_ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE 1
 #define Y_ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE 1
 #endif
 #endif
 
 
+
 // Y_ABSL_HAVE_THREAD_LOCAL
 // Y_ABSL_HAVE_THREAD_LOCAL
 //
 //
+// DEPRECATED - `thread_local` is available on all supported platforms.
 // Checks whether C++11's `thread_local` storage duration specifier is
 // Checks whether C++11's `thread_local` storage duration specifier is
 // supported.
 // supported.
 #ifdef Y_ABSL_HAVE_THREAD_LOCAL
 #ifdef Y_ABSL_HAVE_THREAD_LOCAL
 #error Y_ABSL_HAVE_THREAD_LOCAL cannot be directly set
 #error Y_ABSL_HAVE_THREAD_LOCAL cannot be directly set
-#elif defined(__APPLE__)
-// Notes:
-// * Xcode's clang did not support `thread_local` until version 8, and
-//   even then not for all iOS < 9.0.
-// * Xcode 9.3 started disallowing `thread_local` for 32-bit iOS simulator
-//   targeting iOS 9.x.
-// * Xcode 10 moves the deployment target check for iOS < 9.0 to link time
-//   making Y_ABSL_HAVE_FEATURE unreliable there.
-//
-#if Y_ABSL_HAVE_FEATURE(cxx_thread_local) && \
-    !(TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0)
-#define Y_ABSL_HAVE_THREAD_LOCAL 1
-#endif
-#else  // !defined(__APPLE__)
+#else
 #define Y_ABSL_HAVE_THREAD_LOCAL 1
 #define Y_ABSL_HAVE_THREAD_LOCAL 1
 #endif
 #endif
 
 
-// There are platforms for which TLS should not be used even though the compiler
-// makes it seem like it's supported (Android NDK < r12b for example).
-// This is primarily because of linker problems and toolchain misconfiguration:
-// Abseil does not intend to support this indefinitely. Currently, the newest
-// toolchain that we intend to support that requires this behavior is the
-// r11 NDK - allowing for a 5 year support window on that means this option
-// is likely to be removed around June of 2021.
-// TLS isn't supported until NDK r12b per
-// https://developer.android.com/ndk/downloads/revision_history.html
-// Since NDK r16, `__NDK_MAJOR__` and `__NDK_MINOR__` are defined in
-// <android/ndk-version.h>. For NDK < r16, users should define these macros,
-// e.g. `-D__NDK_MAJOR__=11 -D__NKD_MINOR__=0` for NDK r11.
-#if defined(__ANDROID__) && defined(__clang__)
-#if __has_include(<android/ndk-version.h>)
-#include <android/ndk-version.h>
-#endif  // __has_include(<android/ndk-version.h>)
-#if defined(__ANDROID__) && defined(__clang__) && defined(__NDK_MAJOR__) && \
-    defined(__NDK_MINOR__) &&                                               \
-    ((__NDK_MAJOR__ < 12) || ((__NDK_MAJOR__ == 12) && (__NDK_MINOR__ < 1)))
-#undef Y_ABSL_HAVE_TLS
-#undef Y_ABSL_HAVE_THREAD_LOCAL
-#endif
-#endif  // defined(__ANDROID__) && defined(__clang__)
-
 // Y_ABSL_HAVE_INTRINSIC_INT128
 // Y_ABSL_HAVE_INTRINSIC_INT128
 //
 //
 // Checks whether the __int128 compiler extension for a 128-bit integral type is
 // Checks whether the __int128 compiler extension for a 128-bit integral type is
@@ -379,9 +343,7 @@ static_assert(Y_ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
 #define Y_ABSL_HAVE_EXCEPTIONS 1
 #define Y_ABSL_HAVE_EXCEPTIONS 1
 #endif  // defined(__EXCEPTIONS) && Y_ABSL_HAVE_FEATURE(cxx_exceptions)
 #endif  // defined(__EXCEPTIONS) && Y_ABSL_HAVE_FEATURE(cxx_exceptions)
 // Handle remaining special cases and default to exceptions being supported.
 // Handle remaining special cases and default to exceptions being supported.
-#elif !(defined(__GNUC__) && (__GNUC__ < 5) && !defined(__EXCEPTIONS)) && \
-    !(Y_ABSL_INTERNAL_HAVE_MIN_GNUC_VERSION(5, 0) &&                        \
-      !defined(__cpp_exceptions)) &&                                      \
+#elif !(defined(__GNUC__) && !defined(__cpp_exceptions)) && \
     !(defined(_MSC_VER) && !defined(_CPPUNWIND))
     !(defined(_MSC_VER) && !defined(_CPPUNWIND))
 #define Y_ABSL_HAVE_EXCEPTIONS 1
 #define Y_ABSL_HAVE_EXCEPTIONS 1
 #endif
 #endif
@@ -416,9 +378,9 @@ static_assert(Y_ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
 #elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) ||    \
 #elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) ||    \
     defined(_AIX) || defined(__ros__) || defined(__native_client__) ||       \
     defined(_AIX) || defined(__ros__) || defined(__native_client__) ||       \
     defined(__asmjs__) || defined(__EMSCRIPTEN__) || defined(__Fuchsia__) || \
     defined(__asmjs__) || defined(__EMSCRIPTEN__) || defined(__Fuchsia__) || \
-    defined(__sun) || defined(__ASYLO__) || defined(__myriad2__) ||          \
-    defined(__HAIKU__) || defined(__OpenBSD__) || defined(__NetBSD__) ||     \
-    defined(__QNX__) || defined(__VXWORKS__) || defined(__hexagon__)
+    defined(__sun) || defined(__myriad2__) || defined(__HAIKU__) ||          \
+    defined(__OpenBSD__) || defined(__NetBSD__) || defined(__QNX__) ||       \
+    defined(__VXWORKS__) || defined(__hexagon__)
 #define Y_ABSL_HAVE_MMAP 1
 #define Y_ABSL_HAVE_MMAP 1
 #endif
 #endif
 
 
@@ -902,9 +864,7 @@ static_assert(Y_ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
 #error Y_ABSL_INTERNAL_HAS_CXA_DEMANGLE cannot be directly set
 #error Y_ABSL_INTERNAL_HAS_CXA_DEMANGLE cannot be directly set
 #elif defined(OS_ANDROID) && (defined(__i386__) || defined(__x86_64__))
 #elif defined(OS_ANDROID) && (defined(__i386__) || defined(__x86_64__))
 #define Y_ABSL_INTERNAL_HAS_CXA_DEMANGLE 0
 #define Y_ABSL_INTERNAL_HAS_CXA_DEMANGLE 0
-#elif defined(__GNUC__) && defined(__GNUC_MINOR__) &&            \
-    (__GNUC__ >= 4 || (__GNUC__ >= 3 && __GNUC_MINOR__ >= 4)) && \
-    !defined(__mips__)
+#elif defined(__GNUC__)
 #define Y_ABSL_INTERNAL_HAS_CXA_DEMANGLE 1
 #define Y_ABSL_INTERNAL_HAS_CXA_DEMANGLE 1
 #elif defined(__clang__) && !defined(_MSC_VER)
 #elif defined(__clang__) && !defined(_MSC_VER)
 #define Y_ABSL_INTERNAL_HAS_CXA_DEMANGLE 1
 #define Y_ABSL_INTERNAL_HAS_CXA_DEMANGLE 1
@@ -981,6 +941,27 @@ static_assert(Y_ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
 #define Y_ABSL_HAVE_CONSTANT_EVALUATED 1
 #define Y_ABSL_HAVE_CONSTANT_EVALUATED 1
 #endif
 #endif
 
 
+// Y_ABSL_INTERNAL_CONSTEXPR_SINCE_CXXYY is used to conditionally define constexpr
+// for different C++ versions.
+//
+// These macros are an implementation detail and will be unconditionally removed
+// once the minimum supported C++ version catches up to a given version.
+//
+// For this reason, this symbol is considered INTERNAL and code outside of
+// Abseil must not use it.
+#if defined(Y_ABSL_INTERNAL_CPLUSPLUS_LANG) && \
+    Y_ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L
+#define Y_ABSL_INTERNAL_CONSTEXPR_SINCE_CXX17 constexpr
+#else
+#define Y_ABSL_INTERNAL_CONSTEXPR_SINCE_CXX17
+#endif
+#if defined(Y_ABSL_INTERNAL_CPLUSPLUS_LANG) && \
+    Y_ABSL_INTERNAL_CPLUSPLUS_LANG >= 202002L
+#define Y_ABSL_INTERNAL_CONSTEXPR_SINCE_CXX20 constexpr
+#else
+#define Y_ABSL_INTERNAL_CONSTEXPR_SINCE_CXX20
+#endif
+
 // Y_ABSL_INTERNAL_EMSCRIPTEN_VERSION combines Emscripten's three version macros
 // Y_ABSL_INTERNAL_EMSCRIPTEN_VERSION combines Emscripten's three version macros
 // into an integer that can be compared against.
 // into an integer that can be compared against.
 #ifdef Y_ABSL_INTERNAL_EMSCRIPTEN_VERSION
 #ifdef Y_ABSL_INTERNAL_EMSCRIPTEN_VERSION

+ 0 - 16
contrib/restricted/abseil-cpp-tstring/y_absl/base/dynamic_annotations.h

@@ -252,25 +252,9 @@ Y_ABSL_INTERNAL_END_EXTERN_C
 
 
 #else  // !defined(Y_ABSL_HAVE_MEMORY_SANITIZER)
 #else  // !defined(Y_ABSL_HAVE_MEMORY_SANITIZER)
 
 
-// TODO(rogeeff): remove this branch
-#ifdef Y_ABSL_HAVE_THREAD_SANITIZER
-#define Y_ABSL_ANNOTATE_MEMORY_IS_INITIALIZED(address, size) \
-  do {                                                     \
-    (void)(address);                                       \
-    (void)(size);                                          \
-  } while (0)
-#define Y_ABSL_ANNOTATE_MEMORY_IS_UNINITIALIZED(address, size) \
-  do {                                                       \
-    (void)(address);                                         \
-    (void)(size);                                            \
-  } while (0)
-#else
-
 #define Y_ABSL_ANNOTATE_MEMORY_IS_INITIALIZED(address, size)    // empty
 #define Y_ABSL_ANNOTATE_MEMORY_IS_INITIALIZED(address, size)    // empty
 #define Y_ABSL_ANNOTATE_MEMORY_IS_UNINITIALIZED(address, size)  // empty
 #define Y_ABSL_ANNOTATE_MEMORY_IS_UNINITIALIZED(address, size)  // empty
 
 
-#endif
-
 #endif  // Y_ABSL_HAVE_MEMORY_SANITIZER
 #endif  // Y_ABSL_HAVE_MEMORY_SANITIZER
 
 
 // -------------------------------------------------------------------------
 // -------------------------------------------------------------------------

+ 3 - 1
contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/nullability_impl.h

@@ -19,10 +19,11 @@
 #include <type_traits>
 #include <type_traits>
 
 
 #include "y_absl/base/attributes.h"
 #include "y_absl/base/attributes.h"
+#include "y_absl/base/config.h"
 #include "y_absl/meta/type_traits.h"
 #include "y_absl/meta/type_traits.h"
 
 
 namespace y_absl {
 namespace y_absl {
-
+Y_ABSL_NAMESPACE_BEGIN
 namespace nullability_internal {
 namespace nullability_internal {
 
 
 // `IsNullabilityCompatible` checks whether its first argument is a class
 // `IsNullabilityCompatible` checks whether its first argument is a class
@@ -101,6 +102,7 @@ using NullabilityUnknownImpl
     = T;
     = T;
 
 
 }  // namespace nullability_internal
 }  // namespace nullability_internal
+Y_ABSL_NAMESPACE_END
 }  // namespace y_absl
 }  // namespace y_absl
 
 
 #endif  // Y_ABSL_BASE_INTERNAL_NULLABILITY_IMPL_H_
 #endif  // Y_ABSL_BASE_INTERNAL_NULLABILITY_IMPL_H_

+ 84 - 0
contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/poison.cc

@@ -0,0 +1,84 @@
+// Copyright 2024 The Abseil Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "y_absl/base/internal/poison.h"
+
+#include <cstdlib>
+
+#include "y_absl/base/config.h"
+#include "y_absl/base/internal/direct_mmap.h"
+
+#ifndef _WIN32
+#include <unistd.h>
+#endif
+
+#if defined(Y_ABSL_HAVE_ADDRESS_SANITIZER)
+#include <sanitizer/asan_interface.h>
+#elif defined(Y_ABSL_HAVE_MEMORY_SANITIZER)
+#include <sanitizer/msan_interface.h>
+#elif defined(Y_ABSL_HAVE_MMAP)
+#include <sys/mman.h>
+#endif
+
+#if defined(_WIN32)
+#include <windows.h>
+#endif
+
+namespace y_absl {
+Y_ABSL_NAMESPACE_BEGIN
+namespace base_internal {
+
+namespace {
+
+size_t GetPageSize() {
+#ifdef _WIN32
+  SYSTEM_INFO system_info;
+  GetSystemInfo(&system_info);
+  return system_info.dwPageSize;
+#elif defined(__wasm__) || defined(__asmjs__) || defined(__hexagon__)
+  return getpagesize();
+#else
+  return static_cast<size_t>(sysconf(_SC_PAGESIZE));
+#endif
+}
+
+}  // namespace
+
+void* InitializePoisonedPointerInternal() {
+  const size_t block_size = GetPageSize();
+#if defined(Y_ABSL_HAVE_ADDRESS_SANITIZER)
+  void* data = malloc(block_size);
+  ASAN_POISON_MEMORY_REGION(data, block_size);
+#elif defined(Y_ABSL_HAVE_MEMORY_SANITIZER)
+  void* data = malloc(block_size);
+  __msan_poison(data, block_size);
+#elif defined(Y_ABSL_HAVE_MMAP)
+  void* data = DirectMmap(nullptr, block_size, PROT_NONE,
+                          MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+  if (data == MAP_FAILED) return GetBadPointerInternal();
+#elif defined(_WIN32)
+  void* data = VirtualAlloc(nullptr, block_size, MEM_RESERVE | MEM_COMMIT,
+                            PAGE_NOACCESS);
+  if (data == nullptr) return GetBadPointerInternal();
+#else
+  return GetBadPointerInternal();
+#endif
+  // Return the middle of the block so that dereferences before and after the
+  // pointer will both crash.
+  return static_cast<char*>(data) + block_size / 2;
+}
+
+}  // namespace base_internal
+Y_ABSL_NAMESPACE_END
+}  // namespace y_absl

+ 59 - 0
contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/poison.h

@@ -0,0 +1,59 @@
+// Copyright 2024 The Abseil Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef Y_ABSL_BASE_INTERNAL_POISON_H_
+#define Y_ABSL_BASE_INTERNAL_POISON_H_
+
+#include <cstdint>
+
+#include "y_absl/base/config.h"
+
+namespace y_absl {
+Y_ABSL_NAMESPACE_BEGIN
+namespace base_internal {
+
+inline void* GetBadPointerInternal() {
+  // A likely bad pointer. Pointers are required to have high bits that are all
+  // zero or all one for certain 64-bit CPUs. This pointer value will hopefully
+  // cause a crash on dereference and also be clearly recognizable as invalid.
+  constexpr uint64_t kBadPtr = 0xBAD0BAD0BAD0BAD0;
+  auto ret = reinterpret_cast<void*>(static_cast<uintptr_t>(kBadPtr));
+#ifndef _MSC_VER  // MSVC doesn't support inline asm with `volatile`.
+  // Try to prevent the compiler from optimizing out the undefined behavior.
+  asm volatile("" : : "r"(ret) :);  // NOLINT
+#endif
+  return ret;
+}
+
+void* InitializePoisonedPointerInternal();
+
+inline void* get_poisoned_pointer() {
+#if defined(NDEBUG) && !defined(Y_ABSL_HAVE_ADDRESS_SANITIZER) && \
+    !defined(Y_ABSL_HAVE_MEMORY_SANITIZER)
+  // In optimized non-sanitized builds, avoid the function-local static because
+  // of the codegen and runtime cost.
+  return GetBadPointerInternal();
+#else
+  // Non-optimized builds may use more robust implementation. Note that we can't
+  // use a static global because Chromium doesn't allow non-constinit globals.
+  static void* ptr = InitializePoisonedPointerInternal();
+  return ptr;
+#endif
+}
+
+}  // namespace base_internal
+Y_ABSL_NAMESPACE_END
+}  // namespace y_absl
+
+#endif  // Y_ABSL_BASE_INTERNAL_POISON_H_

+ 13 - 3
contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/spinlock.h

@@ -53,7 +53,7 @@ namespace y_absl {
 Y_ABSL_NAMESPACE_BEGIN
 Y_ABSL_NAMESPACE_BEGIN
 namespace base_internal {
 namespace base_internal {
 
 
-class Y_ABSL_LOCKABLE SpinLock {
+class Y_ABSL_LOCKABLE Y_ABSL_ATTRIBUTE_WARN_UNUSED SpinLock {
  public:
  public:
   SpinLock() : lockword_(kSpinLockCooperative) {
   SpinLock() : lockword_(kSpinLockCooperative) {
     Y_ABSL_TSAN_MUTEX_CREATE(this, __tsan_mutex_not_static);
     Y_ABSL_TSAN_MUTEX_CREATE(this, __tsan_mutex_not_static);
@@ -89,7 +89,8 @@ class Y_ABSL_LOCKABLE SpinLock {
   // acquisition was successful.  If the lock was not acquired, false is
   // acquisition was successful.  If the lock was not acquired, false is
   // returned.  If this SpinLock is free at the time of the call, TryLock
   // returned.  If this SpinLock is free at the time of the call, TryLock
   // will return true with high probability.
   // will return true with high probability.
-  inline bool TryLock() Y_ABSL_EXCLUSIVE_TRYLOCK_FUNCTION(true) {
+  Y_ABSL_MUST_USE_RESULT inline bool TryLock()
+      Y_ABSL_EXCLUSIVE_TRYLOCK_FUNCTION(true) {
     Y_ABSL_TSAN_MUTEX_PRE_LOCK(this, __tsan_mutex_try_lock);
     Y_ABSL_TSAN_MUTEX_PRE_LOCK(this, __tsan_mutex_try_lock);
     bool res = TryLockImpl();
     bool res = TryLockImpl();
     Y_ABSL_TSAN_MUTEX_POST_LOCK(
     Y_ABSL_TSAN_MUTEX_POST_LOCK(
@@ -120,7 +121,7 @@ class Y_ABSL_LOCKABLE SpinLock {
   // Determine if the lock is held.  When the lock is held by the invoking
   // Determine if the lock is held.  When the lock is held by the invoking
   // thread, true will always be returned. Intended to be used as
   // thread, true will always be returned. Intended to be used as
   // CHECK(lock.IsHeld()).
   // CHECK(lock.IsHeld()).
-  inline bool IsHeld() const {
+  Y_ABSL_MUST_USE_RESULT inline bool IsHeld() const {
     return (lockword_.load(std::memory_order_relaxed) & kSpinLockHeld) != 0;
     return (lockword_.load(std::memory_order_relaxed) & kSpinLockHeld) != 0;
   }
   }
 
 
@@ -202,6 +203,15 @@ class Y_ABSL_LOCKABLE SpinLock {
 
 
 // Corresponding locker object that arranges to acquire a spinlock for
 // Corresponding locker object that arranges to acquire a spinlock for
 // the duration of a C++ scope.
 // the duration of a C++ scope.
+//
+// TODO(b/176172494): Use only [[nodiscard]] when baseline is raised.
+// TODO(b/6695610): Remove forward declaration when #ifdef is no longer needed.
+#if Y_ABSL_HAVE_CPP_ATTRIBUTE(nodiscard)
+class [[nodiscard]] SpinLockHolder;
+#else
+class Y_ABSL_MUST_USE_RESULT Y_ABSL_ATTRIBUTE_TRIVIAL_ABI SpinLockHolder;
+#endif
+
 class Y_ABSL_SCOPED_LOCKABLE SpinLockHolder {
 class Y_ABSL_SCOPED_LOCKABLE SpinLockHolder {
  public:
  public:
   inline explicit SpinLockHolder(SpinLock* l) Y_ABSL_EXCLUSIVE_LOCK_FUNCTION(l)
   inline explicit SpinLockHolder(SpinLock* l) Y_ABSL_EXCLUSIVE_LOCK_FUNCTION(l)

+ 0 - 12
contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/unscaledcycleclock.cc

@@ -121,18 +121,6 @@ double UnscaledCycleClock::Frequency() {
   return aarch64_timer_frequency;
   return aarch64_timer_frequency;
 }
 }
 
 
-#elif defined(__riscv)
-
-int64_t UnscaledCycleClock::Now() {
-  int64_t virtual_timer_value;
-  asm volatile("rdcycle %0" : "=r"(virtual_timer_value));
-  return virtual_timer_value;
-}
-
-double UnscaledCycleClock::Frequency() {
-  return base_internal::NominalCPUFrequency();
-}
-
 #elif defined(_M_IX86) || defined(_M_X64)
 #elif defined(_M_IX86) || defined(_M_X64)
 
 
 #pragma intrinsic(__rdtsc)
 #pragma intrinsic(__rdtsc)

Some files were not shown because too many files changed in this diff