summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2019-07-02 12:50:48 -0700
committerGravatar Mark Barolak <mbar@google.com>2019-07-02 17:23:45 -0400
commite6b050212c859fbaf67abac76105da10ec348274 (patch)
tree820bfd57d6117171e84089e6ff23d6333bb79c43
parentc964fcffac27bd4a9ff67fe393410dd1146ef8b8 (diff)
Export of internal Abseil changes.
-- c2e2e2b21c3fe59b63279e7418c93c7289ee3e27 by Mark Barolak <mbar@google.com>: Import of CCTZ from GitHub. PiperOrigin-RevId: 256220326 -- 3996b01f0c3eb60f72825b154dce8019b6215f1d by Derek Mauro <dmauro@google.com>: Add GCC 4.9 test script. This will become our new minumum version and GCC 4.8 will be removed soon. PiperOrigin-RevId: 256160891 -- 2c13aa44bc8e497ebae9abe8b8adf73c2152622d by Abseil Team <absl-team@google.com>: [Trivial] tweak flat_hash_map.h doc comment The comment is probably right both ways, but the lack of an "if" here seemed jarring to me. PiperOrigin-RevId: 256089069 -- 16bc03b9b30fbf08d7dc61025fa8ec4b57077be8 by Abseil Team <absl-team@google.com>: Fix symbolization for elf files whose SYMTAB section is stripped, but have a DYNSYM section. Previously, if we did not find a SYMTAB section, we would bail out of symbolization early, rather than checking the DYNSYM section. PiperOrigin-RevId: 256061954 -- 4c60ee329b1eeb0b0d10c4f76f282e5fbae2c5b2 by Derek Mauro <dmauro@google.com>: Update to LLVM r363242 and Bazel 0.27.0 PiperOrigin-RevId: 256024405 -- 18e1ba970d33f122026803d8ca90035b9088949d by Eric Fiselier <ericwf@google.com>: Disable variant tests that break with P0608R3 PiperOrigin-RevId: 255975764 -- 0a89858464977e86096b62476faa3b64eb94aa1d by Abseil Team <absl-team@google.com>: Internal change PiperOrigin-RevId: 255891019 -- 9b7424cac66f5407f0ed74ed288bf3099a4fa330 by CJ Johnson <johnsoncj@google.com>: Updates the implementation of InlinedVector::insert(...) to be exception safe and adds an exception safety tests for insert(...) PiperOrigin-RevId: 255881809 -- 1288f4ba3883c510d92b09437fb8b051c19aa241 by CJ Johnson <johnsoncj@google.com>: Updates the implementation of InlinedVector::insert(...) to be exception safe and adds an exception safety tests for insert(...) PiperOrigin-RevId: 255875277 -- 39c04f3621491eaff9e2eda619718d5b5f20fbd9 by Abseil Team <absl-team@google.com>: Use a typedef to allow building with NVCC Without this change NVCC fails to compile compressed_tuple.h. NVCC is relevant because TensorFlow uses NVCC on Ubuntu and inclues abseil. PiperOrigin-RevId: 255850176 -- e23f0309ccad69eb508ca02c9034cd4cdd740da0 by Abseil Team <absl-team@google.com>: Internal change PiperOrigin-RevId: 255787167 -- 054aafcebf595077054164f1da3703124ab209b4 by Abseil Team <absl-team@google.com>: Updates the ScopedAllocatorWorks test for InlinedVector to not rely on the byte count allocated by the standard library In doing so, removes LegacyNextCapacityFrom(...) impl function from InlinedVector Also applies clang-format to the test file PiperOrigin-RevId: 255760356 -- eb05fc9f78e3a163c93f1866e9fe9a8ad0d01622 by Abseil Team <absl-team@google.com>: Internal change PiperOrigin-RevId: 255706834 -- 97abb824417604c45d9fcbb3e4ff1aa3000836f2 by Jorg Brown <jorg@google.com>: Enhance compatibility of abseil's strings package with nvcc. PiperOrigin-RevId: 255688500 -- efc5b9c221ee31e15d10b35d31c8f3ae6eddaa8c by Abseil Team <absl-team@google.com>: Follow CCTZ's lead and allow GetWeekday() and GetYearDay() to be called with any civil-time type. A CivilSecond, for example, has a weekday just as much as a CivilDay does. PiperOrigin-RevId: 255659840 -- a75acbe954457919d8c6c8f4c2339b543760b375 by Derek Mauro <dmauro@google.com>: Increase the timeout of randen_engine_test. It seems to timeout under TSAN often enough to justify the increase. PiperOrigin-RevId: 255628086 -- 160976ba47c7c6eb57af08e21f8eb640aa51e91b by Derek Mauro <dmauro@google.com>: Update CMake documentation Fixes https://github.com/abseil/abseil-cpp/issues/332 PiperOrigin-RevId: 255607313 GitOrigin-RevId: c2e2e2b21c3fe59b63279e7418c93c7289ee3e27 Change-Id: Iba4ac7ed23cbcdb22965b4958601f689be92cda4
-rw-r--r--CMake/README.md16
-rw-r--r--absl/container/flat_hash_map.h2
-rw-r--r--absl/container/inlined_vector_test.cc135
-rw-r--r--absl/container/internal/compressed_tuple.h11
-rw-r--r--absl/container/internal/inlined_vector.h16
-rw-r--r--absl/copts/GENERATED_AbseilCopts.cmake2
-rw-r--r--absl/copts/GENERATED_copts.bzl2
-rw-r--r--absl/copts/copts.py2
-rw-r--r--absl/debugging/symbolize_elf.inc48
-rw-r--r--absl/random/internal/BUILD.bazel10
-rw-r--r--absl/strings/BUILD.bazel1
-rw-r--r--absl/strings/CMakeLists.txt1
-rw-r--r--absl/strings/internal/str_format/bind.h20
-rw-r--r--absl/strings/str_format_test.cc17
-rw-r--r--absl/time/civil_time.h12
-rw-r--r--absl/time/civil_time_test.cc12
-rw-r--r--absl/time/internal/cctz/include/cctz/civil_time_detail.h14
-rw-r--r--absl/time/internal/cctz/src/time_zone_info.cc4
-rw-r--r--absl/time/time.cc5
-rw-r--r--absl/time/time_test.cc16
-rw-r--r--absl/types/variant_test.cc12
-rwxr-xr-xci/linux_clang-latest_libcxx_asan_bazel.sh2
-rwxr-xr-xci/linux_clang-latest_libcxx_bazel.sh2
-rwxr-xr-xci/linux_clang-latest_libcxx_tsan_bazel.sh2
-rwxr-xr-xci/linux_clang-latest_libstdcxx_bazel.sh2
-rwxr-xr-xci/linux_gcc-4.9_libstdcxx_bazel.sh75
-rwxr-xr-xci/linux_gcc-latest_libstdcxx_bazel.sh2
27 files changed, 284 insertions, 159 deletions
diff --git a/CMake/README.md b/CMake/README.md
index 02359d36..469dfef5 100644
--- a/CMake/README.md
+++ b/CMake/README.md
@@ -37,20 +37,12 @@ section of your executable or of your library.<br>
Here is a short CMakeLists.txt example of a project file using Abseil.
```cmake
-cmake_minimum_required(VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.5)
project(my_project)
-set(CMAKE_CXX_FLAGS "-std=c++11 -stdlib=libc++ ${CMAKE_CXX_FLAGS}")
-
-if(MSVC)
- # /wd4005 macro-redefinition
- # /wd4068 unknown pragma
- # /wd4244 conversion from 'type1' to 'type2'
- # /wd4267 conversion from 'size_t' to 'type2'
- # /wd4800 force value to bool 'true' or 'false' (performance warning)
- add_compile_options(/wd4005 /wd4068 /wd4244 /wd4267 /wd4800)
- add_definitions(/DNOMINMAX /DWIN32_LEAN_AND_MEAN=1 /D_CRT_SECURE_NO_WARNINGS)
-endif()
+# Pick the C++ standard to compile with.
+# Abseil currently supports C++11, C++14, and C++17.
+set(CMAKE_CXX_STANDARD 11)
add_subdirectory(abseil-cpp)
diff --git a/absl/container/flat_hash_map.h b/absl/container/flat_hash_map.h
index 00cc4dcf..0bc501b1 100644
--- a/absl/container/flat_hash_map.h
+++ b/absl/container/flat_hash_map.h
@@ -77,7 +77,7 @@ struct FlatHashMapPolicy;
// NOTE: A `flat_hash_map` stores its value types directly inside its
// implementation array to avoid memory indirection. Because a `flat_hash_map`
// is designed to move data when rehashed, map values will not retain pointer
-// stability. If you require pointer stability, or your values are large,
+// stability. If you require pointer stability, or if your values are large,
// consider using `absl::flat_hash_map<Key, std::unique_ptr<Value>>` instead.
// If your types are not moveable or you require pointer stability for keys,
// consider `absl::node_hash_map`.
diff --git a/absl/container/inlined_vector_test.cc b/absl/container/inlined_vector_test.cc
index 50315b83..60fe89b2 100644
--- a/absl/container/inlined_vector_test.cc
+++ b/absl/container/inlined_vector_test.cc
@@ -76,9 +76,12 @@ TYPED_TEST_SUITE_P(InstanceTest);
// destroyed in the erase(begin, end) test.
class RefCounted {
public:
- RefCounted(int value, int* count) : value_(value), count_(count) { Ref(); }
+ RefCounted(int value, int* count) : value_(value), count_(count) {
+ Ref();
+ }
- RefCounted(const RefCounted& v) : value_(v.value_), count_(v.count_) {
+ RefCounted(const RefCounted& v)
+ : value_(v.value_), count_(v.count_) {
Ref();
}
@@ -287,7 +290,7 @@ TEST(RefCountedVec, EraseBeginEnd) {
}
// 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]);
}
}
@@ -549,10 +552,10 @@ TEST(IntVec, Resize) {
static const int kResizeElem = 1000000;
for (int k = 0; k < 10; k++) {
// Enlarging resize
- v.resize(len + k, kResizeElem);
- EXPECT_EQ(len + k, v.size());
- EXPECT_LE(len + k, v.capacity());
- for (int i = 0; i < len + k; i++) {
+ v.resize(len+k, kResizeElem);
+ EXPECT_EQ(len+k, v.size());
+ EXPECT_LE(len+k, v.capacity());
+ for (int i = 0; i < len+k; i++) {
if (i < len) {
EXPECT_EQ(i, v[i]);
} else {
@@ -863,7 +866,7 @@ TYPED_TEST_P(InstanceTest, Swap) {
auto min_len = std::min(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 < 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);
tracker.ResetCopiesMovesSwaps();
{
@@ -931,7 +934,7 @@ TEST(IntVec, EqualAndNotEqual) {
EXPECT_FALSE(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_FALSE(a != b);
}
@@ -998,7 +1001,7 @@ TYPED_TEST_P(InstanceTest, CountConstructorsDestructors) {
// reserve() must not increase the number of initialized objects
SCOPED_TRACE("reserve");
- v.reserve(len + 1000);
+ v.reserve(len+1000);
EXPECT_EQ(tracker.instances(), len);
EXPECT_EQ(tracker.copies() + tracker.moves(), len);
@@ -1244,8 +1247,9 @@ void InstanceCountElemAssignWithAllocationTest() {
absl::InlinedVector<Instance, 2> v(original_contents.begin(),
original_contents.end());
v.assign(3, Instance(123));
- EXPECT_THAT(v, AllOf(SizeIs(3), ElementsAre(ValueIs(123), ValueIs(123),
- ValueIs(123))));
+ EXPECT_THAT(v,
+ AllOf(SizeIs(3),
+ ElementsAre(ValueIs(123), ValueIs(123), ValueIs(123))));
EXPECT_LE(v.size(), v.capacity());
}
}
@@ -1524,8 +1528,8 @@ TYPED_TEST_P(InstanceTest, InitializerListAssign) {
SCOPED_TRACE(original_size);
absl::InlinedVector<Instance, 2> v(original_size, Instance(12345));
v.assign({Instance(3), Instance(4), Instance(5)});
- EXPECT_THAT(
- v, AllOf(SizeIs(3), ElementsAre(ValueIs(3), ValueIs(4), ValueIs(5))));
+ EXPECT_THAT(v, AllOf(SizeIs(3),
+ ElementsAre(ValueIs(3), ValueIs(4), ValueIs(5))));
EXPECT_LE(3, v.capacity());
}
}
@@ -1550,7 +1554,7 @@ TEST(DynamicVec, DynamicVecCompiles) {
TEST(AllocatorSupportTest, Constructors) {
using MyAlloc = CountingAllocator<int>;
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;
MyAlloc alloc(&allocated);
{ AllocVec ABSL_ATTRIBUTE_UNUSED v; }
@@ -1566,7 +1570,7 @@ TEST(AllocatorSupportTest, Constructors) {
TEST(AllocatorSupportTest, CountAllocations) {
using MyAlloc = CountingAllocator<int>;
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;
MyAlloc alloc(&allocated);
{
@@ -1630,8 +1634,8 @@ TEST(AllocatorSupportTest, SwapBothAllocated) {
int64_t allocated1 = 0;
int64_t allocated2 = 0;
{
- 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 ia1[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
+ const int ia2[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
MyAlloc a1(&allocated1);
MyAlloc a2(&allocated2);
AllocVec v1(ia1, ia1 + ABSL_ARRAYSIZE(ia1), a1);
@@ -1655,8 +1659,8 @@ TEST(AllocatorSupportTest, SwapOneAllocated) {
int64_t allocated1 = 0;
int64_t allocated2 = 0;
{
- const int ia1[] = {0, 1, 2, 3, 4, 5, 6, 7};
- const int ia2[] = {0, 1, 2, 3};
+ const int ia1[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
+ const int ia2[] = { 0, 1, 2, 3 };
MyAlloc a1(&allocated1);
MyAlloc a2(&allocated2);
AllocVec v1(ia1, ia1 + ABSL_ARRAYSIZE(ia1), a1);
@@ -1677,42 +1681,65 @@ TEST(AllocatorSupportTest, SwapOneAllocated) {
TEST(AllocatorSupportTest, ScopedAllocatorWorks) {
using StdVector = std::vector<int, CountingAllocator<int>>;
- using Alloc = CountingAllocator<StdVector>;
- using ScopedAlloc = std::scoped_allocator_adaptor<Alloc>;
- using AllocVec = absl::InlinedVector<StdVector, 1, ScopedAlloc>;
-
- {
- int64_t total_allocated_byte_count = 0;
-
- AllocVec inlined_case(ScopedAlloc(Alloc(+&total_allocated_byte_count)));
- inlined_case.emplace_back();
-
- int64_t absl_responsible_for_count = total_allocated_byte_count;
- EXPECT_EQ(absl_responsible_for_count, 0);
-
- inlined_case[0].emplace_back();
- EXPECT_GT(total_allocated_byte_count, absl_responsible_for_count);
-
- inlined_case.clear();
- EXPECT_EQ(total_allocated_byte_count, 0);
- }
-
- {
- int64_t total_allocated_byte_count = 0;
-
- AllocVec allocated_case(ScopedAlloc(Alloc(+&total_allocated_byte_count)));
- allocated_case.emplace_back();
- allocated_case.emplace_back();
-
- int64_t absl_responsible_for_count = total_allocated_byte_count;
- EXPECT_GT(absl_responsible_for_count, 0);
+ using MyAlloc =
+ std::scoped_allocator_adaptor<CountingAllocator<StdVector>>;
+ using AllocVec = absl::InlinedVector<StdVector, 4, MyAlloc>;
+
+ // MSVC 2017's std::vector allocates different amounts of memory in debug
+ // versus opt mode.
+ int64_t test_allocated = 0;
+ StdVector v(CountingAllocator<int>{&test_allocated});
+ // The amount of memory allocated by a default constructed vector<int>
+ auto default_std_vec_allocated = test_allocated;
+ v.push_back(1);
+ // The amound of memory allocated by a copy-constructed vector<int> with one
+ // element.
+ int64_t one_element_std_vec_copy_allocated = test_allocated;
- allocated_case[1].emplace_back();
- EXPECT_GT(total_allocated_byte_count, absl_responsible_for_count);
+ int64_t allocated = 0;
+ AllocVec vec(MyAlloc{CountingAllocator<StdVector>{&allocated}});
+ EXPECT_EQ(allocated, 0);
- allocated_case.clear();
- EXPECT_EQ(total_allocated_byte_count, 0);
- }
+ // This default constructs a vector<int>, but the allocator should pass itself
+ // into the vector<int>, so check allocation compared to that.
+ // The absl::InlinedVector does not allocate any memory.
+ // The vector<int> may allocate any memory.
+ auto expected = default_std_vec_allocated;
+ vec.resize(1);
+ EXPECT_EQ(allocated, expected);
+
+ // We make vector<int> allocate memory.
+ // It must go through the allocator even though we didn't construct the
+ // vector directly. This assumes that vec[0] doesn't need to grow its
+ // allocation.
+ expected += sizeof(int);
+ vec[0].push_back(1);
+ EXPECT_EQ(allocated, expected);
+
+ // Another allocating vector.
+ expected += one_element_std_vec_copy_allocated;
+ vec.push_back(vec[0]);
+ EXPECT_EQ(allocated, expected);
+
+ // Overflow the inlined memory.
+ // The absl::InlinedVector will now allocate.
+ expected += sizeof(StdVector) * 8 + default_std_vec_allocated * 3;
+ vec.resize(5);
+ EXPECT_EQ(allocated, expected);
+
+ // Adding one more in external mode should also work.
+ expected += one_element_std_vec_copy_allocated;
+ vec.push_back(vec[0]);
+ EXPECT_EQ(allocated, expected);
+
+ // And extending these should still work. This assumes that vec[0] does not
+ // need to grow its allocation.
+ expected += sizeof(int);
+ vec[0].push_back(1);
+ EXPECT_EQ(allocated, expected);
+
+ vec.clear();
+ EXPECT_EQ(allocated, 0);
}
TEST(AllocatorSupportTest, SizeAllocConstructor) {
diff --git a/absl/container/internal/compressed_tuple.h b/absl/container/internal/compressed_tuple.h
index 1713ad68..c29ab41e 100644
--- a/absl/container/internal/compressed_tuple.h
+++ b/absl/container/internal/compressed_tuple.h
@@ -188,6 +188,9 @@ class ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTuple
template <int I>
using ElemT = internal_compressed_tuple::ElemT<CompressedTuple, I>;
+ template <int I>
+ using StorageT = internal_compressed_tuple::Storage<ElemT<I>, I>;
+
public:
constexpr CompressedTuple() = default;
explicit constexpr CompressedTuple(Ts... base)
@@ -200,19 +203,17 @@ class ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTuple
template <int I>
constexpr const ElemT<I>& get() const& {
- return internal_compressed_tuple::Storage<ElemT<I>, I>::get();
+ return StorageT<I>::get();
}
template <int I>
ElemT<I>&& get() && {
- return std::move(*this)
- .internal_compressed_tuple::template Storage<ElemT<I>, I>::get();
+ return std::move(*this).StorageT<I>::get();
}
template <int I>
constexpr const ElemT<I>&& get() const&& {
- return absl::move(*this)
- .internal_compressed_tuple::template Storage<ElemT<I>, I>::get();
+ return absl::move(*this).StorageT<I>::get();
}
};
diff --git a/absl/container/internal/inlined_vector.h b/absl/container/internal/inlined_vector.h
index 84b97791..0ab2d7da 100644
--- a/absl/container/internal/inlined_vector.h
+++ b/absl/container/internal/inlined_vector.h
@@ -402,6 +402,16 @@ class Storage {
return current_capacity * 2;
}
+ static size_type LegacyNextCapacityFrom(size_type current_capacity,
+ size_type requested_capacity) {
+ // TODO(johnsoncj): Get rid of this old behavior.
+ size_type new_capacity = current_capacity;
+ while (new_capacity < requested_capacity) {
+ new_capacity *= 2;
+ }
+ return new_capacity;
+ }
+
using Metadata =
container_internal::CompressedTuple<allocator_type, size_type>;
@@ -512,7 +522,8 @@ auto Storage<T, N, A>::Resize(ValueAdapter values, size_type new_size) -> void {
absl::Span<value_type> destroy_loop;
if (new_size > storage_view.capacity) {
- pointer new_data = allocation_tx.Allocate(new_size);
+ pointer new_data = allocation_tx.Allocate(
+ LegacyNextCapacityFrom(storage_view.capacity, new_size));
// Construct new objects in `new_data`
construct_loop = {new_data + storage_view.size,
@@ -632,7 +643,8 @@ auto Storage<T, N, A>::Reserve(size_type requested_capacity) -> void {
IteratorValueAdapter<MoveIterator> move_values(
MoveIterator(storage_view.data));
- pointer new_data = allocation_tx.Allocate(requested_capacity);
+ pointer new_data = allocation_tx.Allocate(
+ LegacyNextCapacityFrom(storage_view.capacity, requested_capacity));
inlined_vector_internal::ConstructElements(GetAllocPtr(), new_data,
&move_values, storage_view.size);
diff --git a/absl/copts/GENERATED_AbseilCopts.cmake b/absl/copts/GENERATED_AbseilCopts.cmake
index 88400e98..01bd40b2 100644
--- a/absl/copts/GENERATED_AbseilCopts.cmake
+++ b/absl/copts/GENERATED_AbseilCopts.cmake
@@ -77,7 +77,6 @@ list(APPEND ABSL_CLANG_CL_TEST_FLAGS
"-Wno-unused-template"
"-Wno-used-but-marked-unused"
"-Wno-zero-as-null-pointer-constant"
- "-Wno-gnu-include-next"
"-Wno-gnu-zero-variadic-macro-arguments"
)
@@ -181,7 +180,6 @@ list(APPEND ABSL_LLVM_TEST_FLAGS
"-Wno-unused-template"
"-Wno-used-but-marked-unused"
"-Wno-zero-as-null-pointer-constant"
- "-Wno-gnu-include-next"
"-Wno-gnu-zero-variadic-macro-arguments"
)
diff --git a/absl/copts/GENERATED_copts.bzl b/absl/copts/GENERATED_copts.bzl
index d7edc936..82f332f4 100644
--- a/absl/copts/GENERATED_copts.bzl
+++ b/absl/copts/GENERATED_copts.bzl
@@ -78,7 +78,6 @@ ABSL_CLANG_CL_TEST_FLAGS = [
"-Wno-unused-template",
"-Wno-used-but-marked-unused",
"-Wno-zero-as-null-pointer-constant",
- "-Wno-gnu-include-next",
"-Wno-gnu-zero-variadic-macro-arguments",
]
@@ -182,7 +181,6 @@ ABSL_LLVM_TEST_FLAGS = [
"-Wno-unused-template",
"-Wno-used-but-marked-unused",
"-Wno-zero-as-null-pointer-constant",
- "-Wno-gnu-include-next",
"-Wno-gnu-zero-variadic-macro-arguments",
]
diff --git a/absl/copts/copts.py b/absl/copts/copts.py
index d850bb4f..068abceb 100644
--- a/absl/copts/copts.py
+++ b/absl/copts/copts.py
@@ -105,8 +105,6 @@ LLVM_TEST_DISABLE_WARNINGS_FLAGS = [
"-Wno-unused-template",
"-Wno-used-but-marked-unused",
"-Wno-zero-as-null-pointer-constant",
- # For a libc++ bug fixed in r357267
- "-Wno-gnu-include-next",
# gtest depends on this GNU extension being offered.
"-Wno-gnu-zero-variadic-macro-arguments",
]
diff --git a/absl/debugging/symbolize_elf.inc b/absl/debugging/symbolize_elf.inc
index 5ac7ff5d..e7305213 100644
--- a/absl/debugging/symbolize_elf.inc
+++ b/absl/debugging/symbolize_elf.inc
@@ -762,37 +762,27 @@ FindSymbolResult Symbolizer::GetSymbolFromObjectFile(
}
}
- // Consult a regular symbol table first.
- if (!GetSectionHeaderByType(obj.fd, obj.elf_header.e_shnum,
- obj.elf_header.e_shoff, SHT_SYMTAB, &symtab,
- tmp_buf, tmp_buf_size)) {
- return SYMBOL_NOT_FOUND;
- }
- if (!ReadFromOffsetExact(
- obj.fd, &strtab, sizeof(strtab),
- obj.elf_header.e_shoff + symtab.sh_link * sizeof(symtab))) {
- return SYMBOL_NOT_FOUND;
- }
- const FindSymbolResult rc =
- FindSymbol(pc, obj.fd, out, out_size, relocation, &strtab, &symtab,
- opd_ptr, tmp_buf, tmp_buf_size);
- if (rc != SYMBOL_NOT_FOUND) {
- return rc; // Found the symbol in a regular symbol table.
+ // Consult a regular symbol table, then fall back to the dynamic symbol table.
+ for (const auto symbol_table_type : {SHT_SYMTAB, SHT_DYNSYM}) {
+ if (!GetSectionHeaderByType(obj.fd, obj.elf_header.e_shnum,
+ obj.elf_header.e_shoff, symbol_table_type,
+ &symtab, tmp_buf, tmp_buf_size)) {
+ continue;
+ }
+ if (!ReadFromOffsetExact(
+ obj.fd, &strtab, sizeof(strtab),
+ obj.elf_header.e_shoff + symtab.sh_link * sizeof(symtab))) {
+ continue;
+ }
+ const FindSymbolResult rc =
+ FindSymbol(pc, obj.fd, out, out_size, relocation, &strtab, &symtab,
+ opd_ptr, tmp_buf, tmp_buf_size);
+ if (rc != SYMBOL_NOT_FOUND) {
+ return rc;
+ }
}
- // If the symbol is not found, then consult a dynamic symbol table.
- if (!GetSectionHeaderByType(obj.fd, obj.elf_header.e_shnum,
- obj.elf_header.e_shoff, SHT_DYNSYM, &symtab,
- tmp_buf, tmp_buf_size)) {
- return SYMBOL_NOT_FOUND;
- }
- if (!ReadFromOffsetExact(
- obj.fd, &strtab, sizeof(strtab),
- obj.elf_header.e_shoff + symtab.sh_link * sizeof(symtab))) {
- return SYMBOL_NOT_FOUND;
- }
- return FindSymbol(pc, obj.fd, out, out_size, relocation, &strtab, &symtab,
- opd_ptr, tmp_buf, tmp_buf_size);
+ return SYMBOL_NOT_FOUND;
}
namespace {
diff --git a/absl/random/internal/BUILD.bazel b/absl/random/internal/BUILD.bazel
index c9e4e880..fd5471a6 100644
--- a/absl/random/internal/BUILD.bazel
+++ b/absl/random/internal/BUILD.bazel
@@ -522,7 +522,7 @@ cc_test(
cc_test(
name = "randen_engine_test",
- size = "small",
+ size = "medium",
srcs = [
"randen_engine_test.cc",
],
@@ -598,12 +598,12 @@ cc_library(
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
+ ":distribution_impl",
+ ":fast_uniform_bits",
+ ":iostream_state_saver",
+ ":traits",
"//absl/base:core_headers",
"//absl/meta:type_traits",
- "//absl/random/internal:distribution_impl",
- "//absl/random/internal:fast_uniform_bits",
- "//absl/random/internal:iostream_state_saver",
- "//absl/random/internal:traits",
],
)
diff --git a/absl/strings/BUILD.bazel b/absl/strings/BUILD.bazel
index f18b1600..20511a35 100644
--- a/absl/strings/BUILD.bazel
+++ b/absl/strings/BUILD.bazel
@@ -559,7 +559,6 @@ cc_library(
":strings",
"//absl/base:config",
"//absl/base:core_headers",
- "//absl/container:inlined_vector",
"//absl/meta:type_traits",
"//absl/numeric:int128",
"//absl/types:span",
diff --git a/absl/strings/CMakeLists.txt b/absl/strings/CMakeLists.txt
index f7821290..e63eec19 100644
--- a/absl/strings/CMakeLists.txt
+++ b/absl/strings/CMakeLists.txt
@@ -387,7 +387,6 @@ absl_cc_library(
absl::strings
absl::config
absl::core_headers
- absl::inlined_vector
absl::type_traits
absl::int128
absl::span
diff --git a/absl/strings/internal/str_format/bind.h b/absl/strings/internal/str_format/bind.h
index 4f782952..7df140a4 100644
--- a/absl/strings/internal/str_format/bind.h
+++ b/absl/strings/internal/str_format/bind.h
@@ -7,7 +7,6 @@
#include <string>
#include "absl/base/port.h"
-#include "absl/container/inlined_vector.h"
#include "absl/strings/internal/str_format/arg.h"
#include "absl/strings/internal/str_format/checker.h"
#include "absl/strings/internal/str_format/parser.h"
@@ -138,7 +137,17 @@ class Streamable {
public:
Streamable(const UntypedFormatSpecImpl& format,
absl::Span<const FormatArgImpl> args)
- : format_(format), args_(args.begin(), args.end()) {}
+ : format_(format) {
+ if (args.size() <= ABSL_ARRAYSIZE(few_args_)) {
+ for (size_t i = 0; i < args.size(); ++i) {
+ few_args_[i] = args[i];
+ }
+ args_ = absl::MakeSpan(few_args_, args.size());
+ } else {
+ many_args_.assign(args.begin(), args.end());
+ args_ = many_args_;
+ }
+ }
std::ostream& Print(std::ostream& os) const;
@@ -148,7 +157,12 @@ class Streamable {
private:
const UntypedFormatSpecImpl& format_;
- absl::InlinedVector<FormatArgImpl, 4> args_;
+ absl::Span<const FormatArgImpl> args_;
+ // if args_.size() is 4 or less:
+ FormatArgImpl few_args_[4] = {FormatArgImpl(0), FormatArgImpl(0),
+ FormatArgImpl(0), FormatArgImpl(0)};
+ // if args_.size() is more than 4:
+ std::vector<FormatArgImpl> many_args_;
};
// for testing
diff --git a/absl/strings/str_format_test.cc b/absl/strings/str_format_test.cc
index 96c62349..cfd81bb3 100644
--- a/absl/strings/str_format_test.cc
+++ b/absl/strings/str_format_test.cc
@@ -30,8 +30,8 @@ TEST_F(FormatEntryPointTest, UntypedFormat) {
"",
"a",
"%80d",
-#if !defined(_MSC_VER) && !defined(__ANDROID__)
- // MSVC and Android don't support positional syntax.
+#if !defined(_MSC_VER) && !defined(__ANDROID__) && !defined(__native_client__)
+ // MSVC, NaCL and Android don't support positional syntax.
"complicated multipart %% %1$d format %1$0999d",
#endif // _MSC_VER
};
@@ -153,17 +153,20 @@ TEST_F(FormatEntryPointTest, Stream) {
"",
"a",
"%80d",
-#if !defined(_MSC_VER) && !defined(__ANDROID__)
- // MSVC doesn't support positional syntax.
+ "%d %u %c %s %f %g",
+#if !defined(_MSC_VER) && !defined(__ANDROID__) && !defined(__native_client__)
+ // MSVC, NaCL and Android don't support positional syntax.
"complicated multipart %% %1$d format %1$080d",
#endif // _MSC_VER
};
std::string buf(4096, '\0');
for (const auto& fmt : formats) {
- const auto parsed = ParsedFormat<'d'>::NewAllowIgnored(fmt);
+ const auto parsed =
+ ParsedFormat<'d', 'u', 'c', 's', 'f', 'g'>::NewAllowIgnored(fmt);
std::ostringstream oss;
- oss << StreamFormat(*parsed, 123);
- int fmt_result = snprintf(&*buf.begin(), buf.size(), fmt.c_str(), 123);
+ oss << StreamFormat(*parsed, 123, 3, 49, "multistreaming!!!", 1.01, 1.01);
+ int fmt_result = snprintf(&*buf.begin(), buf.size(), fmt.c_str(), //
+ 123, 3, 49, "multistreaming!!!", 1.01, 1.01);
ASSERT_TRUE(oss) << fmt;
ASSERT_TRUE(fmt_result >= 0 && static_cast<size_t>(fmt_result) < buf.size())
<< fmt_result;
diff --git a/absl/time/civil_time.h b/absl/time/civil_time.h
index 6bb7eec7..beaf7d89 100644
--- a/absl/time/civil_time.h
+++ b/absl/time/civil_time.h
@@ -370,15 +370,15 @@ using Weekday = time_internal::cctz::weekday;
// GetWeekday()
//
-// Returns the absl::Weekday for the given absl::CivilDay.
+// Returns the absl::Weekday for the given (realigned) civil-time value.
//
// Example:
//
// absl::CivilDay a(2015, 8, 13);
// absl::Weekday wd = absl::GetWeekday(a); // wd == absl::Weekday::thursday
//
-inline Weekday GetWeekday(CivilDay cd) {
- return time_internal::cctz::get_weekday(cd);
+inline Weekday GetWeekday(CivilSecond cs) {
+ return time_internal::cctz::get_weekday(cs);
}
// NextWeekday()
@@ -420,7 +420,7 @@ inline CivilDay PrevWeekday(CivilDay cd, Weekday wd) {
// GetYearDay()
//
-// Returns the day-of-year for the given absl::CivilDay.
+// Returns the day-of-year for the given (realigned) civil-time value.
//
// Example:
//
@@ -429,8 +429,8 @@ inline CivilDay PrevWeekday(CivilDay cd, Weekday wd) {
// absl::CivilDay b(2015, 12, 31);
// int yd_dec_31 = absl::GetYearDay(b); // yd_dec_31 = 365
//
-inline int GetYearDay(CivilDay cd) {
- return time_internal::cctz::get_yearday(cd);
+inline int GetYearDay(CivilSecond cs) {
+ return time_internal::cctz::get_yearday(cs);
}
// FormatCivilTime()
diff --git a/absl/time/civil_time_test.cc b/absl/time/civil_time_test.cc
index 070f0d57..03cd1f12 100644
--- a/absl/time/civil_time_test.cc
+++ b/absl/time/civil_time_test.cc
@@ -616,6 +616,8 @@ TEST(CivilTime, Properties) {
EXPECT_EQ(4, ss.hour());
EXPECT_EQ(5, ss.minute());
EXPECT_EQ(6, ss.second());
+ EXPECT_EQ(absl::Weekday::tuesday, absl::GetWeekday(ss));
+ EXPECT_EQ(34, absl::GetYearDay(ss));
absl::CivilMinute mm(2015, 2, 3, 4, 5, 6);
EXPECT_EQ(2015, mm.year());
@@ -624,6 +626,8 @@ TEST(CivilTime, Properties) {
EXPECT_EQ(4, mm.hour());
EXPECT_EQ(5, mm.minute());
EXPECT_EQ(0, mm.second());
+ EXPECT_EQ(absl::Weekday::tuesday, absl::GetWeekday(mm));
+ EXPECT_EQ(34, absl::GetYearDay(mm));
absl::CivilHour hh(2015, 2, 3, 4, 5, 6);
EXPECT_EQ(2015, hh.year());
@@ -632,6 +636,8 @@ TEST(CivilTime, Properties) {
EXPECT_EQ(4, hh.hour());
EXPECT_EQ(0, hh.minute());
EXPECT_EQ(0, hh.second());
+ EXPECT_EQ(absl::Weekday::tuesday, absl::GetWeekday(hh));
+ EXPECT_EQ(34, absl::GetYearDay(hh));
absl::CivilDay d(2015, 2, 3, 4, 5, 6);
EXPECT_EQ(2015, d.year());
@@ -640,6 +646,8 @@ TEST(CivilTime, Properties) {
EXPECT_EQ(0, d.hour());
EXPECT_EQ(0, d.minute());
EXPECT_EQ(0, d.second());
+ EXPECT_EQ(absl::Weekday::tuesday, absl::GetWeekday(d));
+ EXPECT_EQ(34, absl::GetYearDay(d));
absl::CivilMonth m(2015, 2, 3, 4, 5, 6);
EXPECT_EQ(2015, m.year());
@@ -648,6 +656,8 @@ TEST(CivilTime, Properties) {
EXPECT_EQ(0, m.hour());
EXPECT_EQ(0, m.minute());
EXPECT_EQ(0, m.second());
+ EXPECT_EQ(absl::Weekday::sunday, absl::GetWeekday(m));
+ EXPECT_EQ(32, absl::GetYearDay(m));
absl::CivilYear y(2015, 2, 3, 4, 5, 6);
EXPECT_EQ(2015, y.year());
@@ -656,6 +666,8 @@ TEST(CivilTime, Properties) {
EXPECT_EQ(0, y.hour());
EXPECT_EQ(0, y.minute());
EXPECT_EQ(0, y.second());
+ EXPECT_EQ(absl::Weekday::thursday, absl::GetWeekday(y));
+ EXPECT_EQ(1, absl::GetYearDay(y));
}
TEST(CivilTime, Format) {
diff --git a/absl/time/internal/cctz/include/cctz/civil_time_detail.h b/absl/time/internal/cctz/include/cctz/civil_time_detail.h
index 0dcb1ad4..433078a7 100644
--- a/absl/time/internal/cctz/include/cctz/civil_time_detail.h
+++ b/absl/time/internal/cctz/include/cctz/civil_time_detail.h
@@ -535,8 +535,7 @@ enum class weekday {
sunday,
};
-template <typename T>
-CONSTEXPR_F weekday get_weekday(const civil_time<T>& ct) noexcept {
+CONSTEXPR_F weekday get_weekday(const civil_second& cs) noexcept {
CONSTEXPR_D weekday k_weekday_by_mon_off[13] = {
weekday::monday, weekday::tuesday, weekday::wednesday,
weekday::thursday, weekday::friday, weekday::saturday,
@@ -547,9 +546,9 @@ CONSTEXPR_F weekday get_weekday(const civil_time<T>& ct) noexcept {
CONSTEXPR_D int k_weekday_offsets[1 + 12] = {
-1, 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4,
};
- year_t wd = 2400 + (ct.year() % 400) - (ct.month() < 3);
+ year_t wd = 2400 + (cs.year() % 400) - (cs.month() < 3);
wd += wd / 4 - wd / 100 + wd / 400;
- wd += k_weekday_offsets[ct.month()] + ct.day();
+ wd += k_weekday_offsets[cs.month()] + cs.day();
return k_weekday_by_mon_off[wd % 7 + 6];
}
@@ -595,13 +594,12 @@ CONSTEXPR_F civil_day prev_weekday(civil_day cd, weekday wd) noexcept {
}
}
-template <typename T>
-CONSTEXPR_F int get_yearday(const civil_time<T>& ct) noexcept {
+CONSTEXPR_F int get_yearday(const civil_second& cs) noexcept {
CONSTEXPR_D int k_month_offsets[1 + 12] = {
-1, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334,
};
- const int feb29 = (ct.month() > 2 && impl::is_leap_year(ct.year()));
- return k_month_offsets[ct.month()] + feb29 + ct.day();
+ const int feb29 = (cs.month() > 2 && impl::is_leap_year(cs.year()));
+ return k_month_offsets[cs.month()] + feb29 + cs.day();
}
////////////////////////////////////////////////////////////////////////
diff --git a/absl/time/internal/cctz/src/time_zone_info.cc b/absl/time/internal/cctz/src/time_zone_info.cc
index 184bd434..72bb3bde 100644
--- a/absl/time/internal/cctz/src/time_zone_info.cc
+++ b/absl/time/internal/cctz/src/time_zone_info.cc
@@ -505,9 +505,9 @@ bool TimeZoneInfo::Load(const std::string& name, ZoneInfoSource* zip) {
if (tzh.tzh_version[0] != '\0') {
// Snarf up the NL-enclosed future POSIX spec. Note
// that version '3' files utilize an extended format.
- auto get_char = [](ZoneInfoSource* zip) -> int {
+ auto get_char = [](ZoneInfoSource* azip) -> int {
unsigned char ch; // all non-EOF results are positive
- return (zip->Read(&ch, 1) == 1) ? ch : EOF;
+ return (azip->Read(&ch, 1) == 1) ? ch : EOF;
};
if (get_char(zip) != '\n')
return false;
diff --git a/absl/time/time.cc b/absl/time/time.cc
index 338c4523..6a387bce 100644
--- a/absl/time/time.cc
+++ b/absl/time/time.cc
@@ -457,8 +457,7 @@ struct tm ToTM(absl::Time t, absl::TimeZone tz) {
tm.tm_year = static_cast<int>(cs.year() - 1900);
}
- const CivilDay cd(cs);
- switch (GetWeekday(cd)) {
+ switch (GetWeekday(cs)) {
case Weekday::sunday:
tm.tm_wday = 0;
break;
@@ -481,7 +480,7 @@ struct tm ToTM(absl::Time t, absl::TimeZone tz) {
tm.tm_wday = 6;
break;
}
- tm.tm_yday = GetYearDay(cd) - 1;
+ tm.tm_yday = GetYearDay(cs) - 1;
tm.tm_isdst = ci.is_dst ? 1 : 0;
return tm;
diff --git a/absl/time/time_test.cc b/absl/time/time_test.cc
index e2b2f809..37af39d9 100644
--- a/absl/time/time_test.cc
+++ b/absl/time/time_test.cc
@@ -112,7 +112,7 @@ TEST(Time, UnixEpoch) {
const auto ci = absl::UTCTimeZone().At(absl::UnixEpoch());
EXPECT_EQ(absl::CivilSecond(1970, 1, 1, 0, 0, 0), ci.cs);
EXPECT_EQ(absl::ZeroDuration(), ci.subsecond);
- EXPECT_EQ(absl::Weekday::thursday, absl::GetWeekday(absl::CivilDay(ci.cs)));
+ EXPECT_EQ(absl::Weekday::thursday, absl::GetWeekday(ci.cs));
}
TEST(Time, Breakdown) {
@@ -123,14 +123,14 @@ TEST(Time, Breakdown) {
auto ci = tz.At(t);
EXPECT_CIVIL_INFO(ci, 1969, 12, 31, 19, 0, 0, -18000, false);
EXPECT_EQ(absl::ZeroDuration(), ci.subsecond);
- EXPECT_EQ(absl::Weekday::wednesday, absl::GetWeekday(absl::CivilDay(ci.cs)));
+ EXPECT_EQ(absl::Weekday::wednesday, absl::GetWeekday(ci.cs));
// Just before the epoch.
t -= absl::Nanoseconds(1);
ci = tz.At(t);
EXPECT_CIVIL_INFO(ci, 1969, 12, 31, 18, 59, 59, -18000, false);
EXPECT_EQ(absl::Nanoseconds(999999999), ci.subsecond);
- EXPECT_EQ(absl::Weekday::wednesday, absl::GetWeekday(absl::CivilDay(ci.cs)));
+ EXPECT_EQ(absl::Weekday::wednesday, absl::GetWeekday(ci.cs));
// Some time later.
t += absl::Hours(24) * 2735;
@@ -139,7 +139,7 @@ TEST(Time, Breakdown) {
ci = tz.At(t);
EXPECT_CIVIL_INFO(ci, 1977, 6, 28, 14, 30, 15, -14400, true);
EXPECT_EQ(8, ci.subsecond / absl::Nanoseconds(1));
- EXPECT_EQ(absl::Weekday::tuesday, absl::GetWeekday(absl::CivilDay(ci.cs)));
+ EXPECT_EQ(absl::Weekday::tuesday, absl::GetWeekday(ci.cs));
}
TEST(Time, AdditiveOperators) {
@@ -979,15 +979,15 @@ TEST(Time, ConversionSaturation) {
EXPECT_CIVIL_INFO(ci, std::numeric_limits<int64_t>::max(), 12, 31, 23,
59, 59, 0, false);
EXPECT_EQ(absl::InfiniteDuration(), ci.subsecond);
- EXPECT_EQ(absl::Weekday::thursday, absl::GetWeekday(absl::CivilDay(ci.cs)));
- EXPECT_EQ(365, absl::GetYearDay(absl::CivilDay(ci.cs)));
+ EXPECT_EQ(absl::Weekday::thursday, absl::GetWeekday(ci.cs));
+ EXPECT_EQ(365, absl::GetYearDay(ci.cs));
EXPECT_STREQ("-00", ci.zone_abbr); // artifact of TimeZone::At()
ci = utc.At(absl::InfinitePast());
EXPECT_CIVIL_INFO(ci, std::numeric_limits<int64_t>::min(), 1, 1, 0, 0,
0, 0, false);
EXPECT_EQ(-absl::InfiniteDuration(), ci.subsecond);
- EXPECT_EQ(absl::Weekday::sunday, absl::GetWeekday(absl::CivilDay(ci.cs)));
- EXPECT_EQ(1, absl::GetYearDay(absl::CivilDay(ci.cs)));
+ EXPECT_EQ(absl::Weekday::sunday, absl::GetWeekday(ci.cs));
+ EXPECT_EQ(1, absl::GetYearDay(ci.cs));
EXPECT_STREQ("-00", ci.zone_abbr); // artifact of TimeZone::At()
// Approach the maximal Time value from below.
diff --git a/absl/types/variant_test.cc b/absl/types/variant_test.cc
index 2efaf21e..85201b3e 100644
--- a/absl/types/variant_test.cc
+++ b/absl/types/variant_test.cc
@@ -2112,7 +2112,8 @@ TEST(VariantTest, Hash) {
// Miscellaneous and deprecated tests //
////////////////////////////////////////
-// Test that a set requiring a basic type conversion works correctly.
+// Test that a set requiring a basic type conversion works correctly
+#if !defined(ABSL_HAVE_STD_VARIANT)
TEST(VariantTest, TestConvertingSet) {
typedef variant<double> Variant;
Variant v(1.0);
@@ -2122,6 +2123,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
// Test that a vector of variants behaves reasonably.
TEST(VariantTest, Container) {
@@ -2273,6 +2275,7 @@ struct Convertible2 {
};
TEST(VariantTest, TestRvalueConversion) {
+#if !defined(ABSL_HAVE_STD_VARIANT)
variant<double, std::string> var(
ConvertVariantTo<variant<double, std::string>>(
variant<std::string, int>(0)));
@@ -2305,6 +2308,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
variant<Convertible1, Convertible2> variant3(
ConvertVariantTo<variant<Convertible1, Convertible2>>(
@@ -2317,6 +2321,7 @@ TEST(VariantTest, TestRvalueConversion) {
}
TEST(VariantTest, TestLvalueConversion) {
+#if !defined(ABSL_HAVE_STD_VARIANT)
variant<std::string, int> source1 = 0;
variant<double, std::string> destination(
ConvertVariantTo<variant<double, std::string>>(source1));
@@ -2353,6 +2358,7 @@ TEST(VariantTest, TestLvalueConversion) {
variant2 = ConvertVariantTo<variant<int32_t, uint32_t>>(source6);
ASSERT_TRUE(absl::holds_alternative<uint32_t>(variant2));
EXPECT_EQ(42, absl::get<uint32_t>(variant2));
+#endif
variant<Convertible2, Convertible1> source7((Convertible1()));
variant<Convertible1, Convertible2> variant3(
@@ -2417,6 +2423,7 @@ TEST(VariantTest, DoesNotMoveFromLvalues) {
}
TEST(VariantTest, TestRvalueConversionViaConvertVariantTo) {
+#if !defined(ABSL_HAVE_STD_VARIANT)
variant<double, std::string> var(
ConvertVariantTo<variant<double, std::string>>(
variant<std::string, int>(3)));
@@ -2442,6 +2449,7 @@ TEST(VariantTest, TestRvalueConversionViaConvertVariantTo) {
variant2 = ConvertVariantTo<variant<int32_t, uint32_t>>(variant<uint32_t>(42));
EXPECT_THAT(absl::get_if<uint32_t>(&variant2), Pointee(42));
+#endif
variant<Convertible1, Convertible2> variant3(
ConvertVariantTo<variant<Convertible1, Convertible2>>(
@@ -2454,6 +2462,7 @@ TEST(VariantTest, TestRvalueConversionViaConvertVariantTo) {
}
TEST(VariantTest, TestLvalueConversionViaConvertVariantTo) {
+#if !defined(ABSL_HAVE_STD_VARIANT)
variant<std::string, int> source1 = 3;
variant<double, std::string> destination(
ConvertVariantTo<variant<double, std::string>>(source1));
@@ -2485,6 +2494,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
variant<Convertible2, Convertible1> source7((Convertible1()));
variant<Convertible1, Convertible2> variant3(
diff --git a/ci/linux_clang-latest_libcxx_asan_bazel.sh b/ci/linux_clang-latest_libcxx_asan_bazel.sh
index 113acdbe..4d1d28a9 100755
--- a/ci/linux_clang-latest_libcxx_asan_bazel.sh
+++ b/ci/linux_clang-latest_libcxx_asan_bazel.sh
@@ -32,7 +32,7 @@ if [ -z ${COMPILATION_MODE:-} ]; then
COMPILATION_MODE="fastbuild opt"
fi
-readonly DOCKER_CONTAINER="gcr.io/google.com/absl-177019/linux_clang-latest:20190508"
+readonly DOCKER_CONTAINER="gcr.io/google.com/absl-177019/linux_clang-latest:20190701"
# USE_BAZEL_CACHE=1 only works on Kokoro.
# Without access to the credentials this won't work.
diff --git a/ci/linux_clang-latest_libcxx_bazel.sh b/ci/linux_clang-latest_libcxx_bazel.sh
index f32cbef7..1197369a 100755
--- a/ci/linux_clang-latest_libcxx_bazel.sh
+++ b/ci/linux_clang-latest_libcxx_bazel.sh
@@ -32,7 +32,7 @@ if [ -z ${COMPILATION_MODE:-} ]; then
COMPILATION_MODE="fastbuild opt"
fi
-readonly DOCKER_CONTAINER="gcr.io/google.com/absl-177019/linux_clang-latest:20190508"
+readonly DOCKER_CONTAINER="gcr.io/google.com/absl-177019/linux_clang-latest:20190701"
# USE_BAZEL_CACHE=1 only works on Kokoro.
# Without access to the credentials this won't work.
diff --git a/ci/linux_clang-latest_libcxx_tsan_bazel.sh b/ci/linux_clang-latest_libcxx_tsan_bazel.sh
index c4edd198..04171df8 100755
--- a/ci/linux_clang-latest_libcxx_tsan_bazel.sh
+++ b/ci/linux_clang-latest_libcxx_tsan_bazel.sh
@@ -32,7 +32,7 @@ if [ -z ${COMPILATION_MODE:-} ]; then
COMPILATION_MODE="fastbuild opt"
fi
-readonly DOCKER_CONTAINER="gcr.io/google.com/absl-177019/linux_clang-latest:20190508"
+readonly DOCKER_CONTAINER="gcr.io/google.com/absl-177019/linux_clang-latest:20190701"
# USE_BAZEL_CACHE=1 only works on Kokoro.
# Without access to the credentials this won't work.
diff --git a/ci/linux_clang-latest_libstdcxx_bazel.sh b/ci/linux_clang-latest_libstdcxx_bazel.sh
index 7bbecd6f..c2217a07 100755
--- a/ci/linux_clang-latest_libstdcxx_bazel.sh
+++ b/ci/linux_clang-latest_libstdcxx_bazel.sh
@@ -32,7 +32,7 @@ if [ -z ${COMPILATION_MODE:-} ]; then
COMPILATION_MODE="fastbuild opt"
fi
-readonly DOCKER_CONTAINER="gcr.io/google.com/absl-177019/linux_clang-latest:20190508"
+readonly DOCKER_CONTAINER="gcr.io/google.com/absl-177019/linux_clang-latest:20190701"
# USE_BAZEL_CACHE=1 only works on Kokoro.
# Without access to the credentials this won't work.
diff --git a/ci/linux_gcc-4.9_libstdcxx_bazel.sh b/ci/linux_gcc-4.9_libstdcxx_bazel.sh
new file mode 100755
index 00000000..bdd3e468
--- /dev/null
+++ b/ci/linux_gcc-4.9_libstdcxx_bazel.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+#
+# 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.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This script that can be invoked to test abseil-cpp in a hermetic environment
+# using a Docker image on Linux. You must have Docker installed to use this
+# script.
+
+set -euox pipefail
+
+if [ -z ${ABSEIL_ROOT:-} ]; then
+ ABSEIL_ROOT="$(realpath $(dirname ${0})/..)"
+fi
+
+if [ -z ${STD:-} ]; then
+ STD="c++11 c++14"
+fi
+
+if [ -z ${COMPILATION_MODE:-} ]; then
+ COMPILATION_MODE="fastbuild opt"
+fi
+
+readonly DOCKER_CONTAINER="gcr.io/google.com/absl-177019/linux_gcc-4.9:20190702"
+
+# USE_BAZEL_CACHE=1 only works on Kokoro.
+# Without access to the credentials this won't work.
+if [ ${USE_BAZEL_CACHE:-0} -ne 0 ]; then
+ DOCKER_EXTRA_ARGS="--volume=${KOKORO_KEYSTORE_DIR}:/keystore:ro ${DOCKER_EXTRA_ARGS:-}"
+ # Bazel doesn't track changes to tools outside of the workspace
+ # (e.g. /usr/bin/gcc), so by appending the docker container to the
+ # remote_http_cache url, we make changes to the container part of
+ # the cache key. Hashing the key is to make it shorter and url-safe.
+ container_key=$(echo ${DOCKER_CONTAINER} | sha256sum | head -c 16)
+ BAZEL_EXTRA_ARGS="--remote_http_cache=https://storage.googleapis.com/absl-bazel-remote-cache/${container_key} --google_credentials=/keystore/73103_absl-bazel-remote-cache ${BAZEL_EXTRA_ARGS:-}"
+fi
+
+for std in ${STD}; do
+ for compilation_mode in ${COMPILATION_MODE}; do
+ echo "--------------------------------------------------------------------"
+ echo "Testing with --compilation_mode=${compilation_mode} and --std=${std}"
+
+ time docker run \
+ --volume="${ABSEIL_ROOT}:/abseil-cpp:ro" \
+ --workdir=/abseil-cpp \
+ --cap-add=SYS_PTRACE \
+ --rm \
+ -e CC="/usr/bin/gcc-4.9" \
+ -e BAZEL_CXXOPTS="-std=${std}" \
+ ${DOCKER_EXTRA_ARGS:-} \
+ ${DOCKER_CONTAINER} \
+ /usr/local/bin/bazel test ... \
+ --compilation_mode=${compilation_mode} \
+ --copt=-Werror \
+ --define="absl=1" \
+ --keep_going \
+ --show_timestamps \
+ --test_env="GTEST_INSTALL_FAILURE_SIGNAL_HANDLER=1" \
+ --test_env="TZDIR=/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo" \
+ --test_output=errors \
+ --test_tag_filters=-benchmark \
+ ${BAZEL_EXTRA_ARGS:-}
+ done
+done
diff --git a/ci/linux_gcc-latest_libstdcxx_bazel.sh b/ci/linux_gcc-latest_libstdcxx_bazel.sh
index 24469628..2ef81114 100755
--- a/ci/linux_gcc-latest_libstdcxx_bazel.sh
+++ b/ci/linux_gcc-latest_libstdcxx_bazel.sh
@@ -32,7 +32,7 @@ if [ -z ${COMPILATION_MODE:-} ]; then
COMPILATION_MODE="fastbuild opt"
fi
-readonly DOCKER_CONTAINER="gcr.io/google.com/absl-177019/linux_gcc-latest:20190318"
+readonly DOCKER_CONTAINER="gcr.io/google.com/absl-177019/linux_gcc-latest:20190701"
# USE_BAZEL_CACHE=1 only works on Kokoro.
# Without access to the credentials this won't work.