From 2af990d23fd5e9cd050c697304df7fdb90791091 Mon Sep 17 00:00:00 2001 From: Henner Zeller Date: Tue, 1 Sep 2026 20:23:52 +0200 Subject: [PATCH] Fix some missing includes for std::-symbols Found with `clang-tidy`'s `misc-include-cleaner` checker. Post-processed with clang-format, which then also picked up some other smaller things. Also, gtest is now sorted in the order by the names the gtest headers are accessed. Breakdown: ``` absl/base/internal/exception_safety_testing.h: #include for std::abort absl/base/internal/exception_safety_testing.h: #include for std::bad_alloc absl/base/internal/exception_safety_testing.h: #include for std::bool_constant absl/types/span_test.cc: #include for std::equal absl/base/internal/exception_safety_testing.h: #include for std::index_sequence absl/flags/internal/flag.h: #include for std::index_sequence absl/base/exception_safety_testing_test.cc: #include for std::istringstream absl/types/compare_test.cc: #include for std::less absl/base/internal/exception_safety_testing.h: #include for std::make_shared absl/base/exception_safety_testing_test.cc: #include for std::make_unique absl/strings/string_view.h: #include for std::min absl/base/exception_safety_testing_test.cc: #include for std::move absl/functional/bind_front_test.cc: #include for std::move absl/base/internal/exception_safety_testing.h: #include for std::numeric_limits absl/container/linked_hash_map_test.cc: #include for std::out_of_range absl/types/any_span_test.cc: #include for std::out_of_range absl/status/statusor_test.cc: #include for std::runtime_error absl/base/internal/exception_safety_testing.cc: #include for std::string absl/base/internal/exception_safety_testing.h: #include for std::vector ``` --- absl/base/exception_safety_testing_test.cc | 3 +++ absl/base/internal/exception_safety_testing.cc | 2 ++ absl/base/internal/exception_safety_testing.h | 15 +++++++++++---- absl/container/linked_hash_map_test.cc | 1 + absl/flags/internal/flag.h | 5 +++-- absl/functional/bind_front_test.cc | 5 ++--- absl/status/statusor_test.cc | 1 + absl/strings/string_view.h | 1 + absl/types/any_span_test.cc | 7 ++++--- absl/types/compare_test.cc | 2 ++ absl/types/span_test.cc | 1 + 11 files changed, 31 insertions(+), 12 deletions(-) diff --git a/absl/base/exception_safety_testing_test.cc b/absl/base/exception_safety_testing_test.cc index 7cf8c36fe35..24b12d45222 100644 --- a/absl/base/exception_safety_testing_test.cc +++ b/absl/base/exception_safety_testing_test.cc @@ -20,7 +20,10 @@ #include #include #include +#include +#include #include +#include #include #include "gtest/gtest-spi.h" diff --git a/absl/base/internal/exception_safety_testing.cc b/absl/base/internal/exception_safety_testing.cc index 6ccac41864b..2ccf0700eae 100644 --- a/absl/base/internal/exception_safety_testing.cc +++ b/absl/base/internal/exception_safety_testing.cc @@ -16,6 +16,8 @@ #ifdef ABSL_HAVE_EXCEPTIONS +#include + #include "gtest/gtest.h" #include "absl/meta/type_traits.h" diff --git a/absl/base/internal/exception_safety_testing.h b/absl/base/internal/exception_safety_testing.h index 7082da78a86..471191c4ddf 100644 --- a/absl/base/internal/exception_safety_testing.h +++ b/absl/base/internal/exception_safety_testing.h @@ -25,12 +25,19 @@ #include #include +#include #include #include #include +#include +#include +#include #include #include +#include #include +#include +#include #include "gtest/gtest.h" #include "absl/base/internal/pretty_function.h" @@ -1029,10 +1036,10 @@ class ExceptionSafetyTestBuilder { ExceptionSafetyTestBuilder...> WithContracts(const MoreContracts&... more_contracts) const { - return { - factory_, operation_, - std::tuple_cat(contracts_, std::tuple...>( - more_contracts...))}; + return {factory_, operation_, + std::tuple_cat( + contracts_, + std::tuple...>(more_contracts...))}; } /* diff --git a/absl/container/linked_hash_map_test.cc b/absl/container/linked_hash_map_test.cc index 8b95c123eee..a905e920c4c 100644 --- a/absl/container/linked_hash_map_test.cc +++ b/absl/container/linked_hash_map_test.cc @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/absl/flags/internal/flag.h b/absl/flags/internal/flag.h index 7855a104b45..3aa92373341 100644 --- a/absl/flags/internal/flag.h +++ b/absl/flags/internal/flag.h @@ -25,6 +25,7 @@ #include #include #include +#include #include "absl/base/attributes.h" #include "absl/base/call_once.h" @@ -605,8 +606,8 @@ class FlagImpl final : public CommandLineFlag { } template () == - FlagValueStorageKind::kOneWordAtomic, - int> = 0> + FlagValueStorageKind::kOneWordAtomic, + int> = 0> void Read(T* value) const ABSL_LOCKS_EXCLUDED(DataGuard()) { int64_t v = ReadOneWord(); std::memcpy(value, static_cast(&v), sizeof(T)); diff --git a/absl/functional/bind_front_test.cc b/absl/functional/bind_front_test.cc index a759dbe775c..6e87d43c422 100644 --- a/absl/functional/bind_front_test.cc +++ b/absl/functional/bind_front_test.cc @@ -19,6 +19,7 @@ #include #include #include +#include #include "gmock/gmock.h" #include "gtest/gtest.h" @@ -165,9 +166,7 @@ TEST(BindTest, StoreByPointer) { EXPECT_EQ(&s.value, &g()); } -int Sink(std::unique_ptr p) { - return *p; -} +int Sink(std::unique_ptr p) { return *p; } std::unique_ptr Factory(int n) { return std::make_unique(n); } diff --git a/absl/status/statusor_test.cc b/absl/status/statusor_test.cc index 8a9504909ec..2754d7b969d 100644 --- a/absl/status/statusor_test.cc +++ b/absl/status/statusor_test.cc @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/absl/strings/string_view.h b/absl/strings/string_view.h index 9daa1492ec7..97f7729db9f 100644 --- a/absl/strings/string_view.h +++ b/absl/strings/string_view.h @@ -24,6 +24,7 @@ #ifndef ABSL_STRINGS_STRING_VIEW_H_ #define ABSL_STRINGS_STRING_VIEW_H_ +#include #include #include "absl/base/attributes.h" diff --git a/absl/types/any_span_test.cc b/absl/types/any_span_test.cc index e5960c6aa8a..5d61f6bd89d 100644 --- a/absl/types/any_span_test.cc +++ b/absl/types/any_span_test.cc @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -1056,9 +1057,9 @@ TEST(MutableAnySpanTest, NonTruncatingSubspan) { EXPECT_DEATH(span.subspan(5, 1), ""); EXPECT_DEATH(span.subspan(AnySpan::npos, 0), ""); EXPECT_DEATH(span.subspan(AnySpan::npos, 1), ""); - EXPECT_DEATH(span.subspan(0, 5), ""); - EXPECT_DEATH(span.first(5), ""); - EXPECT_DEATH(span.first(AnySpan::npos), ""); + EXPECT_DEATH(span.subspan(0, 5), ""); + EXPECT_DEATH(span.first(5), ""); + EXPECT_DEATH(span.first(AnySpan::npos), ""); } #endif } diff --git a/absl/types/compare_test.cc b/absl/types/compare_test.cc index ae73eca50a3..a69fcd26e89 100644 --- a/absl/types/compare_test.cc +++ b/absl/types/compare_test.cc @@ -14,6 +14,8 @@ #include "absl/types/compare.h" +#include + #include "gtest/gtest.h" #include "absl/base/casts.h" diff --git a/absl/types/span_test.cc b/absl/types/span_test.cc index 3cc9e3daf52..9d588ef6603 100644 --- a/absl/types/span_test.cc +++ b/absl/types/span_test.cc @@ -14,6 +14,7 @@ #include "absl/types/span.h" +#include #include #include #include