Skip to content

Commit

Permalink
Export of internal Abseil changes
Browse files Browse the repository at this point in the history
--
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
  • Loading branch information
Abseil Team authored and vslashg committed Oct 30, 2020
1 parent e9b9e38 commit c9894d1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion absl/algorithm/container.h
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
7 changes: 5 additions & 2 deletions absl/base/internal/thread_identity.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion absl/base/internal/thread_identity.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
13 changes: 9 additions & 4 deletions absl/types/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
//
Expand All @@ -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:
//
Expand All @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit c9894d1

Please sign in to comment.