Export of internal Abseil changes
-- 00f5301405423005d9129935c05f20155536cc1a by CJ Johnson <johnsoncj@google.com>: Removes usage of std::aligned_storage from Abseil implementation details PiperOrigin-RevId: 296492301 -- fc11d15f91764612fba080669d2381dc181df52b by Abseil Team <absl-team@google.com>: Fix absl::bind_front documentation. PiperOrigin-RevId: 296482945 -- 0164c595c129c46bf21ae74eba5399a1da5f140b by Gennadiy Rozental <rogeeff@google.com>: Automated g4 rollback of changelist 296320700. PiperOrigin-RevId: 296439968 -- 1eb295700758ca0894d872b2de7c675b4ad679af by Abseil Team <absl-team@google.com>: Removes duplicate comments. PiperOrigin-RevId: 296433214 -- c30c01caae02d2fa4ef783d988de6bebb9757c39 by Derek Mauro <dmauro@google.com>: Merge GitHub #621: Add RISCV support to GetProgramCounter() Fixes #621 PiperOrigin-RevId: 296351174 -- 95d4498167596fd7543e025bdfe9a8da9e2ca3c8 by Abseil Team <absl-team@google.com>: Automated g4 rollback of changelist 296320700. PiperOrigin-RevId: 296348701 -- b193f0543e0cec54dddb2ed51f45dc489c8d06d5 by Gennadiy Rozental <rogeeff@google.com>: Change TryParse interface to return managed value. In addition introduce companion StoreValue routine which consumes pointer to source value and stores the value inside of FlagImpl. In a follow up CL we will change StoreValue implementation to behave differently depending on "value storage kind". We also rename default_src_ to default_value_. PiperOrigin-RevId: 296320700 -- 57e942b485d12912a0a8d0d0b35fa2a62847020f by Derek Mauro <dmauro@google.com>: Merge GitHub #622 * Add missing #ifdef conditionals for ABSL_HAVE_VDSO_SUPPORT PiperOrigin-RevId: 296272830 GitOrigin-RevId: 00f5301405423005d9129935c05f20155536cc1a Change-Id: I1b05eeaf1280f95fb0a2c5f3654995a87c792893
This commit is contained in:
parent
2a5633fc07
commit
b69c7d880c
16 changed files with 131 additions and 135 deletions
|
|
@ -252,8 +252,8 @@ class SynchronizationStorage {
|
|||
|
||||
absl::once_flag once_;
|
||||
|
||||
// An aligned space for T.
|
||||
typename std::aligned_storage<sizeof(T), alignof(T)>::type space_;
|
||||
// An aligned space for the T.
|
||||
alignas(T) unsigned char space_[sizeof(T)];
|
||||
};
|
||||
|
||||
} // namespace synchronization_internal
|
||||
|
|
|
|||
|
|
@ -368,31 +368,29 @@ class Waiter::WinHelper {
|
|||
return reinterpret_cast<CONDITION_VARIABLE *>(&w->cv_storage_);
|
||||
}
|
||||
|
||||
static_assert(sizeof(SRWLOCK) == sizeof(Waiter::SRWLockStorage),
|
||||
"SRWLockStorage does not have the same size as SRWLOCK");
|
||||
static_assert(
|
||||
alignof(SRWLOCK) == alignof(Waiter::SRWLockStorage),
|
||||
"SRWLockStorage does not have the same alignment as SRWLOCK");
|
||||
static_assert(sizeof(SRWLOCK) == sizeof(void *),
|
||||
"`mu_storage_` does not have the same size as SRWLOCK");
|
||||
static_assert(alignof(SRWLOCK) == alignof(void *),
|
||||
"`mu_storage_` does not have the same alignment as SRWLOCK");
|
||||
|
||||
static_assert(sizeof(CONDITION_VARIABLE) ==
|
||||
sizeof(Waiter::ConditionVariableStorage),
|
||||
"ABSL_CONDITION_VARIABLE_STORAGE does not have the same size "
|
||||
"as CONDITION_VARIABLE");
|
||||
static_assert(alignof(CONDITION_VARIABLE) ==
|
||||
alignof(Waiter::ConditionVariableStorage),
|
||||
"ConditionVariableStorage does not have the same "
|
||||
"alignment as CONDITION_VARIABLE");
|
||||
static_assert(sizeof(CONDITION_VARIABLE) == sizeof(void *),
|
||||
"`ABSL_CONDITION_VARIABLE_STORAGE` does not have the same size "
|
||||
"as `CONDITION_VARIABLE`");
|
||||
static_assert(
|
||||
alignof(CONDITION_VARIABLE) == alignof(void *),
|
||||
"`cv_storage_` does not have the same alignment as `CONDITION_VARIABLE`");
|
||||
|
||||
// The SRWLOCK and CONDITION_VARIABLE types must be trivially constructible
|
||||
// and destructible because we never call their constructors or destructors.
|
||||
static_assert(std::is_trivially_constructible<SRWLOCK>::value,
|
||||
"The SRWLOCK type must be trivially constructible");
|
||||
static_assert(std::is_trivially_constructible<CONDITION_VARIABLE>::value,
|
||||
"The CONDITION_VARIABLE type must be trivially constructible");
|
||||
"The `SRWLOCK` type must be trivially constructible");
|
||||
static_assert(
|
||||
std::is_trivially_constructible<CONDITION_VARIABLE>::value,
|
||||
"The `CONDITION_VARIABLE` type must be trivially constructible");
|
||||
static_assert(std::is_trivially_destructible<SRWLOCK>::value,
|
||||
"The SRWLOCK type must be trivially destructible");
|
||||
"The `SRWLOCK` type must be trivially destructible");
|
||||
static_assert(std::is_trivially_destructible<CONDITION_VARIABLE>::value,
|
||||
"The CONDITION_VARIABLE type must be trivially destructible");
|
||||
"The `CONDITION_VARIABLE` type must be trivially destructible");
|
||||
};
|
||||
|
||||
class LockHolder {
|
||||
|
|
|
|||
|
|
@ -133,13 +133,6 @@ class Waiter {
|
|||
std::atomic<int> wakeups_;
|
||||
|
||||
#elif ABSL_WAITER_MODE == ABSL_WAITER_MODE_WIN32
|
||||
// We can't include Windows.h in our headers, so we use aligned storage
|
||||
// buffers to define the storage of SRWLOCK and CONDITION_VARIABLE.
|
||||
using SRWLockStorage =
|
||||
typename std::aligned_storage<sizeof(void*), alignof(void*)>::type;
|
||||
using ConditionVariableStorage =
|
||||
typename std::aligned_storage<sizeof(void*), alignof(void*)>::type;
|
||||
|
||||
// WinHelper - Used to define utilities for accessing the lock and
|
||||
// condition variable storage once the types are complete.
|
||||
class WinHelper;
|
||||
|
|
@ -147,8 +140,10 @@ class Waiter {
|
|||
// REQUIRES: WinHelper::GetLock(this) must be held.
|
||||
void InternalCondVarPoke();
|
||||
|
||||
SRWLockStorage mu_storage_;
|
||||
ConditionVariableStorage cv_storage_;
|
||||
// We can't include Windows.h in our headers, so we use aligned charachter
|
||||
// buffers to define the storage of SRWLOCK and CONDITION_VARIABLE.
|
||||
alignas(void*) unsigned char mu_storage_[sizeof(void*)];
|
||||
alignas(void*) unsigned char cv_storage_[sizeof(void*)];
|
||||
int waiter_count_;
|
||||
int wakeup_count_;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue