Commit c9894d1d by Abseil Team Committed by vslashg

Export of internal Abseil changes

--
dce086fa6e045bed433c664f95a6581b7ffb2d98 by Abseil Team <absl-team@google.com>:

fix spelling error "fulfil" -> "fulfill"

PiperOrigin-RevId: 339898016

--
10faa4546b69d8a07f949bc03dd9671231232ad0 by Abseil Team <absl-team@google.com>:

Clarify comments on variant::emplace

PiperOrigin-RevId: 339897241

--
0d02261a7a8b9c11e3a4e76dfedf4d95590e2419 by Derek Mauro <dmauro@google.com>:

Use thread_local for ThreadIdentity storage on Apple platforms
that support it

PiperOrigin-RevId: 339698124
GitOrigin-RevId: dce086fa6e045bed433c664f95a6581b7ffb2d98
Change-Id: I8c668b33c805fd5231ceb285652c80f312e5a33a
parent e9b9e38f
...@@ -188,7 +188,7 @@ bool c_any_of(const C& c, Pred&& pred) { ...@@ -188,7 +188,7 @@ bool c_any_of(const C& c, Pred&& pred) {
// c_none_of() // c_none_of()
// //
// Container-based version of the <algorithm> `std::none_of()` function to // Container-based version of the <algorithm> `std::none_of()` function to
// test if no elements in a container fulfil a condition. // test if no elements in a container fulfill a condition.
template <typename C, typename Pred> template <typename C, typename Pred>
bool c_none_of(const C& c, Pred&& pred) { bool c_none_of(const C& c, Pred&& pred) {
return std::none_of(container_algorithm_internal::c_begin(c), return std::none_of(container_algorithm_internal::c_begin(c),
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <cassert> #include <cassert>
#include <memory> #include <memory>
#include "absl/base/attributes.h"
#include "absl/base/call_once.h" #include "absl/base/call_once.h"
#include "absl/base/internal/raw_logging.h" #include "absl/base/internal/raw_logging.h"
#include "absl/base/internal/spinlock.h" #include "absl/base/internal/spinlock.h"
...@@ -53,9 +54,11 @@ void AllocateThreadIdentityKey(ThreadIdentityReclaimerFunction reclaimer) { ...@@ -53,9 +54,11 @@ void AllocateThreadIdentityKey(ThreadIdentityReclaimerFunction reclaimer) {
// exist within a process (via dlopen() or similar), references to // exist within a process (via dlopen() or similar), references to
// thread_identity_ptr from each instance of the code will refer to // thread_identity_ptr from each instance of the code will refer to
// *different* instances of this ptr. // *different* instances of this ptr.
#ifdef __GNUC__ // Apple platforms have the visibility attribute, but issue a compile warning
// that protected visibility is unsupported.
#if ABSL_HAVE_ATTRIBUTE(visibility) && !defined(__APPLE__)
__attribute__((visibility("protected"))) __attribute__((visibility("protected")))
#endif // __GNUC__ #endif // ABSL_HAVE_ATTRIBUTE(visibility) && !defined(__APPLE__)
#if ABSL_PER_THREAD_TLS #if ABSL_PER_THREAD_TLS
// Prefer __thread to thread_local as benchmarks indicate it is a bit faster. // Prefer __thread to thread_local as benchmarks indicate it is a bit faster.
ABSL_PER_THREAD_TLS_KEYWORD ThreadIdentity* thread_identity_ptr = nullptr; ABSL_PER_THREAD_TLS_KEYWORD ThreadIdentity* thread_identity_ptr = nullptr;
......
...@@ -211,7 +211,9 @@ void ClearCurrentThreadIdentity(); ...@@ -211,7 +211,9 @@ void ClearCurrentThreadIdentity();
#define ABSL_THREAD_IDENTITY_MODE ABSL_FORCE_THREAD_IDENTITY_MODE #define ABSL_THREAD_IDENTITY_MODE ABSL_FORCE_THREAD_IDENTITY_MODE
#elif defined(_WIN32) && !defined(__MINGW32__) #elif defined(_WIN32) && !defined(__MINGW32__)
#define ABSL_THREAD_IDENTITY_MODE ABSL_THREAD_IDENTITY_MODE_USE_CPP11 #define ABSL_THREAD_IDENTITY_MODE ABSL_THREAD_IDENTITY_MODE_USE_CPP11
#elif ABSL_PER_THREAD_TLS && defined(__GOOGLE_GRTE_VERSION__) && \ #elif defined(__APPLE__) && defined(ABSL_HAVE_THREAD_LOCAL)
#define ABSL_THREAD_IDENTITY_MODE ABSL_THREAD_IDENTITY_MODE_USE_CPP11
#elif ABSL_PER_THREAD_TLS && defined(__GOOGLE_GRTE_VERSION__) && \
(__GOOGLE_GRTE_VERSION__ >= 20140228L) (__GOOGLE_GRTE_VERSION__ >= 20140228L)
// Support for async-safe TLS was specifically added in GRTEv4. It's not // Support for async-safe TLS was specifically added in GRTEv4. It's not
// present in the upstream eglibc. // present in the upstream eglibc.
......
...@@ -604,7 +604,10 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> { ...@@ -604,7 +604,10 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> {
// emplace() Functions // emplace() Functions
// Constructs a value of the given alternative type T within the variant. // Constructs a value of the given alternative type T within the variant. The
// existing value of the variant is destroyed first (provided that
// `absl::valueless_by_exception()` is false). Requires that T is unambiguous
// in the variant.
// //
// Example: // Example:
// //
...@@ -624,7 +627,9 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> { ...@@ -624,7 +627,9 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> {
} }
// Constructs a value of the given alternative type T within the variant using // Constructs a value of the given alternative type T within the variant using
// an initializer list. // an initializer list. The existing value of the variant is destroyed first
// (provided that `absl::valueless_by_exception()` is false). Requires that T
// is unambiguous in the variant.
// //
// Example: // Example:
// //
...@@ -643,7 +648,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> { ...@@ -643,7 +648,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> {
} }
// Destroys the current value of the variant (provided that // Destroys the current value of the variant (provided that
// `absl::valueless_by_exception()` is false, and constructs a new value at // `absl::valueless_by_exception()` is false) and constructs a new value at
// the given index. // the given index.
// //
// Example: // Example:
...@@ -662,7 +667,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> { ...@@ -662,7 +667,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> {
} }
// Destroys the current value of the variant (provided that // Destroys the current value of the variant (provided that
// `absl::valueless_by_exception()` is false, and constructs a new value at // `absl::valueless_by_exception()` is false) and constructs a new value at
// the given index using an initializer list and the provided arguments. // the given index using an initializer list and the provided arguments.
// //
// Example: // Example:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment