Commit 41a6263f by Abseil Team Committed by Andy Getz

Export of internal Abseil changes

--
dcd4d95f6201dc5781a3a374be8eb10c812fd98a by Derek Mauro <dmauro@google.com>:

Add -Wundef to GCC warnings

PiperOrigin-RevId: 322388155

--
b030746368262aff6bc487f5525bcd9b32d18ebb by Abseil Team <absl-team@google.com>:

Google internal clean-up.

PiperOrigin-RevId: 322381901

--
18e4cfcd50730c493cfc0cf1e127e57c186ce90b by Evan Brown <ezb@google.com>:

Rollback b-tree erase simplification change.

PiperOrigin-RevId: 322368252

--
d15431c52fa7ccb25ffbd967fd11f8f58246d48a by Abseil Team <absl-team@google.com>:

Update MOCK_METHOD (new format) in memory/memory_test.cc

PiperOrigin-RevId: 322208282
GitOrigin-RevId: dcd4d95f6201dc5781a3a374be8eb10c812fd98a
Change-Id: I3a900b4993f86bdd1c9597819c7a0e6e1759eda3
parent 3c2bed2e
......@@ -41,7 +41,7 @@
#endif
// -----------------------------------------------------------------------------
// Compiler Check
// Toolchain Check
// -----------------------------------------------------------------------------
// We support MSVC++ 14.0 update 2 and later.
......
......@@ -429,6 +429,13 @@ struct map_slot_policy {
std::move(src->value));
}
}
template <class Allocator>
static void move(Allocator* alloc, slot_type* first, slot_type* last,
slot_type* result) {
for (slot_type *src = first, *dest = result; src != last; ++src, ++dest)
move(alloc, src, dest);
}
};
} // namespace container_internal
......
......@@ -81,6 +81,7 @@ list(APPEND ABSL_GCC_FLAGS
"-Wmissing-declarations"
"-Woverlength-strings"
"-Wpointer-arith"
"-Wundef"
"-Wunused-local-typedefs"
"-Wunused-result"
"-Wvarargs"
......
......@@ -82,6 +82,7 @@ ABSL_GCC_FLAGS = [
"-Wmissing-declarations",
"-Woverlength-strings",
"-Wpointer-arith",
"-Wundef",
"-Wunused-local-typedefs",
"-Wunused-result",
"-Wvarargs",
......
......@@ -128,6 +128,7 @@ COPT_VARS = {
"-Wmissing-declarations",
"-Woverlength-strings",
"-Wpointer-arith",
"-Wundef",
"-Wunused-local-typedefs",
"-Wunused-result",
"-Wvarargs",
......
......@@ -17,6 +17,7 @@
#include "absl/memory/memory.h"
#include <sys/types.h>
#include <cstddef>
#include <memory>
#include <string>
......@@ -36,10 +37,10 @@ using ::testing::Return;
// been called, via the instance_count variable.
class DestructorVerifier {
public:
DestructorVerifier() { ++instance_count_; }
DestructorVerifier() { ++instance_count_; }
DestructorVerifier(const DestructorVerifier&) = delete;
DestructorVerifier& operator=(const DestructorVerifier&) = delete;
~DestructorVerifier() { --instance_count_; }
~DestructorVerifier() { --instance_count_; }
// The number of instances of this class currently active.
static int instance_count() { return instance_count_; }
......@@ -156,9 +157,7 @@ struct ArrayWatch {
allocs().push_back(n);
return ::operator new[](n);
}
void operator delete[](void* p) {
return ::operator delete[](p);
}
void operator delete[](void* p) { return ::operator delete[](p); }
static std::vector<size_t>& allocs() {
static auto& v = *new std::vector<size_t>;
return v;
......@@ -171,8 +170,7 @@ TEST(Make_UniqueTest, Array) {
ArrayWatch::allocs().clear();
auto p = absl::make_unique<ArrayWatch[]>(5);
static_assert(std::is_same<decltype(p),
std::unique_ptr<ArrayWatch[]>>::value,
static_assert(std::is_same<decltype(p), std::unique_ptr<ArrayWatch[]>>::value,
"unexpected return type");
EXPECT_THAT(ArrayWatch::allocs(), ElementsAre(5 * sizeof(ArrayWatch)));
}
......@@ -181,7 +179,7 @@ TEST(Make_UniqueTest, NotAmbiguousWithStdMakeUnique) {
// Ensure that absl::make_unique is not ambiguous with std::make_unique.
// In C++14 mode, the below call to make_unique has both types as candidates.
struct TakesStdType {
explicit TakesStdType(const std::vector<int> &vec) {}
explicit TakesStdType(const std::vector<int>& vec) {}
};
using absl::make_unique;
(void)make_unique<TakesStdType>(std::vector<int>());
......@@ -541,8 +539,8 @@ struct MinimalMockAllocator {
MinimalMockAllocator(const MinimalMockAllocator& other)
: value(other.value) {}
using value_type = TestValue;
MOCK_METHOD1(allocate, value_type*(size_t));
MOCK_METHOD2(deallocate, void(value_type*, size_t));
MOCK_METHOD(value_type*, allocate, (size_t));
MOCK_METHOD(void, deallocate, (value_type*, size_t));
int value;
};
......@@ -579,13 +577,14 @@ struct FullMockAllocator {
explicit FullMockAllocator(int value) : value(value) {}
FullMockAllocator(const FullMockAllocator& other) : value(other.value) {}
using value_type = TestValue;
MOCK_METHOD1(allocate, value_type*(size_t));
MOCK_METHOD2(allocate, value_type*(size_t, const void*));
MOCK_METHOD2(construct, void(value_type*, int*));
MOCK_METHOD1(destroy, void(value_type*));
MOCK_CONST_METHOD0(max_size, size_t());
MOCK_CONST_METHOD0(select_on_container_copy_construction,
FullMockAllocator());
MOCK_METHOD(value_type*, allocate, (size_t));
MOCK_METHOD(value_type*, allocate, (size_t, const void*));
MOCK_METHOD(void, construct, (value_type*, int*));
MOCK_METHOD(void, destroy, (value_type*));
MOCK_METHOD(size_t, max_size, (),
(const));
MOCK_METHOD(FullMockAllocator, select_on_container_copy_construction, (),
(const));
int value;
};
......@@ -642,8 +641,7 @@ TEST(AllocatorNoThrowTest, CustomAllocator) {
struct CanThrowAllocator {
using is_nothrow = std::false_type;
};
struct UnspecifiedAllocator {
};
struct UnspecifiedAllocator {};
EXPECT_TRUE(absl::allocator_is_nothrow<NoThrowAllocator>::value);
EXPECT_FALSE(absl::allocator_is_nothrow<CanThrowAllocator>::value);
EXPECT_FALSE(absl::allocator_is_nothrow<UnspecifiedAllocator>::value);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment