diff options
Diffstat (limited to 'absl/memory')
-rw-r--r-- | absl/memory/BUILD.bazel | 11 | ||||
-rw-r--r-- | absl/memory/CMakeLists.txt | 5 | ||||
-rw-r--r-- | absl/memory/memory.h | 13 | ||||
-rw-r--r-- | absl/memory/memory_exception_safety_test.cc | 13 |
4 files changed, 21 insertions, 21 deletions
diff --git a/absl/memory/BUILD.bazel b/absl/memory/BUILD.bazel index f815ef94..2ba9d7cb 100644 --- a/absl/memory/BUILD.bazel +++ b/absl/memory/BUILD.bazel @@ -1,5 +1,5 @@ # -# Copyright 2017 The Abseil Authors. +# Copyright 2019 The Abseil Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,12 @@ # limitations under the License. # +load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") load( "//absl:copts/configure_copts.bzl", "ABSL_DEFAULT_COPTS", "ABSL_DEFAULT_LINKOPTS", "ABSL_TEST_COPTS", - "ABSL_EXCEPTIONS_FLAG", - "ABSL_EXCEPTIONS_FLAG_LINKOPTS", ) package(default_visibility = ["//visibility:public"]) @@ -45,7 +44,6 @@ cc_test( linkopts = ABSL_DEFAULT_LINKOPTS, deps = [ ":memory", - "//absl/base", "//absl/base:core_headers", "@com_google_googletest//:gtest_main", ], @@ -56,10 +54,11 @@ cc_test( srcs = [ "memory_exception_safety_test.cc", ], - copts = ABSL_TEST_COPTS + ABSL_EXCEPTIONS_FLAG, - linkopts = ABSL_EXCEPTIONS_FLAG_LINKOPTS + ABSL_DEFAULT_LINKOPTS, + copts = ABSL_TEST_COPTS, + linkopts = ABSL_DEFAULT_LINKOPTS, deps = [ ":memory", + "//absl/base:config", "//absl/base:exception_safety_testing", "@com_google_googletest//:gtest_main", ], diff --git a/absl/memory/CMakeLists.txt b/absl/memory/CMakeLists.txt index 0a812203..78fb7e1b 100644 --- a/absl/memory/CMakeLists.txt +++ b/absl/memory/CMakeLists.txt @@ -36,7 +36,6 @@ absl_cc_test( ${ABSL_TEST_COPTS} DEPS absl::memory - absl::base absl::core_headers gmock_main ) @@ -48,11 +47,9 @@ absl_cc_test( "memory_exception_safety_test.cc" COPTS ${ABSL_TEST_COPTS} - ${ABSL_EXCEPTIONS_FLAG} - LINKOPTS - ${ABSL_EXCEPTIONS_FLAG_LINKOPTS} DEPS absl::memory + absl::config absl::exception_safety_testing gmock_main ) diff --git a/absl/memory/memory.h b/absl/memory/memory.h index 7f525e4c..513f7103 100644 --- a/absl/memory/memory.h +++ b/absl/memory/memory.h @@ -34,7 +34,7 @@ #include "absl/meta/type_traits.h" namespace absl { -inline namespace lts_2019_08_08 { +ABSL_NAMESPACE_BEGIN // ----------------------------------------------------------------------------- // Function Template: WrapUnique() @@ -93,11 +93,12 @@ struct MakeUniqueResult<T[N]> { } // namespace memory_internal -// gcc 4.8 has __cplusplus at 201301 but doesn't define make_unique. Other -// supported compilers either just define __cplusplus as 201103 but have -// make_unique (msvc), or have make_unique whenever __cplusplus > 201103 (clang) +// gcc 4.8 has __cplusplus at 201301 but the libstdc++ shipped with it doesn't +// define make_unique. Other supported compilers either just define __cplusplus +// as 201103 but have make_unique (msvc), or have make_unique whenever +// __cplusplus > 201103 (clang). #if (__cplusplus > 201103L || defined(_MSC_VER)) && \ - !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 8) + !(defined(__GLIBCXX__) && !defined(__cpp_lib_make_unique)) using std::make_unique; #else // ----------------------------------------------------------------------------- @@ -688,7 +689,7 @@ void CopyRange(Allocator& alloc, Iterator destination, InputIterator first, } } } // namespace memory_internal -} // inline namespace lts_2019_08_08 +ABSL_NAMESPACE_END } // namespace absl #endif // ABSL_MEMORY_MEMORY_H_ diff --git a/absl/memory/memory_exception_safety_test.cc b/absl/memory/memory_exception_safety_test.cc index f5b39b34..1df72614 100644 --- a/absl/memory/memory_exception_safety_test.cc +++ b/absl/memory/memory_exception_safety_test.cc @@ -14,18 +14,19 @@ #include "absl/memory/memory.h" +#include "absl/base/config.h" + +#ifdef ABSL_HAVE_EXCEPTIONS + #include "gtest/gtest.h" #include "absl/base/internal/exception_safety_testing.h" namespace absl { -inline namespace lts_2019_08_08 { +ABSL_NAMESPACE_BEGIN namespace { constexpr int kLength = 50; using Thrower = testing::ThrowingValue<testing::TypeSpec::kEverythingThrows>; -using ThrowerStorage = - absl::aligned_storage_t<sizeof(Thrower), alignof(Thrower)>; -using ThrowerList = std::array<ThrowerStorage, kLength>; TEST(MakeUnique, CheckForLeaks) { constexpr int kValue = 321; @@ -50,5 +51,7 @@ TEST(MakeUnique, CheckForLeaks) { } } // namespace -} // inline namespace lts_2019_08_08 +ABSL_NAMESPACE_END } // namespace absl + +#endif // ABSL_HAVE_EXCEPTIONS |