aboutsummaryrefslogtreecommitdiffhomepage
path: root/absl/types
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2019-10-30 08:00:44 -0700
committerGravatar vslashg <gfalcon@google.com>2019-10-30 11:13:04 -0400
commit8207907f4f7fbaeeaa2b7340c76875e06fd345ba (patch)
treea39a472bf9fe7f7c48acbee0f7b8bf1a75a8ea9f /absl/types
parent078b89b3c046d230ef3ad39494e5852184eb528b (diff)
Export of internal Abseil changes
-- 2f49cb9009386bc67bf54a2908c8720b749c8b7f by Greg Falcon <gfalcon@google.com>: docs: fix typo Import of https://github.com/abseil/abseil-cpp/pull/397 PiperOrigin-RevId: 277504420 -- f2bed362c1c12d3fa9c22d11f2b918668e8c37b7 by Abseil Team <absl-team@google.com>: Avoid our is_[copy/move]_assignable workarounds in MSVC 19.20 and on, since that release introduces a regression that breaks our workaround. We should ideally use the std forms in more cases, but branching when our workarounds fail is simpler to maintain. PiperOrigin-RevId: 277502334 -- e33de894ffd49848b9e088f59acc9743d1661948 by Derek Mauro <dmauro@google.com>: Update rules_cc version. The mirror.bazel.build URL does not exist (cache expiration?) PiperOrigin-RevId: 277498394 -- b23757b0747c64634d2d701433782c969effef19 by Abseil Team <absl-team@google.com>: Fix https://github.com/abseil/abseil-cpp/issues/394. PiperOrigin-RevId: 277491405 -- 54c75b8b29813531c52d67cf0ba7063baae4a4f3 by Abseil Team <absl-team@google.com>: Fix comment typos: waker => waiter. PiperOrigin-RevId: 277376952 -- 874eeaa3b3af808fc88b6355245f643674f5e36e by Abseil Team <absl-team@google.com>: Don't use atomic ops on waiter and wakeup counts in CONDVAR waiter mode. Just guard the waiter and wakeup counts with the mutex. This eliminates the race. Also fix a typo in the error message for pthread_cond_timedwait. PiperOrigin-RevId: 277366017 -- ce8c9a63109214519b5a7eaecef2c663c4d566df by Greg Falcon <gfalcon@google.com>: Implement the config options for our four main C++ forward compatibility types. These options control whether the names `any`, `optional`, `string_view`, and `variant` in namespace `absl` are aliases to the corresponding C++17 types in namespace `std`. By default, we continue to auto-detect the configuration of the compiler being run. These options are not intended to be modified on the command line (as -D flags, say). Instead, the options.h file can be modified by distributors of Abseil (e.g., binary packagers, maintainers of local copies of Abseil, etc.) Changing options will change Abseil in an ODR sense. Any program must only link in a single version of Abseil. Linking libraries that use Abseil configured with different options is an error: there is no ABI compatibility guarantee when linking different configurations, even if the Abseil versions used are otherwise exactly identical. PiperOrigin-RevId: 277364298 -- 5ed3ad42ae43a05862070f92f9ffd07f5c1f2b81 by Chris Kennelly <ckennelly@google.com>: Suppress -Wimplicit-int-float-conversion. On recent builds of Clang, this is an error/warning. PiperOrigin-RevId: 277346168 -- 9b9b0055243c705189bb27d912e6d45a7789cdee by Eric Fiselier <ericwf@google.com>: Allow building Abseil as a shared library with CMake. By default CMake's `add_library` creates the target as a static library. However, users can override the default using the builtin CMake option -DBUILD_SHARED_LIBS=ON. This changes Abseil's CMake to respect this configuration option by removing the explicit `STATIC` in our usages of `add_library`. PiperOrigin-RevId: 277337753 -- 63a8b7b8ede3a9d851916929d6b8537f4f2508ca by Abseil Team <absl-team@google.com>: Improve AlphaNum Hex performance by using absl::numbers_internal::FastHexToBufferZeroPad16. PiperOrigin-RevId: 277318108 -- dd047f7e92032682d94b27732df0e4d0670e24a4 by CJ Johnson <johnsoncj@google.com>: Internal change PiperOrigin-RevId: 277316913 -- d19ee7074929fed08973cc5b40a844573ce1e0a6 by Abseil Team <absl-team@google.com>: Handle invoking [[nodiscard]] functions correctly in our tests. PiperOrigin-RevId: 277301500 -- 5373f3737894ba9b8481e95e5f58c7957c00d26a by Chris Kennelly <ckennelly@google.com>: For internal reasons, loosen visibility restrictions of `//absl/base:malloc_internal`. As an internal-namespace interface, this module remains unsupported. We reserve the right to change, delete, or re-restrict visibility to this target at any time. PiperOrigin-RevId: 277118689 -- 44e4f6655e05393a375d09b3625c192b1fde5909 by Abseil Team <absl-team@google.com>: Fix error in example civil day comment. PiperOrigin-RevId: 277103315 -- 7657392b4ce48469106f11cdb952a0bc76a28df3 by Abseil Team <absl-team@google.com>: Internal change PiperOrigin-RevId: 277056076 -- c75bda76f40b01fa249b75b5a70c1f5907e56c76 by Abseil Team <absl-team@google.com>: Suppress lifetime constant-initialization tests when building with MSVC versions > 19.0. These are broken due to non-compliant initialization order in these versions: https://developercommunity.visualstudio.com/content/problem/336946/class-with-constexpr-constructor-not-using-static.html We don't know when Microsoft will fix this bug. PiperOrigin-RevId: 277049770 -- 16c3b9bf2a1796efa57f97b00bcd6227fbccca1f by Matt Calabrese <calabrese@google.com>: Avoid our is_[copy/move]_assignable workarounds in MSVC 19.20 and on, since that release introduces a regression that breaks our workaround. We should ideally use the std forms in more cases, but branching when our workarounds fail is simpler to maintain. PiperOrigin-RevId: 277048670 -- e91003fa3ee6026d9b80624a23fc144fa5d74810 by Chris Kennelly <ckennelly@google.com>: Fix -Wimplicit-int-float-conversion warning in latest clang PiperOrigin-RevId: 276771618 -- 53087ca6603e86ad815f3dd9ab795cc0f79792c1 by Andy Soffer <asoffer@google.com>: Add documentation on absl::SNPrintF. PiperOrigin-RevId: 276694032 -- a9426af8cbd4c3a8f9053e7446c821852e41ff61 by Jorg Brown <jorg@google.com>: Stop including kern/OSByteOrder.h in order to support __APPLE__ Apple compiles with clang now anyway, and clang has support for the built-in compiler swap functions that are much faster than any function call to the OS. PiperOrigin-RevId: 276625231 -- df974be5aa5b4dc1b09c356cb8816edfc7867e63 by Jorg Brown <jorg@google.com>: Fix the build for Android x86-64 builds, where __SSE4_2__ is defined but _bswap64 is not. PiperOrigin-RevId: 276542642 -- d99dc092b3a5ad17643005e55f3b3cb6b9187ccc by Jorg Brown <jorg@google.com>: Remove a byteswap from the non-SSE path of FastHexToBufferZeroPad16 Remove the need for including absl/base/internal/endian.h from the SSE case (since if we have the Intel SSE intrinsics, then clearly we also have the Intel Byte-Swap intrinsics.) PiperOrigin-RevId: 276532608 -- d67b106dc930d8558810ae3983613bb2ab1e0d36 by Abseil Team <absl-team@google.com>: Use explicit static_cast<double> for int64_t to double conversion This uses an explicit static_cast<double>() in the int64_t to double comparisons in duration.cc's SafeAddRepHi. This satisfies clang's -Wimplicit-int-to-float-conversion warning (with https://reviews.llvm.org/D64666). This may also make it easier for humans to realize that the comparison is happening between two floating point double precision values. It should have no impact on the behavior or generated code. Tested: No behavior change PiperOrigin-RevId: 276529211 GitOrigin-RevId: 2f49cb9009386bc67bf54a2908c8720b749c8b7f Change-Id: I71e0781893ce219960b8290d54b20532779cb0ff
Diffstat (limited to 'absl/types')
-rw-r--r--absl/types/any.h6
-rw-r--r--absl/types/any_exception_safety_test.cc4
-rw-r--r--absl/types/any_test.cc10
-rw-r--r--absl/types/bad_any_cast.cc4
-rw-r--r--absl/types/bad_any_cast.h6
-rw-r--r--absl/types/bad_optional_access.cc4
-rw-r--r--absl/types/bad_optional_access.h6
-rw-r--r--absl/types/bad_variant_access.cc4
-rw-r--r--absl/types/bad_variant_access.h6
-rw-r--r--absl/types/internal/variant.h4
-rw-r--r--absl/types/optional.h6
-rw-r--r--absl/types/optional_exception_safety_test.cc4
-rw-r--r--absl/types/optional_test.cc20
-rw-r--r--absl/types/variant.h6
-rw-r--r--absl/types/variant_exception_safety_test.cc16
-rw-r--r--absl/types/variant_test.cc34
16 files changed, 70 insertions, 70 deletions
diff --git a/absl/types/any.h b/absl/types/any.h
index 507c8b2..f796769 100644
--- a/absl/types/any.h
+++ b/absl/types/any.h
@@ -56,7 +56,7 @@
#include "absl/base/config.h"
#include "absl/utility/utility.h"
-#ifdef ABSL_HAVE_STD_ANY
+#ifdef ABSL_USES_STD_ANY
#include <any> // IWYU pragma: export
@@ -67,7 +67,7 @@ using std::bad_any_cast;
using std::make_any;
} // namespace absl
-#else // ABSL_HAVE_STD_ANY
+#else // ABSL_USES_STD_ANY
#include <algorithm>
#include <cstddef>
@@ -538,6 +538,6 @@ T* any_cast(any* operand) noexcept {
#undef ABSL_ANY_DETAIL_HAS_RTTI
-#endif // ABSL_HAVE_STD_ANY
+#endif // ABSL_USES_STD_ANY
#endif // ABSL_TYPES_ANY_H_
diff --git a/absl/types/any_exception_safety_test.cc b/absl/types/any_exception_safety_test.cc
index 17d7f5d..31c1140 100644
--- a/absl/types/any_exception_safety_test.cc
+++ b/absl/types/any_exception_safety_test.cc
@@ -18,7 +18,7 @@
// This test is a no-op when absl::any is an alias for std::any and when
// exceptions are not enabled.
-#if !defined(ABSL_HAVE_STD_ANY) && defined(ABSL_HAVE_EXCEPTIONS)
+#if !defined(ABSL_USES_STD_ANY) && defined(ABSL_HAVE_EXCEPTIONS)
#include <typeinfo>
#include <vector>
@@ -170,4 +170,4 @@ TEST(AnyExceptionSafety, Emplace) {
} // namespace
-#endif // #if !defined(ABSL_HAVE_STD_ANY) && defined(ABSL_HAVE_EXCEPTIONS)
+#endif // #if !defined(ABSL_USES_STD_ANY) && defined(ABSL_HAVE_EXCEPTIONS)
diff --git a/absl/types/any_test.cc b/absl/types/any_test.cc
index 4a848ae..70e4ba2 100644
--- a/absl/types/any_test.cc
+++ b/absl/types/any_test.cc
@@ -15,7 +15,7 @@
#include "absl/types/any.h"
// This test is a no-op when absl::any is an alias for std::any.
-#if !defined(ABSL_HAVE_STD_ANY)
+#if !defined(ABSL_USES_STD_ANY)
#include <initializer_list>
#include <type_traits>
@@ -642,7 +642,7 @@ TEST(AnyTest, ConversionConstructionCausesOneCopy) {
// Tests for Exception Behavior //
//////////////////////////////////
-#if defined(ABSL_HAVE_STD_ANY)
+#if defined(ABSL_USES_STD_ANY)
// If using a std `any` implementation, we can't check for a specific message.
#define ABSL_ANY_TEST_EXPECT_BAD_ANY_CAST(...) \
@@ -656,7 +656,7 @@ TEST(AnyTest, ConversionConstructionCausesOneCopy) {
ABSL_BASE_INTERNAL_EXPECT_FAIL((__VA_ARGS__), absl::bad_any_cast, \
"Bad any cast")
-#endif // defined(ABSL_HAVE_STD_ANY)
+#endif // defined(ABSL_USES_STD_ANY)
TEST(AnyTest, ThrowBadAlloc) {
{
@@ -764,7 +764,7 @@ TEST(AnyTest, FailedEmplace) {
BadCopyable bad;
absl::any target(absl::in_place_type<int>);
ABSL_ANY_TEST_EXPECT_BAD_COPY(target.emplace<BadCopyable>(bad));
-#if defined(ABSL_HAVE_STD_ANY) && defined(__GLIBCXX__)
+#if defined(ABSL_USES_STD_ANY) && defined(__GLIBCXX__)
// libstdc++ std::any::emplace() implementation (as of 7.2) has a bug: if an
// exception is thrown, *this contains a value.
#define ABSL_GLIBCXX_ANY_EMPLACE_EXCEPTION_BUG 1
@@ -778,4 +778,4 @@ TEST(AnyTest, FailedEmplace) {
} // namespace
-#endif // #if !defined(ABSL_HAVE_STD_ANY)
+#endif // #if !defined(ABSL_USES_STD_ANY)
diff --git a/absl/types/bad_any_cast.cc b/absl/types/bad_any_cast.cc
index 505919a..2a53812 100644
--- a/absl/types/bad_any_cast.cc
+++ b/absl/types/bad_any_cast.cc
@@ -14,7 +14,7 @@
#include "absl/types/bad_any_cast.h"
-#ifndef ABSL_HAVE_STD_ANY
+#ifndef ABSL_USES_STD_ANY
#include <cstdlib>
@@ -41,4 +41,4 @@ void ThrowBadAnyCast() {
} // namespace any_internal
} // namespace absl
-#endif // ABSL_HAVE_STD_ANY
+#endif // ABSL_USES_STD_ANY
diff --git a/absl/types/bad_any_cast.h b/absl/types/bad_any_cast.h
index 8d020ed..6a53c01 100644
--- a/absl/types/bad_any_cast.h
+++ b/absl/types/bad_any_cast.h
@@ -25,7 +25,7 @@
#include "absl/base/config.h"
-#ifdef ABSL_HAVE_STD_ANY
+#ifdef ABSL_USES_STD_ANY
#include <any>
@@ -33,7 +33,7 @@ namespace absl {
using std::bad_any_cast;
} // namespace absl
-#else // ABSL_HAVE_STD_ANY
+#else // ABSL_USES_STD_ANY
namespace absl {
@@ -66,6 +66,6 @@ namespace any_internal {
} // namespace any_internal
} // namespace absl
-#endif // ABSL_HAVE_STD_ANY
+#endif // ABSL_USES_STD_ANY
#endif // ABSL_TYPES_BAD_ANY_CAST_H_
diff --git a/absl/types/bad_optional_access.cc b/absl/types/bad_optional_access.cc
index a791c7c..d9ec21b 100644
--- a/absl/types/bad_optional_access.cc
+++ b/absl/types/bad_optional_access.cc
@@ -14,7 +14,7 @@
#include "absl/types/bad_optional_access.h"
-#ifndef ABSL_HAVE_STD_OPTIONAL
+#ifndef ABSL_USES_STD_OPTIONAL
#include <cstdlib>
@@ -43,4 +43,4 @@ void throw_bad_optional_access() {
} // namespace optional_internal
} // namespace absl
-#endif // ABSL_HAVE_STD_OPTIONAL
+#endif // ABSL_USES_STD_OPTIONAL
diff --git a/absl/types/bad_optional_access.h b/absl/types/bad_optional_access.h
index add5c45..32dd6a9 100644
--- a/absl/types/bad_optional_access.h
+++ b/absl/types/bad_optional_access.h
@@ -25,7 +25,7 @@
#include "absl/base/config.h"
-#ifdef ABSL_HAVE_STD_OPTIONAL
+#ifdef ABSL_USES_STD_OPTIONAL
#include <optional>
@@ -33,7 +33,7 @@ namespace absl {
using std::bad_optional_access;
} // namespace absl
-#else // ABSL_HAVE_STD_OPTIONAL
+#else // ABSL_USES_STD_OPTIONAL
namespace absl {
@@ -69,6 +69,6 @@ namespace optional_internal {
} // namespace optional_internal
} // namespace absl
-#endif // ABSL_HAVE_STD_OPTIONAL
+#endif // ABSL_USES_STD_OPTIONAL
#endif // ABSL_TYPES_BAD_OPTIONAL_ACCESS_H_
diff --git a/absl/types/bad_variant_access.cc b/absl/types/bad_variant_access.cc
index a4325c8..dbaea9e 100644
--- a/absl/types/bad_variant_access.cc
+++ b/absl/types/bad_variant_access.cc
@@ -14,7 +14,7 @@
#include "absl/types/bad_variant_access.h"
-#ifndef ABSL_HAVE_STD_VARIANT
+#ifndef ABSL_USES_STD_VARIANT
#include <cstdlib>
#include <stdexcept>
@@ -59,4 +59,4 @@ void Rethrow() {
} // namespace variant_internal
} // namespace absl
-#endif // ABSL_HAVE_STD_VARIANT
+#endif // ABSL_USES_STD_VARIANT
diff --git a/absl/types/bad_variant_access.h b/absl/types/bad_variant_access.h
index 637db43..6935d01 100644
--- a/absl/types/bad_variant_access.h
+++ b/absl/types/bad_variant_access.h
@@ -25,7 +25,7 @@
#include "absl/base/config.h"
-#ifdef ABSL_HAVE_STD_VARIANT
+#ifdef ABSL_USES_STD_VARIANT
#include <variant>
@@ -33,7 +33,7 @@ namespace absl {
using std::bad_variant_access;
} // namespace absl
-#else // ABSL_HAVE_STD_VARIANT
+#else // ABSL_USES_STD_VARIANT
namespace absl {
@@ -73,6 +73,6 @@ namespace variant_internal {
} // namespace variant_internal
} // namespace absl
-#endif // ABSL_HAVE_STD_VARIANT
+#endif // ABSL_USES_STD_VARIANT
#endif // ABSL_TYPES_BAD_VARIANT_ACCESS_H_
diff --git a/absl/types/internal/variant.h b/absl/types/internal/variant.h
index 19de2e1..58b3859 100644
--- a/absl/types/internal/variant.h
+++ b/absl/types/internal/variant.h
@@ -37,7 +37,7 @@
#include "absl/types/bad_variant_access.h"
#include "absl/utility/utility.h"
-#if !defined(ABSL_HAVE_STD_VARIANT)
+#if !defined(ABSL_USES_STD_VARIANT)
namespace absl {
@@ -1640,5 +1640,5 @@ struct VariantHashBase<Variant,
} // namespace variant_internal
} // namespace absl
-#endif // !defined(ABSL_HAVE_STD_VARIANT)
+#endif // !defined(ABSL_USES_STD_VARIANT)
#endif // ABSL_TYPES_variant_internal_H_
diff --git a/absl/types/optional.h b/absl/types/optional.h
index ed8faf9..1403259 100644
--- a/absl/types/optional.h
+++ b/absl/types/optional.h
@@ -38,7 +38,7 @@
#include "absl/base/config.h" // TODO(calabrese) IWYU removal?
#include "absl/utility/utility.h"
-#ifdef ABSL_HAVE_STD_OPTIONAL
+#ifdef ABSL_USES_STD_OPTIONAL
#include <optional> // IWYU pragma: export
@@ -50,7 +50,7 @@ using std::nullopt_t;
using std::nullopt;
} // namespace absl
-#else // ABSL_HAVE_STD_OPTIONAL
+#else // ABSL_USES_STD_OPTIONAL
#include <cassert>
#include <functional>
@@ -767,6 +767,6 @@ struct hash<absl::optional<T> >
#undef ABSL_MSVC_CONSTEXPR_BUG_IN_UNION_LIKE_CLASS
-#endif // ABSL_HAVE_STD_OPTIONAL
+#endif // ABSL_USES_STD_OPTIONAL
#endif // ABSL_TYPES_OPTIONAL_H_
diff --git a/absl/types/optional_exception_safety_test.cc b/absl/types/optional_exception_safety_test.cc
index f99e35c..0f7fae6 100644
--- a/absl/types/optional_exception_safety_test.cc
+++ b/absl/types/optional_exception_safety_test.cc
@@ -18,7 +18,7 @@
// This test is a no-op when absl::optional is an alias for std::optional and
// when exceptions are not enabled.
-#if !defined(ABSL_HAVE_STD_OPTIONAL) && defined(ABSL_HAVE_EXCEPTIONS)
+#if !defined(ABSL_USES_STD_OPTIONAL) && defined(ABSL_HAVE_EXCEPTIONS)
#include "gtest/gtest.h"
#include "absl/base/internal/exception_safety_testing.h"
@@ -287,4 +287,4 @@ TEST(OptionalExceptionSafety, NothrowMoveAssign) {
} // namespace absl
-#endif // #if !defined(ABSL_HAVE_STD_OPTIONAL) && defined(ABSL_HAVE_EXCEPTIONS)
+#endif // #if !defined(ABSL_USES_STD_OPTIONAL) && defined(ABSL_HAVE_EXCEPTIONS)
diff --git a/absl/types/optional_test.cc b/absl/types/optional_test.cc
index 35efa86..47d5c8a 100644
--- a/absl/types/optional_test.cc
+++ b/absl/types/optional_test.cc
@@ -15,7 +15,7 @@
#include "absl/types/optional.h"
// This test is a no-op when absl::optional is an alias for std::optional.
-#if !defined(ABSL_HAVE_STD_OPTIONAL)
+#if !defined(ABSL_USES_STD_OPTIONAL)
#include <string>
#include <type_traits>
@@ -224,7 +224,7 @@ TEST(optionalTest, CopyConstructor) {
EXPECT_FALSE(
absl::is_trivially_copy_constructible<absl::optional<Copyable>>::value);
-#if defined(ABSL_HAVE_STD_OPTIONAL) && defined(__GLIBCXX__)
+#if defined(ABSL_USES_STD_OPTIONAL) && defined(__GLIBCXX__)
// libstdc++ std::optional implementation (as of 7.2) has a bug: when T is
// trivially copyable, optional<T> is not trivially copyable (due to one of
// its base class is unconditionally nontrivial).
@@ -279,7 +279,7 @@ TEST(optionalTest, CopyConstructor) {
// std::optional when T is volatile-qualified. So skipping this test.
// Bug report:
// https://connect.microsoft.com/VisualStudio/feedback/details/3142534
-#if defined(ABSL_HAVE_STD_OPTIONAL) && defined(_MSC_VER) && _MSC_VER >= 1911
+#if defined(ABSL_USES_STD_OPTIONAL) && defined(_MSC_VER) && _MSC_VER >= 1911
#define ABSL_MSVC_OPTIONAL_VOLATILE_COPY_BUG 1
#endif
#ifndef ABSL_MSVC_OPTIONAL_VOLATILE_COPY_BUG
@@ -305,7 +305,7 @@ TEST(optionalTest, MoveConstructor) {
EXPECT_FALSE(std::is_move_constructible<absl::optional<NonMovable>>::value);
// test noexcept
EXPECT_TRUE(std::is_nothrow_move_constructible<absl::optional<int>>::value);
-#ifndef ABSL_HAVE_STD_OPTIONAL
+#ifndef ABSL_USES_STD_OPTIONAL
EXPECT_EQ(
absl::default_allocator_is_nothrow::value,
std::is_nothrow_move_constructible<absl::optional<MoveableThrow>>::value);
@@ -639,7 +639,7 @@ TEST(optionalTest, CopyAssignment) {
EXPECT_FALSE(absl::is_trivially_copy_assignable<NonTrivial>::value);
// std::optional doesn't support volatile nontrivial types.
-#ifndef ABSL_HAVE_STD_OPTIONAL
+#ifndef ABSL_USES_STD_OPTIONAL
{
StructorListener listener;
Listenable::listener = &listener;
@@ -658,7 +658,7 @@ TEST(optionalTest, CopyAssignment) {
EXPECT_EQ(1, listener.destruct);
EXPECT_EQ(1, listener.volatile_copy_assign);
}
-#endif // ABSL_HAVE_STD_OPTIONAL
+#endif // ABSL_USES_STD_OPTIONAL
}
TEST(optionalTest, MoveAssignment) {
@@ -682,7 +682,7 @@ TEST(optionalTest, MoveAssignment) {
EXPECT_EQ(1, listener.move_assign);
}
// std::optional doesn't support volatile nontrivial types.
-#ifndef ABSL_HAVE_STD_OPTIONAL
+#ifndef ABSL_USES_STD_OPTIONAL
{
StructorListener listener;
Listenable::listener = &listener;
@@ -702,7 +702,7 @@ TEST(optionalTest, MoveAssignment) {
EXPECT_EQ(1, listener.destruct);
EXPECT_EQ(1, listener.volatile_move_assign);
}
-#endif // ABSL_HAVE_STD_OPTIONAL
+#endif // ABSL_USES_STD_OPTIONAL
EXPECT_FALSE(absl::is_move_assignable<absl::optional<const int>>::value);
EXPECT_TRUE(absl::is_move_assignable<absl::optional<Copyable>>::value);
EXPECT_TRUE(absl::is_move_assignable<absl::optional<MoveableThrow>>::value);
@@ -1560,7 +1560,7 @@ TEST(optionalTest, NoExcept) {
static_assert(
std::is_nothrow_move_constructible<absl::optional<MoveMeNoThrow>>::value,
"");
-#ifndef ABSL_HAVE_STD_OPTIONAL
+#ifndef ABSL_USES_STD_OPTIONAL
static_assert(absl::default_allocator_is_nothrow::value ==
std::is_nothrow_move_constructible<
absl::optional<MoveMeThrow>>::value,
@@ -1658,4 +1658,4 @@ TEST(optionalTest, InPlaceTSFINAEBug) {
} // namespace
-#endif // #if !defined(ABSL_HAVE_STD_OPTIONAL)
+#endif // #if !defined(ABSL_USES_STD_OPTIONAL)
diff --git a/absl/types/variant.h b/absl/types/variant.h
index 7ef7f88..f355870 100644
--- a/absl/types/variant.h
+++ b/absl/types/variant.h
@@ -45,7 +45,7 @@
#include "absl/base/config.h"
#include "absl/utility/utility.h"
-#ifdef ABSL_HAVE_STD_VARIANT
+#ifdef ABSL_USES_STD_VARIANT
#include <variant> // IWYU pragma: export
@@ -64,7 +64,7 @@ using std::variant_size_v;
using std::visit;
} // namespace absl
-#else // ABSL_HAVE_STD_VARIANT
+#else // ABSL_USES_STD_VARIANT
#include <functional>
#include <new>
@@ -812,7 +812,7 @@ struct hash<absl::variant<T...>>
} // namespace std
-#endif // ABSL_HAVE_STD_VARIANT
+#endif // ABSL_USES_STD_VARIANT
namespace absl {
namespace variant_internal {
diff --git a/absl/types/variant_exception_safety_test.cc b/absl/types/variant_exception_safety_test.cc
index fd7e6c7..b486a71 100644
--- a/absl/types/variant_exception_safety_test.cc
+++ b/absl/types/variant_exception_safety_test.cc
@@ -18,7 +18,7 @@
// This test is a no-op when absl::variant is an alias for std::variant and when
// exceptions are not enabled.
-#if !defined(ABSL_HAVE_STD_VARIANT) && defined(ABSL_HAVE_EXCEPTIONS)
+#if !defined(ABSL_USES_STD_VARIANT) && defined(ABSL_HAVE_EXCEPTIONS)
#include <iostream>
#include <memory>
@@ -237,7 +237,7 @@ TEST(VariantExceptionSafetyTest, CopyAssign) {
}
// libstdc++ std::variant has bugs on copy assignment regarding exception
// safety.
-#if !(defined(ABSL_HAVE_STD_VARIANT) && defined(__GLIBCXX__))
+#if !(defined(ABSL_USES_STD_VARIANT) && defined(__GLIBCXX__))
// index() != j
// if is_nothrow_copy_constructible_v<Tj> or
// !is_nothrow_move_constructible<Tj> is true, equivalent to
@@ -268,7 +268,7 @@ TEST(VariantExceptionSafetyTest, CopyAssign) {
.Test());
EXPECT_FALSE(tester.WithContracts(strong_guarantee).Test());
}
-#endif // !(defined(ABSL_HAVE_STD_VARIANT) && defined(__GLIBCXX__))
+#endif // !(defined(ABSL_USES_STD_VARIANT) && defined(__GLIBCXX__))
{
// is_nothrow_copy_constructible_v<Tj> == false &&
// is_nothrow_move_constructible_v<Tj> == true
@@ -325,7 +325,7 @@ TEST(VariantExceptionSafetyTest, MoveAssign) {
// The fix is targeted for gcc-9.
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431#c7
// https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=267614
-#if !(defined(ABSL_HAVE_STD_VARIANT) && \
+#if !(defined(ABSL_USES_STD_VARIANT) && \
defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE == 8)
// - otherwise (index() != j), equivalent to
// emplace<j>(get<j>(std::move(rhs)))
@@ -342,7 +342,7 @@ TEST(VariantExceptionSafetyTest, MoveAssign) {
auto copy = rhs;
*lhs = std::move(copy);
}));
-#endif // !(defined(ABSL_HAVE_STD_VARIANT) &&
+#endif // !(defined(ABSL_USES_STD_VARIANT) &&
// defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE == 8)
}
}
@@ -445,7 +445,7 @@ TEST(VariantExceptionSafetyTest, ValueAssign) {
// and operator=(variant&&) invokes Tj's move ctor which doesn't throw.
// libstdc++ std::variant has bugs on conversion assignment regarding
// exception safety.
-#if !(defined(ABSL_HAVE_STD_VARIANT) && defined(__GLIBCXX__))
+#if !(defined(ABSL_USES_STD_VARIANT) && defined(__GLIBCXX__))
{
MoveNothrow rhs;
EXPECT_TRUE(MakeExceptionSafetyTester()
@@ -453,7 +453,7 @@ TEST(VariantExceptionSafetyTest, ValueAssign) {
.WithContracts(VariantInvariants, strong_guarantee)
.Test([&rhs](ThrowingVariant* lhs) { *lhs = rhs; }));
}
-#endif // !(defined(ABSL_HAVE_STD_VARIANT) && defined(__GLIBCXX__))
+#endif // !(defined(ABSL_USES_STD_VARIANT) && defined(__GLIBCXX__))
}
TEST(VariantExceptionSafetyTest, Emplace) {
@@ -527,4 +527,4 @@ TEST(VariantExceptionSafetyTest, Swap) {
#endif // !defined(ABSL_INTERNAL_MSVC_2017_DBG_MODE)
-#endif // #if !defined(ABSL_HAVE_STD_VARIANT) && defined(ABSL_HAVE_EXCEPTIONS)
+#endif // #if !defined(ABSL_USES_STD_VARIANT) && defined(ABSL_HAVE_EXCEPTIONS)
diff --git a/absl/types/variant_test.cc b/absl/types/variant_test.cc
index b591274..2913775 100644
--- a/absl/types/variant_test.cc
+++ b/absl/types/variant_test.cc
@@ -20,7 +20,7 @@
#include "absl/types/variant.h"
// This test is a no-op when absl::variant is an alias for std::variant.
-#if !defined(ABSL_HAVE_STD_VARIANT)
+#if !defined(ABSL_USES_STD_VARIANT)
#include <algorithm>
#include <cstddef>
@@ -842,7 +842,7 @@ TEST(VariantTest, TestBackupAssign) {
}
// libstdc++ doesn't pass this test
-#if !(defined(ABSL_HAVE_STD_VARIANT) && defined(__GLIBCXX__))
+#if !(defined(ABSL_USES_STD_VARIANT) && defined(__GLIBCXX__))
EXPECT_EQ(3, counter[0]);
EXPECT_EQ(2, counter[1]);
EXPECT_EQ(2, counter[2]);
@@ -1933,7 +1933,7 @@ TEST(VariantTest, VisitReferenceWrapper) {
}
// libstdc++ std::variant doesn't support the INVOKE semantics.
-#if !(defined(ABSL_HAVE_STD_VARIANT) && defined(__GLIBCXX__))
+#if !(defined(ABSL_USES_STD_VARIANT) && defined(__GLIBCXX__))
TEST(VariantTest, VisitMemberFunction) {
absl::variant<std::unique_ptr<Class>> p(absl::make_unique<Class>());
absl::variant<std::unique_ptr<const Class>> cp(
@@ -1957,7 +1957,7 @@ TEST(VariantTest, VisitDataMember) {
EXPECT_EQ(42, absl::visit(&Class::member, cp));
}
-#endif // !(defined(ABSL_HAVE_STD_VARIANT) && defined(__GLIBCXX__))
+#endif // !(defined(ABSL_USES_STD_VARIANT) && defined(__GLIBCXX__))
/////////////////////////
// [variant.monostate] //
@@ -2035,7 +2035,7 @@ TEST(VariantTest, NonmemberSwap) {
std::swap(a, b);
EXPECT_THAT(a, VariantWith<SpecialSwap>(v2));
EXPECT_THAT(b, VariantWith<SpecialSwap>(v1));
-#ifndef ABSL_HAVE_STD_VARIANT
+#ifndef ABSL_USES_STD_VARIANT
EXPECT_FALSE(absl::get<SpecialSwap>(a).special_swap);
#endif
@@ -2083,7 +2083,7 @@ TEST(VariantTest, Hash) {
// MSVC std::hash<std::variant> does not use the index, thus produce the same
// result on the same value as different alternative.
-#if !(defined(_MSC_VER) && defined(ABSL_HAVE_STD_VARIANT))
+#if !(defined(_MSC_VER) && defined(ABSL_USES_STD_VARIANT))
{
// same value as different alternative
variant<int, int> v0(in_place_index<0>, 42);
@@ -2091,7 +2091,7 @@ TEST(VariantTest, Hash) {
std::hash<variant<int, int>> hash;
EXPECT_NE(hash(v0), hash(v1));
}
-#endif // !(defined(_MSC_VER) && defined(ABSL_HAVE_STD_VARIANT))
+#endif // !(defined(_MSC_VER) && defined(ABSL_USES_STD_VARIANT))
{
std::hash<variant<int>> hash;
@@ -2118,7 +2118,7 @@ TEST(VariantTest, Hash) {
////////////////////////////////////////
// Test that a set requiring a basic type conversion works correctly
-#if !defined(ABSL_HAVE_STD_VARIANT)
+#if !defined(ABSL_USES_STD_VARIANT)
TEST(VariantTest, TestConvertingSet) {
typedef variant<double> Variant;
Variant v(1.0);
@@ -2128,7 +2128,7 @@ TEST(VariantTest, TestConvertingSet) {
ASSERT_TRUE(nullptr != absl::get_if<double>(&v));
EXPECT_DOUBLE_EQ(2, absl::get<double>(v));
}
-#endif // ABSL_HAVE_STD_VARIANT
+#endif // ABSL_USES_STD_VARIANT
// Test that a vector of variants behaves reasonably.
TEST(VariantTest, Container) {
@@ -2280,7 +2280,7 @@ struct Convertible2 {
};
TEST(VariantTest, TestRvalueConversion) {
-#if !defined(ABSL_HAVE_STD_VARIANT)
+#if !defined(ABSL_USES_STD_VARIANT)
variant<double, std::string> var(
ConvertVariantTo<variant<double, std::string>>(
variant<std::string, int>(0)));
@@ -2313,7 +2313,7 @@ TEST(VariantTest, TestRvalueConversion) {
variant2 = ConvertVariantTo<variant<int32_t, uint32_t>>(variant<uint32_t>(42));
ASSERT_TRUE(absl::holds_alternative<uint32_t>(variant2));
EXPECT_EQ(42, absl::get<uint32_t>(variant2));
-#endif // !ABSL_HAVE_STD_VARIANT
+#endif // !ABSL_USES_STD_VARIANT
variant<Convertible1, Convertible2> variant3(
ConvertVariantTo<variant<Convertible1, Convertible2>>(
@@ -2326,7 +2326,7 @@ TEST(VariantTest, TestRvalueConversion) {
}
TEST(VariantTest, TestLvalueConversion) {
-#if !defined(ABSL_HAVE_STD_VARIANT)
+#if !defined(ABSL_USES_STD_VARIANT)
variant<std::string, int> source1 = 0;
variant<double, std::string> destination(
ConvertVariantTo<variant<double, std::string>>(source1));
@@ -2428,7 +2428,7 @@ TEST(VariantTest, DoesNotMoveFromLvalues) {
}
TEST(VariantTest, TestRvalueConversionViaConvertVariantTo) {
-#if !defined(ABSL_HAVE_STD_VARIANT)
+#if !defined(ABSL_USES_STD_VARIANT)
variant<double, std::string> var(
ConvertVariantTo<variant<double, std::string>>(
variant<std::string, int>(3)));
@@ -2467,7 +2467,7 @@ TEST(VariantTest, TestRvalueConversionViaConvertVariantTo) {
}
TEST(VariantTest, TestLvalueConversionViaConvertVariantTo) {
-#if !defined(ABSL_HAVE_STD_VARIANT)
+#if !defined(ABSL_USES_STD_VARIANT)
variant<std::string, int> source1 = 3;
variant<double, std::string> destination(
ConvertVariantTo<variant<double, std::string>>(source1));
@@ -2499,7 +2499,7 @@ TEST(VariantTest, TestLvalueConversionViaConvertVariantTo) {
variant<uint32_t> source6(42);
variant2 = ConvertVariantTo<variant<int32_t, uint32_t>>(source6);
EXPECT_THAT(absl::get_if<uint32_t>(&variant2), Pointee(42));
-#endif // !ABSL_HAVE_STD_VARIANT
+#endif // !ABSL_USES_STD_VARIANT
variant<Convertible2, Convertible1> source7((Convertible1()));
variant<Convertible1, Convertible2> variant3(
@@ -2533,7 +2533,7 @@ TEST(VariantTest, TestMoveConversionViaConvertVariantTo) {
// standard and we know that libstdc++ variant doesn't have this feature.
// For more details see the paper:
// http://open-std.org/JTC1/SC22/WG21/docs/papers/2017/p0602r0.html
-#if !(defined(ABSL_HAVE_STD_VARIANT) && defined(__GLIBCXX__))
+#if !(defined(ABSL_USES_STD_VARIANT) && defined(__GLIBCXX__))
#define ABSL_VARIANT_PROPAGATE_COPY_MOVE_TRIVIALITY 1
#endif
@@ -2711,4 +2711,4 @@ TEST(VariantTest, MoveCtorBug) {
} // namespace
} // namespace absl
-#endif // #if !defined(ABSL_HAVE_STD_VARIANT)
+#endif // #if !defined(ABSL_USES_STD_VARIANT)