about summary refs log tree commit diff
path: root/absl/strings
diff options
context:
space:
mode:
Diffstat (limited to 'absl/strings')
-rw-r--r--absl/strings/CMakeLists.txt9
-rw-r--r--absl/strings/string_view_benchmark.cc10
-rw-r--r--absl/strings/string_view_test.cc4
3 files changed, 11 insertions, 12 deletions
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
 }