Export of internal Abseil changes.
-- a874475e842d2adeb31bb7bd37bdd6eb15a2aeb9 by Mark Barolak <mbar@google.com>: Import of CCTZ from GitHub. PiperOrigin-RevId: 256414250 -- c95e6c21944c59c9b9b9e7eb9dc79cfb9ae5ef8d by CJ Johnson <johnsoncj@google.com>: Update the license year + run clang-format for the FixedArray and InlinedVector test files PiperOrigin-RevId: 256376285 -- f430b04f332d6b89cb8447b07217e391e1c38000 by Derek Mauro <dmauro@google.com>: Migrate the Linux CMake tests from GCC 4.8 to the GCC latest version. This will allow us to delete the GCC 4.8 test since that is currently our only CMake coverage. This also means that we don't have to update the script every time we move to a new minumum GCC version. This change includes a fix for a -Wstringops-truncation warning in symbolize_test.cc that triggers when it is built in release mode with the latest GCC. PiperOrigin-RevId: 256370092 GitOrigin-RevId: a874475e842d2adeb31bb7bd37bdd6eb15a2aeb9 Change-Id: Ia2ec58f9b9dfc382d043344e346cb397b802270a
This commit is contained in:
parent
e6b050212c
commit
74d91756c1
475 changed files with 135 additions and 83 deletions
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2017 The Abseil Authors.
|
// Copyright 2019 The Abseil Authors.
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
|
@ -12,12 +12,12 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "absl/container/fixed_array.h"
|
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "benchmark/benchmark.h"
|
#include "benchmark/benchmark.h"
|
||||||
|
#include "absl/container/fixed_array.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@ namespace {
|
||||||
// set an int to a constant..
|
// set an int to a constant..
|
||||||
class SimpleClass {
|
class SimpleClass {
|
||||||
public:
|
public:
|
||||||
SimpleClass() : i(3) { }
|
SimpleClass() : i(3) {}
|
||||||
~SimpleClass() { i = 0; }
|
~SimpleClass() { i = 0; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int i;
|
int i;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2017 The Abseil Authors.
|
// Copyright 2019 The Abseil Authors.
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
|
@ -14,10 +14,9 @@
|
||||||
|
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
|
|
||||||
#include "absl/container/fixed_array.h"
|
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "absl/base/internal/exception_safety_testing.h"
|
#include "absl/base/internal/exception_safety_testing.h"
|
||||||
|
#include "absl/container/fixed_array.h"
|
||||||
|
|
||||||
namespace absl {
|
namespace absl {
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2017 The Abseil Authors.
|
// Copyright 2019 The Abseil Authors.
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
|
@ -15,6 +15,7 @@
|
||||||
#include "absl/container/fixed_array.h"
|
#include "absl/container/fixed_array.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
@ -42,11 +43,7 @@ static bool IsOnStack(const ArrayType& a) {
|
||||||
|
|
||||||
class ConstructionTester {
|
class ConstructionTester {
|
||||||
public:
|
public:
|
||||||
ConstructionTester()
|
ConstructionTester() : self_ptr_(this), value_(0) { constructions++; }
|
||||||
: self_ptr_(this),
|
|
||||||
value_(0) {
|
|
||||||
constructions++;
|
|
||||||
}
|
|
||||||
~ConstructionTester() {
|
~ConstructionTester() {
|
||||||
assert(self_ptr_ == this);
|
assert(self_ptr_ == this);
|
||||||
self_ptr_ = nullptr;
|
self_ptr_ = nullptr;
|
||||||
|
@ -58,9 +55,7 @@ class ConstructionTester {
|
||||||
static int constructions;
|
static int constructions;
|
||||||
static int destructions;
|
static int destructions;
|
||||||
|
|
||||||
void CheckConstructed() {
|
void CheckConstructed() { assert(self_ptr_ == this); }
|
||||||
assert(self_ptr_ == this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void set(int value) { value_ = value; }
|
void set(int value) { value_ = value; }
|
||||||
int get() { return value_; }
|
int get() { return value_; }
|
||||||
|
@ -160,13 +155,13 @@ TEST(FixedArrayTest, SmallObjects) {
|
||||||
// same amount of stack space
|
// same amount of stack space
|
||||||
absl::FixedArray<int> array1(0);
|
absl::FixedArray<int> array1(0);
|
||||||
absl::FixedArray<char> array2(0);
|
absl::FixedArray<char> array2(0);
|
||||||
EXPECT_LE(sizeof(array1), sizeof(array2)+100);
|
EXPECT_LE(sizeof(array1), sizeof(array2) + 100);
|
||||||
EXPECT_LE(sizeof(array2), sizeof(array1)+100);
|
EXPECT_LE(sizeof(array2), sizeof(array1) + 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// Ensure that vectors are properly constructed inside a fixed array.
|
// Ensure that vectors are properly constructed inside a fixed array.
|
||||||
absl::FixedArray<std::vector<int> > array(2);
|
absl::FixedArray<std::vector<int>> array(2);
|
||||||
EXPECT_EQ(0, array[0].size());
|
EXPECT_EQ(0, array[0].size());
|
||||||
EXPECT_EQ(0, array[1].size());
|
EXPECT_EQ(0, array[1].size());
|
||||||
}
|
}
|
||||||
|
@ -270,8 +265,8 @@ static void TestArray(int n) {
|
||||||
array.data()[i].set(i + 1);
|
array.data()[i].set(i + 1);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
EXPECT_THAT(array[i].get(), i+1);
|
EXPECT_THAT(array[i].get(), i + 1);
|
||||||
EXPECT_THAT(array.data()[i].get(), i+1);
|
EXPECT_THAT(array.data()[i].get(), i + 1);
|
||||||
}
|
}
|
||||||
} // Close scope containing 'array'.
|
} // Close scope containing 'array'.
|
||||||
|
|
||||||
|
@ -296,7 +291,7 @@ static void TestArrayOfArrays(int n) {
|
||||||
|
|
||||||
ASSERT_EQ(array.size(), n);
|
ASSERT_EQ(array.size(), n);
|
||||||
ASSERT_EQ(array.memsize(),
|
ASSERT_EQ(array.memsize(),
|
||||||
sizeof(ConstructionTester) * elements_per_inner_array * n);
|
sizeof(ConstructionTester) * elements_per_inner_array * n);
|
||||||
ASSERT_EQ(array.begin() + n, array.end());
|
ASSERT_EQ(array.begin() + n, array.end());
|
||||||
|
|
||||||
// Check that all elements were constructed
|
// Check that all elements were constructed
|
||||||
|
@ -316,7 +311,7 @@ static void TestArrayOfArrays(int n) {
|
||||||
}
|
}
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
for (int j = 0; j < elements_per_inner_array; j++) {
|
for (int j = 0; j < elements_per_inner_array; j++) {
|
||||||
ASSERT_EQ((array[i])[j].get(), i * elements_per_inner_array + j);
|
ASSERT_EQ((array[i])[j].get(), i * elements_per_inner_array + j);
|
||||||
ASSERT_EQ((array.data()[i])[j].get(), i * elements_per_inner_array + j);
|
ASSERT_EQ((array.data()[i])[j].get(), i * elements_per_inner_array + j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -329,8 +324,7 @@ static void TestArrayOfArrays(int n) {
|
||||||
}
|
}
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
for (int j = 0; j < elements_per_inner_array; j++) {
|
for (int j = 0; j < elements_per_inner_array; j++) {
|
||||||
ASSERT_EQ((array[i])[j].get(),
|
ASSERT_EQ((array[i])[j].get(), (i + 1) * elements_per_inner_array + j);
|
||||||
(i + 1) * elements_per_inner_array + j);
|
|
||||||
ASSERT_EQ((array.data()[i])[j].get(),
|
ASSERT_EQ((array.data()[i])[j].get(),
|
||||||
(i + 1) * elements_per_inner_array + j);
|
(i + 1) * elements_per_inner_array + j);
|
||||||
}
|
}
|
||||||
|
@ -343,7 +337,7 @@ static void TestArrayOfArrays(int n) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(IteratorConstructorTest, NonInline) {
|
TEST(IteratorConstructorTest, NonInline) {
|
||||||
int const kInput[] = { 2, 3, 5, 7, 11, 13, 17 };
|
int const kInput[] = {2, 3, 5, 7, 11, 13, 17};
|
||||||
absl::FixedArray<int, ABSL_ARRAYSIZE(kInput) - 1> const fixed(
|
absl::FixedArray<int, ABSL_ARRAYSIZE(kInput) - 1> const fixed(
|
||||||
kInput, kInput + ABSL_ARRAYSIZE(kInput));
|
kInput, kInput + ABSL_ARRAYSIZE(kInput));
|
||||||
ASSERT_EQ(ABSL_ARRAYSIZE(kInput), fixed.size());
|
ASSERT_EQ(ABSL_ARRAYSIZE(kInput), fixed.size());
|
||||||
|
@ -353,7 +347,7 @@ TEST(IteratorConstructorTest, NonInline) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(IteratorConstructorTest, Inline) {
|
TEST(IteratorConstructorTest, Inline) {
|
||||||
int const kInput[] = { 2, 3, 5, 7, 11, 13, 17 };
|
int const kInput[] = {2, 3, 5, 7, 11, 13, 17};
|
||||||
absl::FixedArray<int, ABSL_ARRAYSIZE(kInput)> const fixed(
|
absl::FixedArray<int, ABSL_ARRAYSIZE(kInput)> const fixed(
|
||||||
kInput, kInput + ABSL_ARRAYSIZE(kInput));
|
kInput, kInput + ABSL_ARRAYSIZE(kInput));
|
||||||
ASSERT_EQ(ABSL_ARRAYSIZE(kInput), fixed.size());
|
ASSERT_EQ(ABSL_ARRAYSIZE(kInput), fixed.size());
|
||||||
|
@ -363,8 +357,8 @@ TEST(IteratorConstructorTest, Inline) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(IteratorConstructorTest, NonPod) {
|
TEST(IteratorConstructorTest, NonPod) {
|
||||||
char const* kInput[] =
|
char const* kInput[] = {"red", "orange", "yellow", "green",
|
||||||
{ "red", "orange", "yellow", "green", "blue", "indigo", "violet" };
|
"blue", "indigo", "violet"};
|
||||||
absl::FixedArray<std::string> const fixed(kInput,
|
absl::FixedArray<std::string> const fixed(kInput,
|
||||||
kInput + ABSL_ARRAYSIZE(kInput));
|
kInput + ABSL_ARRAYSIZE(kInput));
|
||||||
ASSERT_EQ(ABSL_ARRAYSIZE(kInput), fixed.size());
|
ASSERT_EQ(ABSL_ARRAYSIZE(kInput), fixed.size());
|
||||||
|
@ -381,7 +375,7 @@ TEST(IteratorConstructorTest, FromEmptyVector) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(IteratorConstructorTest, FromNonEmptyVector) {
|
TEST(IteratorConstructorTest, FromNonEmptyVector) {
|
||||||
int const kInput[] = { 2, 3, 5, 7, 11, 13, 17 };
|
int const kInput[] = {2, 3, 5, 7, 11, 13, 17};
|
||||||
std::vector<int> const items(kInput, kInput + ABSL_ARRAYSIZE(kInput));
|
std::vector<int> const items(kInput, kInput + ABSL_ARRAYSIZE(kInput));
|
||||||
absl::FixedArray<int> const fixed(items.begin(), items.end());
|
absl::FixedArray<int> const fixed(items.begin(), items.end());
|
||||||
ASSERT_EQ(items.size(), fixed.size());
|
ASSERT_EQ(items.size(), fixed.size());
|
||||||
|
@ -391,7 +385,7 @@ TEST(IteratorConstructorTest, FromNonEmptyVector) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(IteratorConstructorTest, FromBidirectionalIteratorRange) {
|
TEST(IteratorConstructorTest, FromBidirectionalIteratorRange) {
|
||||||
int const kInput[] = { 2, 3, 5, 7, 11, 13, 17 };
|
int const kInput[] = {2, 3, 5, 7, 11, 13, 17};
|
||||||
std::list<int> const items(kInput, kInput + ABSL_ARRAYSIZE(kInput));
|
std::list<int> const items(kInput, kInput + ABSL_ARRAYSIZE(kInput));
|
||||||
absl::FixedArray<int> const fixed(items.begin(), items.end());
|
absl::FixedArray<int> const fixed(items.begin(), items.end());
|
||||||
EXPECT_THAT(fixed, testing::ElementsAreArray(kInput));
|
EXPECT_THAT(fixed, testing::ElementsAreArray(kInput));
|
||||||
|
@ -508,9 +502,8 @@ struct PickyDelete {
|
||||||
|
|
||||||
TEST(FixedArrayTest, UsesGlobalAlloc) { absl::FixedArray<PickyDelete, 0> a(5); }
|
TEST(FixedArrayTest, UsesGlobalAlloc) { absl::FixedArray<PickyDelete, 0> a(5); }
|
||||||
|
|
||||||
|
|
||||||
TEST(FixedArrayTest, Data) {
|
TEST(FixedArrayTest, Data) {
|
||||||
static const int kInput[] = { 2, 3, 5, 7, 11, 13, 17 };
|
static const int kInput[] = {2, 3, 5, 7, 11, 13, 17};
|
||||||
absl::FixedArray<int> fa(std::begin(kInput), std::end(kInput));
|
absl::FixedArray<int> fa(std::begin(kInput), std::end(kInput));
|
||||||
EXPECT_EQ(fa.data(), &*fa.begin());
|
EXPECT_EQ(fa.data(), &*fa.begin());
|
||||||
EXPECT_EQ(fa.data(), &fa[0]);
|
EXPECT_EQ(fa.data(), &fa[0]);
|
||||||
|
@ -824,7 +817,7 @@ TEST(AllocatorSupportTest, SizeValAllocConstructor) {
|
||||||
#ifdef ADDRESS_SANITIZER
|
#ifdef ADDRESS_SANITIZER
|
||||||
TEST(FixedArrayTest, AddressSanitizerAnnotations1) {
|
TEST(FixedArrayTest, AddressSanitizerAnnotations1) {
|
||||||
absl::FixedArray<int, 32> a(10);
|
absl::FixedArray<int, 32> a(10);
|
||||||
int *raw = a.data();
|
int* raw = a.data();
|
||||||
raw[0] = 0;
|
raw[0] = 0;
|
||||||
raw[9] = 0;
|
raw[9] = 0;
|
||||||
EXPECT_DEATH(raw[-2] = 0, "container-overflow");
|
EXPECT_DEATH(raw[-2] = 0, "container-overflow");
|
||||||
|
@ -835,7 +828,7 @@ TEST(FixedArrayTest, AddressSanitizerAnnotations1) {
|
||||||
|
|
||||||
TEST(FixedArrayTest, AddressSanitizerAnnotations2) {
|
TEST(FixedArrayTest, AddressSanitizerAnnotations2) {
|
||||||
absl::FixedArray<char, 17> a(12);
|
absl::FixedArray<char, 17> a(12);
|
||||||
char *raw = a.data();
|
char* raw = a.data();
|
||||||
raw[0] = 0;
|
raw[0] = 0;
|
||||||
raw[11] = 0;
|
raw[11] = 0;
|
||||||
EXPECT_DEATH(raw[-7] = 0, "container-overflow");
|
EXPECT_DEATH(raw[-7] = 0, "container-overflow");
|
||||||
|
@ -846,7 +839,7 @@ TEST(FixedArrayTest, AddressSanitizerAnnotations2) {
|
||||||
|
|
||||||
TEST(FixedArrayTest, AddressSanitizerAnnotations3) {
|
TEST(FixedArrayTest, AddressSanitizerAnnotations3) {
|
||||||
absl::FixedArray<uint64_t, 20> a(20);
|
absl::FixedArray<uint64_t, 20> a(20);
|
||||||
uint64_t *raw = a.data();
|
uint64_t* raw = a.data();
|
||||||
raw[0] = 0;
|
raw[0] = 0;
|
||||||
raw[19] = 0;
|
raw[19] = 0;
|
||||||
EXPECT_DEATH(raw[-1] = 0, "container-overflow");
|
EXPECT_DEATH(raw[-1] = 0, "container-overflow");
|
||||||
|
@ -855,7 +848,7 @@ TEST(FixedArrayTest, AddressSanitizerAnnotations3) {
|
||||||
|
|
||||||
TEST(FixedArrayTest, AddressSanitizerAnnotations4) {
|
TEST(FixedArrayTest, AddressSanitizerAnnotations4) {
|
||||||
absl::FixedArray<ThreeInts> a(10);
|
absl::FixedArray<ThreeInts> a(10);
|
||||||
ThreeInts *raw = a.data();
|
ThreeInts* raw = a.data();
|
||||||
raw[0] = ThreeInts();
|
raw[0] = ThreeInts();
|
||||||
raw[9] = ThreeInts();
|
raw[9] = ThreeInts();
|
||||||
// Note: raw[-1] is pointing to 12 bytes before the container range. However,
|
// Note: raw[-1] is pointing to 12 bytes before the container range. However,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2017 The Abseil Authors.
|
// Copyright 2019 The Abseil Authors.
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
|
@ -76,12 +76,9 @@ TYPED_TEST_SUITE_P(InstanceTest);
|
||||||
// destroyed in the erase(begin, end) test.
|
// destroyed in the erase(begin, end) test.
|
||||||
class RefCounted {
|
class RefCounted {
|
||||||
public:
|
public:
|
||||||
RefCounted(int value, int* count) : value_(value), count_(count) {
|
RefCounted(int value, int* count) : value_(value), count_(count) { Ref(); }
|
||||||
Ref();
|
|
||||||
}
|
|
||||||
|
|
||||||
RefCounted(const RefCounted& v)
|
RefCounted(const RefCounted& v) : value_(v.value_), count_(v.count_) {
|
||||||
: value_(v.value_), count_(v.count_) {
|
|
||||||
Ref();
|
Ref();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,7 +287,7 @@ TEST(RefCountedVec, EraseBeginEnd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that the elements at the end are preserved.
|
// Check that the elements at the end are preserved.
|
||||||
for (int i = erase_end; i< len; ++i) {
|
for (int i = erase_end; i < len; ++i) {
|
||||||
EXPECT_EQ(1, counts[i]);
|
EXPECT_EQ(1, counts[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -552,10 +549,10 @@ TEST(IntVec, Resize) {
|
||||||
static const int kResizeElem = 1000000;
|
static const int kResizeElem = 1000000;
|
||||||
for (int k = 0; k < 10; k++) {
|
for (int k = 0; k < 10; k++) {
|
||||||
// Enlarging resize
|
// Enlarging resize
|
||||||
v.resize(len+k, kResizeElem);
|
v.resize(len + k, kResizeElem);
|
||||||
EXPECT_EQ(len+k, v.size());
|
EXPECT_EQ(len + k, v.size());
|
||||||
EXPECT_LE(len+k, v.capacity());
|
EXPECT_LE(len + k, v.capacity());
|
||||||
for (int i = 0; i < len+k; i++) {
|
for (int i = 0; i < len + k; i++) {
|
||||||
if (i < len) {
|
if (i < len) {
|
||||||
EXPECT_EQ(i, v[i]);
|
EXPECT_EQ(i, v[i]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -866,7 +863,7 @@ TYPED_TEST_P(InstanceTest, Swap) {
|
||||||
auto min_len = std::min(l1, l2);
|
auto min_len = std::min(l1, l2);
|
||||||
auto max_len = std::max(l1, l2);
|
auto max_len = std::max(l1, l2);
|
||||||
for (int i = 0; i < l1; i++) a.push_back(Instance(i));
|
for (int i = 0; i < l1; i++) a.push_back(Instance(i));
|
||||||
for (int i = 0; i < l2; i++) b.push_back(Instance(100+i));
|
for (int i = 0; i < l2; i++) b.push_back(Instance(100 + i));
|
||||||
EXPECT_EQ(tracker.instances(), l1 + l2);
|
EXPECT_EQ(tracker.instances(), l1 + l2);
|
||||||
tracker.ResetCopiesMovesSwaps();
|
tracker.ResetCopiesMovesSwaps();
|
||||||
{
|
{
|
||||||
|
@ -934,7 +931,7 @@ TEST(IntVec, EqualAndNotEqual) {
|
||||||
EXPECT_FALSE(a == b);
|
EXPECT_FALSE(a == b);
|
||||||
EXPECT_TRUE(a != b);
|
EXPECT_TRUE(a != b);
|
||||||
|
|
||||||
b[i] = b[i] - 1; // Back to before
|
b[i] = b[i] - 1; // Back to before
|
||||||
EXPECT_TRUE(a == b);
|
EXPECT_TRUE(a == b);
|
||||||
EXPECT_FALSE(a != b);
|
EXPECT_FALSE(a != b);
|
||||||
}
|
}
|
||||||
|
@ -1001,7 +998,7 @@ TYPED_TEST_P(InstanceTest, CountConstructorsDestructors) {
|
||||||
|
|
||||||
// reserve() must not increase the number of initialized objects
|
// reserve() must not increase the number of initialized objects
|
||||||
SCOPED_TRACE("reserve");
|
SCOPED_TRACE("reserve");
|
||||||
v.reserve(len+1000);
|
v.reserve(len + 1000);
|
||||||
EXPECT_EQ(tracker.instances(), len);
|
EXPECT_EQ(tracker.instances(), len);
|
||||||
EXPECT_EQ(tracker.copies() + tracker.moves(), len);
|
EXPECT_EQ(tracker.copies() + tracker.moves(), len);
|
||||||
|
|
||||||
|
@ -1247,9 +1244,8 @@ void InstanceCountElemAssignWithAllocationTest() {
|
||||||
absl::InlinedVector<Instance, 2> v(original_contents.begin(),
|
absl::InlinedVector<Instance, 2> v(original_contents.begin(),
|
||||||
original_contents.end());
|
original_contents.end());
|
||||||
v.assign(3, Instance(123));
|
v.assign(3, Instance(123));
|
||||||
EXPECT_THAT(v,
|
EXPECT_THAT(v, AllOf(SizeIs(3), ElementsAre(ValueIs(123), ValueIs(123),
|
||||||
AllOf(SizeIs(3),
|
ValueIs(123))));
|
||||||
ElementsAre(ValueIs(123), ValueIs(123), ValueIs(123))));
|
|
||||||
EXPECT_LE(v.size(), v.capacity());
|
EXPECT_LE(v.size(), v.capacity());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1528,8 +1524,8 @@ TYPED_TEST_P(InstanceTest, InitializerListAssign) {
|
||||||
SCOPED_TRACE(original_size);
|
SCOPED_TRACE(original_size);
|
||||||
absl::InlinedVector<Instance, 2> v(original_size, Instance(12345));
|
absl::InlinedVector<Instance, 2> v(original_size, Instance(12345));
|
||||||
v.assign({Instance(3), Instance(4), Instance(5)});
|
v.assign({Instance(3), Instance(4), Instance(5)});
|
||||||
EXPECT_THAT(v, AllOf(SizeIs(3),
|
EXPECT_THAT(
|
||||||
ElementsAre(ValueIs(3), ValueIs(4), ValueIs(5))));
|
v, AllOf(SizeIs(3), ElementsAre(ValueIs(3), ValueIs(4), ValueIs(5))));
|
||||||
EXPECT_LE(3, v.capacity());
|
EXPECT_LE(3, v.capacity());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1554,7 +1550,7 @@ TEST(DynamicVec, DynamicVecCompiles) {
|
||||||
TEST(AllocatorSupportTest, Constructors) {
|
TEST(AllocatorSupportTest, Constructors) {
|
||||||
using MyAlloc = CountingAllocator<int>;
|
using MyAlloc = CountingAllocator<int>;
|
||||||
using AllocVec = absl::InlinedVector<int, 4, MyAlloc>;
|
using AllocVec = absl::InlinedVector<int, 4, MyAlloc>;
|
||||||
const int ia[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
|
const int ia[] = {0, 1, 2, 3, 4, 5, 6, 7};
|
||||||
int64_t allocated = 0;
|
int64_t allocated = 0;
|
||||||
MyAlloc alloc(&allocated);
|
MyAlloc alloc(&allocated);
|
||||||
{ AllocVec ABSL_ATTRIBUTE_UNUSED v; }
|
{ AllocVec ABSL_ATTRIBUTE_UNUSED v; }
|
||||||
|
@ -1570,7 +1566,7 @@ TEST(AllocatorSupportTest, Constructors) {
|
||||||
TEST(AllocatorSupportTest, CountAllocations) {
|
TEST(AllocatorSupportTest, CountAllocations) {
|
||||||
using MyAlloc = CountingAllocator<int>;
|
using MyAlloc = CountingAllocator<int>;
|
||||||
using AllocVec = absl::InlinedVector<int, 4, MyAlloc>;
|
using AllocVec = absl::InlinedVector<int, 4, MyAlloc>;
|
||||||
const int ia[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
|
const int ia[] = {0, 1, 2, 3, 4, 5, 6, 7};
|
||||||
int64_t allocated = 0;
|
int64_t allocated = 0;
|
||||||
MyAlloc alloc(&allocated);
|
MyAlloc alloc(&allocated);
|
||||||
{
|
{
|
||||||
|
@ -1634,8 +1630,8 @@ TEST(AllocatorSupportTest, SwapBothAllocated) {
|
||||||
int64_t allocated1 = 0;
|
int64_t allocated1 = 0;
|
||||||
int64_t allocated2 = 0;
|
int64_t allocated2 = 0;
|
||||||
{
|
{
|
||||||
const int ia1[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
|
const int ia1[] = {0, 1, 2, 3, 4, 5, 6, 7};
|
||||||
const int ia2[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
|
const int ia2[] = {0, 1, 2, 3, 4, 5, 6, 7, 8};
|
||||||
MyAlloc a1(&allocated1);
|
MyAlloc a1(&allocated1);
|
||||||
MyAlloc a2(&allocated2);
|
MyAlloc a2(&allocated2);
|
||||||
AllocVec v1(ia1, ia1 + ABSL_ARRAYSIZE(ia1), a1);
|
AllocVec v1(ia1, ia1 + ABSL_ARRAYSIZE(ia1), a1);
|
||||||
|
@ -1659,8 +1655,8 @@ TEST(AllocatorSupportTest, SwapOneAllocated) {
|
||||||
int64_t allocated1 = 0;
|
int64_t allocated1 = 0;
|
||||||
int64_t allocated2 = 0;
|
int64_t allocated2 = 0;
|
||||||
{
|
{
|
||||||
const int ia1[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
|
const int ia1[] = {0, 1, 2, 3, 4, 5, 6, 7};
|
||||||
const int ia2[] = { 0, 1, 2, 3 };
|
const int ia2[] = {0, 1, 2, 3};
|
||||||
MyAlloc a1(&allocated1);
|
MyAlloc a1(&allocated1);
|
||||||
MyAlloc a2(&allocated2);
|
MyAlloc a2(&allocated2);
|
||||||
AllocVec v1(ia1, ia1 + ABSL_ARRAYSIZE(ia1), a1);
|
AllocVec v1(ia1, ia1 + ABSL_ARRAYSIZE(ia1), a1);
|
||||||
|
@ -1681,8 +1677,7 @@ TEST(AllocatorSupportTest, SwapOneAllocated) {
|
||||||
|
|
||||||
TEST(AllocatorSupportTest, ScopedAllocatorWorks) {
|
TEST(AllocatorSupportTest, ScopedAllocatorWorks) {
|
||||||
using StdVector = std::vector<int, CountingAllocator<int>>;
|
using StdVector = std::vector<int, CountingAllocator<int>>;
|
||||||
using MyAlloc =
|
using MyAlloc = std::scoped_allocator_adaptor<CountingAllocator<StdVector>>;
|
||||||
std::scoped_allocator_adaptor<CountingAllocator<StdVector>>;
|
|
||||||
using AllocVec = absl::InlinedVector<StdVector, 4, MyAlloc>;
|
using AllocVec = absl::InlinedVector<StdVector, 4, MyAlloc>;
|
||||||
|
|
||||||
// MSVC 2017's std::vector allocates different amounts of memory in debug
|
// MSVC 2017's std::vector allocates different amounts of memory in debug
|
||||||
|
|
|
@ -107,7 +107,8 @@ static const char *TrySymbolizeWithLimit(void *pc, int limit) {
|
||||||
ABSL_RAW_CHECK(strnlen(heap_buffer.get(), limit) < limit,
|
ABSL_RAW_CHECK(strnlen(heap_buffer.get(), limit) < limit,
|
||||||
"absl::Symbolize() did not properly terminate the string");
|
"absl::Symbolize() did not properly terminate the string");
|
||||||
strncpy(try_symbolize_buffer, heap_buffer.get(),
|
strncpy(try_symbolize_buffer, heap_buffer.get(),
|
||||||
sizeof(try_symbolize_buffer));
|
sizeof(try_symbolize_buffer) - 1);
|
||||||
|
try_symbolize_buffer[sizeof(try_symbolize_buffer) - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
return found ? try_symbolize_buffer : nullptr;
|
return found ? try_symbolize_buffer : nullptr;
|
||||||
|
|
|
@ -239,8 +239,8 @@ bool TimeZoneInfo::Header::Build(const tzhead& tzh) {
|
||||||
leapcnt = static_cast<std::size_t>(v);
|
leapcnt = static_cast<std::size_t>(v);
|
||||||
if ((v = Decode32(tzh.tzh_ttisstdcnt)) < 0) return false;
|
if ((v = Decode32(tzh.tzh_ttisstdcnt)) < 0) return false;
|
||||||
ttisstdcnt = static_cast<std::size_t>(v);
|
ttisstdcnt = static_cast<std::size_t>(v);
|
||||||
if ((v = Decode32(tzh.tzh_ttisgmtcnt)) < 0) return false;
|
if ((v = Decode32(tzh.tzh_ttisutcnt)) < 0) return false;
|
||||||
ttisgmtcnt = static_cast<std::size_t>(v);
|
ttisutcnt = static_cast<std::size_t>(v);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ std::size_t TimeZoneInfo::Header::DataLength(std::size_t time_len) const {
|
||||||
len += 1 * charcnt; // abbreviations
|
len += 1 * charcnt; // abbreviations
|
||||||
len += (time_len + 4) * leapcnt; // leap-time + TAI-UTC
|
len += (time_len + 4) * leapcnt; // leap-time + TAI-UTC
|
||||||
len += 1 * ttisstdcnt; // UTC/local indicators
|
len += 1 * ttisstdcnt; // UTC/local indicators
|
||||||
len += 1 * ttisgmtcnt; // standard/wall indicators
|
len += 1 * ttisutcnt; // standard/wall indicators
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,7 +427,7 @@ bool TimeZoneInfo::Load(const std::string& name, ZoneInfoSource* zip) {
|
||||||
}
|
}
|
||||||
if (hdr.ttisstdcnt != 0 && hdr.ttisstdcnt != hdr.typecnt)
|
if (hdr.ttisstdcnt != 0 && hdr.ttisstdcnt != hdr.typecnt)
|
||||||
return false;
|
return false;
|
||||||
if (hdr.ttisgmtcnt != 0 && hdr.ttisgmtcnt != hdr.typecnt)
|
if (hdr.ttisutcnt != 0 && hdr.ttisutcnt != hdr.typecnt)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Read the data into a local buffer.
|
// Read the data into a local buffer.
|
||||||
|
@ -498,7 +498,7 @@ bool TimeZoneInfo::Load(const std::string& name, ZoneInfoSource* zip) {
|
||||||
// that isn't the case here (see "zic -p").
|
// that isn't the case here (see "zic -p").
|
||||||
bp += (8 + 4) * hdr.leapcnt; // leap-time + TAI-UTC
|
bp += (8 + 4) * hdr.leapcnt; // leap-time + TAI-UTC
|
||||||
bp += 1 * hdr.ttisstdcnt; // UTC/local indicators
|
bp += 1 * hdr.ttisstdcnt; // UTC/local indicators
|
||||||
bp += 1 * hdr.ttisgmtcnt; // standard/wall indicators
|
bp += 1 * hdr.ttisutcnt; // standard/wall indicators
|
||||||
assert(bp == tbuf.data() + tbuf.size());
|
assert(bp == tbuf.data() + tbuf.size());
|
||||||
|
|
||||||
future_spec_.clear();
|
future_spec_.clear();
|
||||||
|
|
|
@ -88,7 +88,7 @@ class TimeZoneInfo : public TimeZoneIf {
|
||||||
std::size_t charcnt; // zone abbreviation characters
|
std::size_t charcnt; // zone abbreviation characters
|
||||||
std::size_t leapcnt; // leap seconds (we expect none)
|
std::size_t leapcnt; // leap seconds (we expect none)
|
||||||
std::size_t ttisstdcnt; // UTC/local indicators (unused)
|
std::size_t ttisstdcnt; // UTC/local indicators (unused)
|
||||||
std::size_t ttisgmtcnt; // standard/wall indicators (unused)
|
std::size_t ttisutcnt; // standard/wall indicators (unused)
|
||||||
|
|
||||||
bool Build(const tzhead& tzh);
|
bool Build(const tzhead& tzh);
|
||||||
std::size_t DataLength(std::size_t time_len) const;
|
std::size_t DataLength(std::size_t time_len) const;
|
||||||
|
|
|
@ -46,7 +46,7 @@ struct tzhead {
|
||||||
char tzh_magic[4]; /* TZ_MAGIC */
|
char tzh_magic[4]; /* TZ_MAGIC */
|
||||||
char tzh_version[1]; /* '\0' or '2' or '3' as of 2013 */
|
char tzh_version[1]; /* '\0' or '2' or '3' as of 2013 */
|
||||||
char tzh_reserved[15]; /* reserved; must be zero */
|
char tzh_reserved[15]; /* reserved; must be zero */
|
||||||
char tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */
|
char tzh_ttisutcnt[4]; /* coded number of trans. time flags */
|
||||||
char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */
|
char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */
|
||||||
char tzh_leapcnt[4]; /* coded number of leap seconds */
|
char tzh_leapcnt[4]; /* coded number of leap seconds */
|
||||||
char tzh_timecnt[4]; /* coded number of transition times */
|
char tzh_timecnt[4]; /* coded number of transition times */
|
||||||
|
@ -69,14 +69,15 @@ struct tzhead {
|
||||||
** one (char [4]) total correction after above
|
** one (char [4]) total correction after above
|
||||||
** tzh_ttisstdcnt (char)s indexed by type; if 1, transition
|
** tzh_ttisstdcnt (char)s indexed by type; if 1, transition
|
||||||
** time is standard time, if 0,
|
** time is standard time, if 0,
|
||||||
** transition time is wall clock time
|
** transition time is local (wall clock)
|
||||||
** if absent, transition times are
|
** time; if absent, transition times are
|
||||||
** assumed to be wall clock time
|
|
||||||
** tzh_ttisgmtcnt (char)s indexed by type; if 1, transition
|
|
||||||
** time is UT, if 0,
|
|
||||||
** transition time is local time
|
|
||||||
** if absent, transition times are
|
|
||||||
** assumed to be local time
|
** assumed to be local time
|
||||||
|
** tzh_ttisutcnt (char)s indexed by type; if 1, transition
|
||||||
|
** time is UT, if 0, transition time is
|
||||||
|
** local time; if absent, transition
|
||||||
|
** times are assumed to be local time.
|
||||||
|
** When this is 1, the corresponding
|
||||||
|
** std/wall indicator must also be 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
2
absl/time/internal/cctz/testdata/version
vendored
2
absl/time/internal/cctz/testdata/version
vendored
|
@ -1 +1 @@
|
||||||
2019a
|
2019b
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue