Skip to content

Fix some missing includes for std::-symbols - #2150

Closed
hzeller wants to merge 1 commit into
abseil:masterfrom
hzeller:feature-20260901-fix-headers
Closed

Fix some missing includes for std::-symbols#2150
hzeller wants to merge 1 commit into
abseil:masterfrom
hzeller:feature-20260901-fix-headers

Conversation

@hzeller

@hzeller hzeller commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

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 <cstdlib> for std::abort
absl/base/internal/exception_safety_testing.h: #include <new> for std::bad_alloc
absl/base/internal/exception_safety_testing.h: #include <type_traits> for std::bool_constant
absl/types/span_test.cc:                       #include <algorithm> for std::equal
absl/base/internal/exception_safety_testing.h: #include <utility> for std::index_sequence
absl/flags/internal/flag.h:                    #include <utility> for std::index_sequence
absl/base/exception_safety_testing_test.cc:    #include <sstream> for std::istringstream
absl/types/compare_test.cc:                    #include <algorithm> for std::less
absl/base/internal/exception_safety_testing.h: #include <memory> for std::make_shared
absl/base/exception_safety_testing_test.cc:    #include <memory> for std::make_unique
absl/strings/string_view.h:                    #include <algorithm> for std::min
absl/base/exception_safety_testing_test.cc:    #include <utility> for std::move
absl/functional/bind_front_test.cc:            #include <utility> for std::move
absl/base/internal/exception_safety_testing.h: #include <limits> for std::numeric_limits
absl/container/linked_hash_map_test.cc:        #include <stdexcept> for std::out_of_range
absl/types/any_span_test.cc:                   #include <stdexcept> for std::out_of_range
absl/status/statusor_test.cc:                  #include <stdexcept> for std::runtime_error
absl/base/internal/exception_safety_testing.cc: #include <string> for std::string
absl/base/internal/exception_safety_testing.h: #include <vector> for std::vector

Thank you for your contribution to Abseil!

Before submitting this PR, please be sure to read our contributing
guidelines
.

If you are a Googler, please also note that it is required that you send us a
Piper CL instead of using the GitHub pull-request process. The code propagation
process will deliver the change to GitHub.

@hzeller

hzeller commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Not a Googler anymore, so external contribution...

@derekmauro derekmauro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two issues here:

  1. Changes to code under CCTZ need to be sent to https://www.github.com/google/cctz
  2. Please avoid alphabetizing the gtest includes. Internally they are in a different order, which will cause merge problems.

@hzeller
hzeller force-pushed the feature-20260901-fix-headers branch from cc28507 to 55362fa Compare September 1, 2026 19:12
@hzeller

hzeller commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Alright, excluded the cctz changes, and moved the gtest headers back.

The gtest headers I had to format manually as they are automatically moved around with clang-format.
If external contributions are always copybara-ed in with clang-format, then things can be fixed on import (I think I did something like that in some copybara's I was involved in).

I think it should even be doable with copybara to have a different clang-format on the way out and back in.

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 <cstdlib> for std::abort
absl/base/internal/exception_safety_testing.h: #include <new> for std::bad_alloc
absl/base/internal/exception_safety_testing.h: #include <type_traits> for std::bool_constant
absl/types/span_test.cc:                       #include <algorithm> for std::equal
absl/base/internal/exception_safety_testing.h: #include <utility> for std::index_sequence
absl/flags/internal/flag.h:                    #include <utility> for std::index_sequence
absl/base/exception_safety_testing_test.cc:    #include <sstream> for std::istringstream
absl/types/compare_test.cc:                    #include <algorithm> for std::less
absl/base/internal/exception_safety_testing.h: #include <memory> for std::make_shared
absl/base/exception_safety_testing_test.cc:    #include <memory> for std::make_unique
absl/strings/string_view.h:                    #include <algorithm> for std::min
absl/base/exception_safety_testing_test.cc:    #include <utility> for std::move
absl/functional/bind_front_test.cc:            #include <utility> for std::move
absl/base/internal/exception_safety_testing.h: #include <limits> for std::numeric_limits
absl/container/linked_hash_map_test.cc:        #include <stdexcept> for std::out_of_range
absl/types/any_span_test.cc:                   #include <stdexcept> for std::out_of_range
absl/status/statusor_test.cc:                  #include <stdexcept> for std::runtime_error
absl/base/internal/exception_safety_testing.cc: #include <string> for std::string
absl/base/internal/exception_safety_testing.h: #include <vector> for std::vector
```
@hzeller
hzeller force-pushed the feature-20260901-fix-headers branch from 55362fa to 2af990d Compare September 1, 2026 19:24
@hzeller
hzeller requested a review from derekmauro September 2, 2026 05:51
@copybara-service copybara-service Bot closed this in 403de00 Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants