mirror of
https://github.com/abseil/abseil-cpp.git
synced 2026-06-04 20:14:23 +08:00
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
This commit is contained in:
@@ -188,7 +188,7 @@ bool c_any_of(const C& c, Pred&& pred) {
|
||||
// c_none_of()
|
||||
//
|
||||
// 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>
|
||||
bool c_none_of(const C& c, Pred&& pred) {
|
||||
return std::none_of(container_algorithm_internal::c_begin(c),
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <cassert>
|
||||
#include <memory>
|
||||
|
||||
#include "absl/base/attributes.h"
|
||||
#include "absl/base/call_once.h"
|
||||
#include "absl/base/internal/raw_logging.h"
|
||||
#include "absl/base/internal/spinlock.h"
|
||||
@@ -53,9 +54,11 @@ void AllocateThreadIdentityKey(ThreadIdentityReclaimerFunction reclaimer) {
|
||||
// exist within a process (via dlopen() or similar), references to
|
||||
// thread_identity_ptr from each instance of the code will refer to
|
||||
// *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")))
|
||||
#endif // __GNUC__
|
||||
#endif // ABSL_HAVE_ATTRIBUTE(visibility) && !defined(__APPLE__)
|
||||
#if ABSL_PER_THREAD_TLS
|
||||
// Prefer __thread to thread_local as benchmarks indicate it is a bit faster.
|
||||
ABSL_PER_THREAD_TLS_KEYWORD ThreadIdentity* thread_identity_ptr = nullptr;
|
||||
|
||||
@@ -211,7 +211,9 @@ void ClearCurrentThreadIdentity();
|
||||
#define ABSL_THREAD_IDENTITY_MODE ABSL_FORCE_THREAD_IDENTITY_MODE
|
||||
#elif defined(_WIN32) && !defined(__MINGW32__)
|
||||
#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)
|
||||
// Support for async-safe TLS was specifically added in GRTEv4. It's not
|
||||
// present in the upstream eglibc.
|
||||
|
||||
@@ -604,7 +604,10 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> {
|
||||
|
||||
// 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:
|
||||
//
|
||||
@@ -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
|
||||
// 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:
|
||||
//
|
||||
@@ -643,7 +648,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> {
|
||||
}
|
||||
|
||||
// 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.
|
||||
//
|
||||
// Example:
|
||||
@@ -662,7 +667,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> {
|
||||
}
|
||||
|
||||
// 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.
|
||||
//
|
||||
// Example:
|
||||
|
||||
Reference in New Issue
Block a user