From c16d5557cd05119b5b7b1318ef778ebe3195b4a1 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Mon, 22 Oct 2018 11:04:58 -0700 Subject: Export of internal Abseil changes. -- 4e043a11b4c10a24e84046827ee16f47e11e35cc by Abseil Team : Merge of https://github.com/abseil/abseil-cpp/pull/136 PiperOrigin-RevId: 218197648 -- e61f06e1e601061a443feaa8c5207c52437bd641 by Abseil Team : Don't include into int128, it's wasteful Including iostream emits a global constructor for initializing std::cout and friends, which isn't actually used by this file. PiperOrigin-RevId: 218156386 -- 8a6c82396e4c956be7f285328aec131cb4965f16 by Xiaoyi Zhang : Fix MSVC compiler warnings on discarding return values of functions with 'nodiscard' attribute. PiperOrigin-RevId: 217883401 -- abf3e3a0f22bc4070df9dbc9a4ef4d883ed686bf by Tom Manshreck : Update public README to add new libraries PiperOrigin-RevId: 217879399 -- 43b3b420a4e861711abbfbd497b8f2b3de17ec8c by Abseil Team : Import of CCTZ from GitHub. PiperOrigin-RevId: 217780963 -- 1c8831947ca6a65a63842e6bd5f37a7c102a4e1b by Abseil Team : Fix typo in a comment (missing comma in usage example). PiperOrigin-RevId: 217776645 GitOrigin-RevId: 4e043a11b4c10a24e84046827ee16f47e11e35cc Change-Id: I8999ae928da7a0030b4ecfd8d13da8522fdd013a --- absl/strings/CMakeLists.txt | 9 ++++----- absl/strings/string_view_benchmark.cc | 10 +++++----- absl/strings/string_view_test.cc | 4 ++-- 3 files changed, 11 insertions(+), 12 deletions(-) (limited to 'absl/strings') diff --git a/absl/strings/CMakeLists.txt b/absl/strings/CMakeLists.txt index f3e4162387f1..dbb6ae6a4505 100644 --- a/absl/strings/CMakeLists.txt +++ b/absl/strings/CMakeLists.txt @@ -67,7 +67,7 @@ list(APPEND STRINGS_SRC ${STRINGS_PUBLIC_HEADERS} ${STRINGS_INTERNAL_HEADERS} ) -set(STRINGS_PUBLIC_LIBRARIES absl::base absl_throw_delegate) +set(STRINGS_PUBLIC_LIBRARIES absl::base absl_internal_throw_delegate) absl_library( TARGET @@ -207,7 +207,7 @@ absl_test( # test string_view_test set(STRING_VIEW_TEST_SRC "string_view_test.cc") -set(STRING_VIEW_TEST_PUBLIC_LIBRARIES absl::strings absl_throw_delegate absl::base) +set(STRING_VIEW_TEST_PUBLIC_LIBRARIES absl::strings absl_internal_throw_delegate absl::base) absl_test( TARGET @@ -235,7 +235,7 @@ absl_test( # test str_replace_test set(STR_REPLACE_TEST_SRC "str_replace_test.cc") -set(STR_REPLACE_TEST_PUBLIC_LIBRARIES absl::strings absl::base absl_throw_delegate) +set(STR_REPLACE_TEST_PUBLIC_LIBRARIES absl::strings absl::base absl_internal_throw_delegate) absl_test( TARGET @@ -249,7 +249,7 @@ absl_test( # test str_split_test set(STR_SPLIT_TEST_SRC "str_split_test.cc") -set(STR_SPLIT_TEST_PUBLIC_LIBRARIES absl::strings absl::base absl_throw_delegate) +set(STR_SPLIT_TEST_PUBLIC_LIBRARIES absl::strings absl::base absl_internal_throw_delegate) absl_test( TARGET @@ -460,4 +460,3 @@ absl_test( absl::base ) - diff --git a/absl/strings/string_view_benchmark.cc b/absl/strings/string_view_benchmark.cc index fb46db18b3c3..f44203208fe4 100644 --- a/absl/strings/string_view_benchmark.cc +++ b/absl/strings/string_view_benchmark.cc @@ -151,7 +151,7 @@ void BM_find_string_view_len_one(benchmark::State& state) { std::string haystack(state.range(0), '0'); absl::string_view s(haystack); for (auto _ : state) { - s.find("x"); // not present; length 1 + benchmark::DoNotOptimize(s.find("x")); // not present; length 1 } } BENCHMARK(BM_find_string_view_len_one)->Range(1, 1 << 20); @@ -160,7 +160,7 @@ void BM_find_string_view_len_two(benchmark::State& state) { std::string haystack(state.range(0), '0'); absl::string_view s(haystack); for (auto _ : state) { - s.find("xx"); // not present; length 2 + benchmark::DoNotOptimize(s.find("xx")); // not present; length 2 } } BENCHMARK(BM_find_string_view_len_two)->Range(1, 1 << 20); @@ -169,7 +169,7 @@ void BM_find_one_char(benchmark::State& state) { std::string haystack(state.range(0), '0'); absl::string_view s(haystack); for (auto _ : state) { - s.find('x'); // not present + benchmark::DoNotOptimize(s.find('x')); // not present } } BENCHMARK(BM_find_one_char)->Range(1, 1 << 20); @@ -178,7 +178,7 @@ void BM_rfind_one_char(benchmark::State& state) { std::string haystack(state.range(0), '0'); absl::string_view s(haystack); for (auto _ : state) { - s.rfind('x'); // not present + benchmark::DoNotOptimize(s.rfind('x')); // not present } } BENCHMARK(BM_rfind_one_char)->Range(1, 1 << 20); @@ -193,7 +193,7 @@ void BM_worst_case_find_first_of(benchmark::State& state, int haystack_len) { absl::string_view s(haystack); for (auto _ : state) { - s.find_first_of(needle); + benchmark::DoNotOptimize(s.find_first_of(needle)); } } diff --git a/absl/strings/string_view_test.cc b/absl/strings/string_view_test.cc index 217fda04b706..ed34ed83237c 100644 --- a/absl/strings/string_view_test.cc +++ b/absl/strings/string_view_test.cc @@ -678,9 +678,9 @@ TEST(StringViewTest, STL2Substr) { EXPECT_EQ(a.substr(23, absl::string_view::npos), c); // throw exception #ifdef ABSL_HAVE_EXCEPTIONS - EXPECT_THROW(a.substr(99, 2), std::out_of_range); + EXPECT_THROW((void)a.substr(99, 2), std::out_of_range); #else - EXPECT_DEATH(a.substr(99, 2), "absl::string_view::substr"); + EXPECT_DEATH((void)a.substr(99, 2), "absl::string_view::substr"); #endif } -- cgit 1.4.1