aboutsummaryrefslogtreecommitdiffhomepage
path: root/absl/base
diff options
context:
space:
mode:
Diffstat (limited to 'absl/base')
-rw-r--r--absl/base/exception_safety_testing_test.cc18
-rw-r--r--absl/base/internal/low_level_alloc.cc13
-rw-r--r--absl/base/options.h8
3 files changed, 15 insertions, 24 deletions
diff --git a/absl/base/exception_safety_testing_test.cc b/absl/base/exception_safety_testing_test.cc
index 575b535..a59be29 100644
--- a/absl/base/exception_safety_testing_test.cc
+++ b/absl/base/exception_safety_testing_test.cc
@@ -328,17 +328,15 @@ TEST(ThrowingValueTest, NonThrowingDelete) {
UnsetCountdown();
}
-using Storage =
- absl::aligned_storage_t<sizeof(ThrowingValue<>), alignof(ThrowingValue<>)>;
-
TEST(ThrowingValueTest, NonThrowingPlacementDelete) {
constexpr int kArrayLen = 2;
// We intentionally create extra space to store the tag allocated by placement
// new[].
constexpr int kStorageLen = 4;
- Storage buf;
- Storage array_buf[kStorageLen];
+ alignas(ThrowingValue<>) unsigned char buf[sizeof(ThrowingValue<>)];
+ alignas(ThrowingValue<>) unsigned char
+ array_buf[sizeof(ThrowingValue<>[kStorageLen])];
auto* placed = new (&buf) ThrowingValue<>(1);
auto placed_array = new (&array_buf) ThrowingValue<>[kArrayLen];
@@ -902,12 +900,12 @@ TEST(ConstructorTrackerTest, CreatedAfter) {
}
TEST(ConstructorTrackerTest, NotDestroyedAfter) {
- absl::aligned_storage_t<sizeof(Tracked), alignof(Tracked)> storage;
+ alignas(Tracked) unsigned char storage[sizeof(Tracked)];
EXPECT_NONFATAL_FAILURE(
{
exceptions_internal::ConstructorTracker ct(
exceptions_internal::countdown);
- new (&storage) Tracked;
+ new (&storage) Tracked();
},
"not destroyed");
}
@@ -924,11 +922,11 @@ TEST(ConstructorTrackerTest, DestroyedTwice) {
TEST(ConstructorTrackerTest, ConstructedTwice) {
exceptions_internal::ConstructorTracker ct(exceptions_internal::countdown);
- absl::aligned_storage_t<sizeof(Tracked), alignof(Tracked)> storage;
+ alignas(Tracked) unsigned char storage[sizeof(Tracked)];
EXPECT_NONFATAL_FAILURE(
{
- new (&storage) Tracked;
- new (&storage) Tracked;
+ new (&storage) Tracked();
+ new (&storage) Tracked();
reinterpret_cast<Tracked*>(&storage)->~Tracked();
},
"re-constructed");
diff --git a/absl/base/internal/low_level_alloc.cc b/absl/base/internal/low_level_alloc.cc
index 225abc2..1bf9443 100644
--- a/absl/base/internal/low_level_alloc.cc
+++ b/absl/base/internal/low_level_alloc.cc
@@ -220,16 +220,17 @@ struct LowLevelAlloc::Arena {
};
namespace {
-using ArenaStorage = std::aligned_storage<sizeof(LowLevelAlloc::Arena),
- alignof(LowLevelAlloc::Arena)>::type;
-
// Static storage space for the lazily-constructed, default global arena
// instances. We require this space because the whole point of LowLevelAlloc
// is to avoid relying on malloc/new.
-ArenaStorage default_arena_storage;
-ArenaStorage unhooked_arena_storage;
+alignas(LowLevelAlloc::Arena) unsigned char default_arena_storage[sizeof(
+ LowLevelAlloc::Arena)];
+alignas(LowLevelAlloc::Arena) unsigned char unhooked_arena_storage[sizeof(
+ LowLevelAlloc::Arena)];
#ifndef ABSL_LOW_LEVEL_ALLOC_ASYNC_SIGNAL_SAFE_MISSING
-ArenaStorage unhooked_async_sig_safe_arena_storage;
+alignas(
+ LowLevelAlloc::Arena) unsigned char unhooked_async_sig_safe_arena_storage
+ [sizeof(LowLevelAlloc::Arena)];
#endif
// We must use LowLevelCallOnce here to construct the global arenas, rather than
diff --git a/absl/base/options.h b/absl/base/options.h
index 6868c77..234137c 100644
--- a/absl/base/options.h
+++ b/absl/base/options.h
@@ -123,14 +123,6 @@
// compiler flags passed by the end user. For more info, see
// https://abseil.io/about/design/dropin-types.
-// A value of 2 means to detect the C++ version being used to compile Abseil,
-// and use an alias only if a working std::optional is available. This option
-// should not be used when your program is not built from source -- for example,
-// if you are distributing Abseil in a binary package manager -- since in mode
-// 2, absl::optional will name a different template class, with a different
-// mangled name and binary layout, depending on the compiler flags passed by the
-// end user.
-//
// User code should not inspect this macro. To check in the preprocessor if
// absl::optional is a typedef of std::optional, use the feature macro
// ABSL_USES_STD_OPTIONAL.