summaryrefslogtreecommitdiff
path: root/absl
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2020-10-30 10:38:44 -0700
committerGravatar vslashg <gfalcon@google.com>2020-10-30 15:43:07 -0400
commitc9894d1dc38577c4ce50eefe0a944ea8d46d7fc5 (patch)
tree84697fb6c0ae12c464e495e4ae7414f584f9875f /absl
parente9b9e38f67a008d66133535a72ada843bd66013f (diff)
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
Diffstat (limited to 'absl')
-rw-r--r--absl/algorithm/container.h2
-rw-r--r--absl/base/internal/thread_identity.cc7
-rw-r--r--absl/base/internal/thread_identity.h4
-rw-r--r--absl/types/variant.h13
4 files changed, 18 insertions, 8 deletions
diff --git a/absl/algorithm/container.h b/absl/algorithm/container.h
index 09b91f74..6398438f 100644
--- a/absl/algorithm/container.h
+++ b/absl/algorithm/container.h
@@ -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),
diff --git a/absl/base/internal/thread_identity.cc b/absl/base/internal/thread_identity.cc
index d63a04ae..6ea010ed 100644
--- a/absl/base/internal/thread_identity.cc
+++ b/absl/base/internal/thread_identity.cc
@@ -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;
diff --git a/absl/base/internal/thread_identity.h b/absl/base/internal/thread_identity.h
index c61d1feb..d2a65fd8 100644
--- a/absl/base/internal/thread_identity.h
+++ b/absl/base/internal/thread_identity.h
@@ -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.
diff --git a/absl/types/variant.h b/absl/types/variant.h
index 776d19a1..ac93464b 100644
--- a/absl/types/variant.h
+++ b/absl/types/variant.h
@@ -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: