Skip to content

Commit

Permalink
Roll abseil_revision fb462224c0..445998d7ac.
Browse files Browse the repository at this point in the history
Change Log:
https://chromium.googlesource.com/external/github.com/abseil/abseil-cpp/+log/fb462224c0..445998d7ac
Full diff:
https://chromium.googlesource.com/external/github.com/abseil/abseil-cpp/+/fb462224c0..445998d7ac

Bug: None
Change-Id: I33633b8471e968656eea5fd6c3c5bd8acba1c188
Reviewed-on: https://chromium-review.googlesource.com/c/1273139
Reviewed-by: Patrik Höglund <phoglund@chromium.org>
Commit-Queue: Mirko Bonadei <mbonadei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599609}
  • Loading branch information
Mirko Bonadei authored and Commit Bot committed Oct 15, 2018
1 parent c840365 commit 6e692ae
Show file tree
Hide file tree
Showing 110 changed files with 19,963 additions and 514 deletions.
6 changes: 3 additions & 3 deletions third_party/abseil-cpp/CMake/AbseilHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ endfunction()
#
# all tests will be register for execution with add_test()
#
# test compilation and execution is disable when BUILD_TESTING=OFF
# test compilation and execution is disable when ABSL_RUN_TESTS=OFF
#
function(absl_test)

Expand All @@ -135,7 +135,7 @@ function(absl_test)
)


if(BUILD_TESTING)
if(ABSL_RUN_TESTS)

set(_NAME ${ABSL_TEST_TARGET})
string(TOUPPER ${_NAME} _UPPER_NAME)
Expand All @@ -153,7 +153,7 @@ function(absl_test)
set_property(TARGET ${_NAME}_bin PROPERTY FOLDER ${ABSL_IDE_FOLDER})

add_test(${_NAME} ${_NAME}_bin)
endif(BUILD_TESTING)
endif(ABSL_RUN_TESTS)

endfunction()

Expand Down
8 changes: 4 additions & 4 deletions third_party/abseil-cpp/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "bazel_toolchains",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/287b64e0a211fb7c23b74695f8d5f5205b61f4eb.tar.gz",
"https://github.com/bazelbuild/bazel-toolchains/archive/287b64e0a211fb7c23b74695f8d5f5205b61f4eb.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/bc09b995c137df042bb80a395b73d7ce6f26afbe.tar.gz",
"https://github.com/bazelbuild/bazel-toolchains/archive/bc09b995c137df042bb80a395b73d7ce6f26afbe.tar.gz",
],
strip_prefix = "bazel-toolchains-287b64e0a211fb7c23b74695f8d5f5205b61f4eb",
sha256 = "aca8ac6afd7745027ee4a43032b51a725a61a75a30f02cc58681ee87e4dcdf4b",
strip_prefix = "bazel-toolchains-bc09b995c137df042bb80a395b73d7ce6f26afbe",
sha256 = "4329663fe6c523425ad4d3c989a8ac026b04e1acedeceb56aa4b190fa7f3973c",
)

# GoogleTest/GoogleMock framework. Used by most unit-tests.
Expand Down
1 change: 1 addition & 0 deletions third_party/abseil-cpp/absl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ add_subdirectory(base)
add_subdirectory(algorithm)
add_subdirectory(container)
add_subdirectory(debugging)
add_subdirectory(hash)
add_subdirectory(memory)
add_subdirectory(meta)
add_subdirectory(numeric)
Expand Down
2 changes: 1 addition & 1 deletion third_party/abseil-cpp/absl/algorithm/container.h
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ BidirectionalIterator c_copy_backward(const C& src,
// Container-based version of the <algorithm> `std::move()` function to move
// a container's elements into an iterator.
template <typename C, typename OutputIterator>
OutputIterator c_move(C& src, OutputIterator dest) {
OutputIterator c_move(C&& src, OutputIterator dest) {
return std::move(container_algorithm_internal::c_begin(src),
container_algorithm_internal::c_end(src), dest);
}
Expand Down
15 changes: 15 additions & 0 deletions third_party/abseil-cpp/absl/algorithm/container_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,21 @@ TEST(MutatingTest, Move) {
Pointee(5)));
}

TEST(MutatingTest, MoveWithRvalue) {
auto MakeRValueSrc = [] {
std::vector<std::unique_ptr<int>> src;
src.emplace_back(absl::make_unique<int>(1));
src.emplace_back(absl::make_unique<int>(2));
src.emplace_back(absl::make_unique<int>(3));
return src;
};

std::vector<std::unique_ptr<int>> dest = MakeRValueSrc();
absl::c_move(MakeRValueSrc(), std::back_inserter(dest));
EXPECT_THAT(dest, ElementsAre(Pointee(1), Pointee(2), Pointee(3), Pointee(1),
Pointee(2), Pointee(3)));
}

TEST(MutatingTest, SwapRanges) {
std::vector<int> odds = {2, 4, 6};
std::vector<int> evens = {1, 3, 5};
Expand Down
10 changes: 10 additions & 0 deletions third_party/abseil-cpp/absl/base/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ cc_test(
size = "medium",
srcs = ["spinlock_test_common.cc"],
copts = ABSL_TEST_COPTS,
tags = ["no_test_wasm"],
deps = [
":base",
":core_headers",
Expand Down Expand Up @@ -343,6 +344,9 @@ cc_test(
name = "config_test",
srcs = ["config_test.cc"],
copts = ABSL_TEST_COPTS,
tags = [
"no_test_wasm",
],
deps = [
":config",
"//absl/synchronization:thread_pool",
Expand All @@ -354,6 +358,9 @@ cc_test(
name = "call_once_test",
srcs = ["call_once_test.cc"],
copts = ABSL_TEST_COPTS,
tags = [
"no_test_wasm",
],
deps = [
":base",
":core_headers",
Expand Down Expand Up @@ -407,6 +414,9 @@ cc_test(
"//absl:windows": [],
"//conditions:default": ["-pthread"],
}),
tags = [
"no_test_wasm",
],
deps = [
":base",
":core_headers",
Expand Down
3 changes: 1 addition & 2 deletions third_party/abseil-cpp/absl/base/attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,7 @@

// ABSL_ATTRIBUTE_UNUSED
//
// Prevents the compiler from complaining about or optimizing away variables
// that appear unused.
// Prevents the compiler from complaining about variables that appear unused.
#if ABSL_HAVE_ATTRIBUTE(unused) || (defined(__GNUC__) && !defined(__clang__))
#undef ABSL_ATTRIBUTE_UNUSED
#define ABSL_ATTRIBUTE_UNUSED __attribute__((__unused__))
Expand Down
62 changes: 31 additions & 31 deletions third_party/abseil-cpp/absl/base/exception_safety_testing_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ template <typename F>
void ExpectNoThrow(const F& f) {
try {
f();
} catch (TestException e) {
} catch (const TestException& e) {
ADD_FAILURE() << "Unexpected exception thrown from " << e.what();
}
}
Expand Down Expand Up @@ -548,21 +548,21 @@ TEST(ExceptionSafetyTesterTest, IncompleteTypesAreNotTestable) {
// Test that providing operation and inveriants still does not allow for the
// the invocation of .Test() and .Test(op) because it lacks a factory
auto without_fac =
testing::MakeExceptionSafetyTester().WithOperation(op).WithInvariants(
testing::MakeExceptionSafetyTester().WithOperation(op).WithContracts(
inv, testing::strong_guarantee);
EXPECT_FALSE(HasNullaryTest(without_fac));
EXPECT_FALSE(HasUnaryTest(without_fac));

// Test that providing invariants and factory allows the invocation of
// Test that providing contracts and factory allows the invocation of
// .Test(op) but does not allow for .Test() because it lacks an operation
auto without_op = testing::MakeExceptionSafetyTester()
.WithInvariants(inv, testing::strong_guarantee)
.WithContracts(inv, testing::strong_guarantee)
.WithFactory(fac);
EXPECT_FALSE(HasNullaryTest(without_op));
EXPECT_TRUE(HasUnaryTest(without_op));

// Test that providing operation and factory still does not allow for the
// the invocation of .Test() and .Test(op) because it lacks invariants
// the invocation of .Test() and .Test(op) because it lacks contracts
auto without_inv =
testing::MakeExceptionSafetyTester().WithOperation(op).WithFactory(fac);
EXPECT_FALSE(HasNullaryTest(without_inv));
Expand All @@ -577,7 +577,7 @@ std::unique_ptr<ExampleStruct> ExampleFunctionFactory() {

void ExampleFunctionOperation(ExampleStruct*) {}

testing::AssertionResult ExampleFunctionInvariant(ExampleStruct*) {
testing::AssertionResult ExampleFunctionContract(ExampleStruct*) {
return testing::AssertionSuccess();
}

Expand All @@ -593,16 +593,16 @@ struct {

struct {
testing::AssertionResult operator()(ExampleStruct* example_struct) const {
return ExampleFunctionInvariant(example_struct);
return ExampleFunctionContract(example_struct);
}
} example_struct_invariant;
} example_struct_contract;

auto example_lambda_factory = []() { return ExampleFunctionFactory(); };

auto example_lambda_operation = [](ExampleStruct*) {};

auto example_lambda_invariant = [](ExampleStruct* example_struct) {
return ExampleFunctionInvariant(example_struct);
auto example_lambda_contract = [](ExampleStruct* example_struct) {
return ExampleFunctionContract(example_struct);
};

// Testing that function references, pointers, structs with operator() and
Expand All @@ -612,28 +612,28 @@ TEST(ExceptionSafetyTesterTest, MixedFunctionTypes) {
EXPECT_TRUE(testing::MakeExceptionSafetyTester()
.WithFactory(ExampleFunctionFactory)
.WithOperation(ExampleFunctionOperation)
.WithInvariants(ExampleFunctionInvariant)
.WithContracts(ExampleFunctionContract)
.Test());

// function pointer
EXPECT_TRUE(testing::MakeExceptionSafetyTester()
.WithFactory(&ExampleFunctionFactory)
.WithOperation(&ExampleFunctionOperation)
.WithInvariants(&ExampleFunctionInvariant)
.WithContracts(&ExampleFunctionContract)
.Test());

// struct
EXPECT_TRUE(testing::MakeExceptionSafetyTester()
.WithFactory(example_struct_factory)
.WithOperation(example_struct_operation)
.WithInvariants(example_struct_invariant)
.WithContracts(example_struct_contract)
.Test());

// lambda
EXPECT_TRUE(testing::MakeExceptionSafetyTester()
.WithFactory(example_lambda_factory)
.WithOperation(example_lambda_operation)
.WithInvariants(example_lambda_invariant)
.WithContracts(example_lambda_contract)
.Test());
}

Expand All @@ -658,9 +658,9 @@ struct {
} invoker;

auto tester =
testing::MakeExceptionSafetyTester().WithOperation(invoker).WithInvariants(
testing::MakeExceptionSafetyTester().WithOperation(invoker).WithContracts(
CheckNonNegativeInvariants);
auto strong_tester = tester.WithInvariants(testing::strong_guarantee);
auto strong_tester = tester.WithContracts(testing::strong_guarantee);

struct FailsBasicGuarantee : public NonNegative {
void operator()() {
Expand Down Expand Up @@ -690,7 +690,7 @@ TEST(ExceptionCheckTest, StrongGuaranteeFailure) {
EXPECT_FALSE(strong_tester.WithInitialValue(FollowsBasicGuarantee{}).Test());
}

struct BasicGuaranteeWithExtraInvariants : public NonNegative {
struct BasicGuaranteeWithExtraContracts : public NonNegative {
// After operator(), i is incremented. If operator() throws, i is set to 9999
void operator()() {
int old_i = i;
Expand All @@ -701,21 +701,21 @@ struct BasicGuaranteeWithExtraInvariants : public NonNegative {

static constexpr int kExceptionSentinel = 9999;
};
constexpr int BasicGuaranteeWithExtraInvariants::kExceptionSentinel;
constexpr int BasicGuaranteeWithExtraContracts::kExceptionSentinel;

TEST(ExceptionCheckTest, BasicGuaranteeWithExtraInvariants) {
TEST(ExceptionCheckTest, BasicGuaranteeWithExtraContracts) {
auto tester_with_val =
tester.WithInitialValue(BasicGuaranteeWithExtraInvariants{});
tester.WithInitialValue(BasicGuaranteeWithExtraContracts{});
EXPECT_TRUE(tester_with_val.Test());
EXPECT_TRUE(
tester_with_val
.WithInvariants([](BasicGuaranteeWithExtraInvariants* o) {
if (o->i == BasicGuaranteeWithExtraInvariants::kExceptionSentinel) {
.WithContracts([](BasicGuaranteeWithExtraContracts* o) {
if (o->i == BasicGuaranteeWithExtraContracts::kExceptionSentinel) {
return testing::AssertionSuccess();
}
return testing::AssertionFailure()
<< "i should be "
<< BasicGuaranteeWithExtraInvariants::kExceptionSentinel
<< BasicGuaranteeWithExtraContracts::kExceptionSentinel
<< ", but is " << o->i;
})
.Test());
Expand All @@ -740,7 +740,7 @@ struct HasReset : public NonNegative {
void reset() { i = 0; }
};

testing::AssertionResult CheckHasResetInvariants(HasReset* h) {
testing::AssertionResult CheckHasResetContracts(HasReset* h) {
h->reset();
return testing::AssertionResult(h->i == 0);
}
Expand All @@ -759,14 +759,14 @@ TEST(ExceptionCheckTest, ModifyingChecker) {
};

EXPECT_FALSE(tester.WithInitialValue(FollowsBasicGuarantee{})
.WithInvariants(set_to_1000, is_1000)
.WithContracts(set_to_1000, is_1000)
.Test());
EXPECT_TRUE(strong_tester.WithInitialValue(FollowsStrongGuarantee{})
.WithInvariants(increment)
.WithContracts(increment)
.Test());
EXPECT_TRUE(testing::MakeExceptionSafetyTester()
.WithInitialValue(HasReset{})
.WithInvariants(CheckHasResetInvariants)
.WithContracts(CheckHasResetContracts)
.Test(invoker));
}

Expand Down Expand Up @@ -799,7 +799,7 @@ TEST(ExceptionCheckTest, NonEqualityComparable) {
return testing::AssertionResult(nec->i == NonEqualityComparable().i);
};
auto strong_nec_tester = tester.WithInitialValue(NonEqualityComparable{})
.WithInvariants(nec_is_strong);
.WithContracts(nec_is_strong);

EXPECT_TRUE(strong_nec_tester.Test());
EXPECT_FALSE(strong_nec_tester.Test(
Expand Down Expand Up @@ -833,14 +833,14 @@ struct {
testing::AssertionResult operator()(ExhaustivenessTester<T>*) const {
return testing::AssertionSuccess();
}
} CheckExhaustivenessTesterInvariants;
} CheckExhaustivenessTesterContracts;

template <typename T>
unsigned char ExhaustivenessTester<T>::successes = 0;

TEST(ExceptionCheckTest, Exhaustiveness) {
auto exhaust_tester = testing::MakeExceptionSafetyTester()
.WithInvariants(CheckExhaustivenessTesterInvariants)
.WithContracts(CheckExhaustivenessTesterContracts)
.WithOperation(invoker);

EXPECT_TRUE(
Expand All @@ -849,7 +849,7 @@ TEST(ExceptionCheckTest, Exhaustiveness) {

EXPECT_TRUE(
exhaust_tester.WithInitialValue(ExhaustivenessTester<ThrowingValue<>>{})
.WithInvariants(testing::strong_guarantee)
.WithContracts(testing::strong_guarantee)
.Test());
EXPECT_EQ(ExhaustivenessTester<ThrowingValue<>>::successes, 0xF);
}
Expand Down
Loading

0 comments on commit 6e692ae

Please sign in to comment.