Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce inclusion for <queue>, <stack>, <stacktrace>, and <thread> #5003

Merged
merged 8 commits into from
Oct 12, 2024

Conversation

frederick-vs-ja
Copy link
Contributor

@frederick-vs-ja frederick-vs-ja commented Oct 5, 2024

Since C++23, <queue>, <stack>, <stacktrace>, <thread>, and <vector> are required to provide formatter specializations. Previously, <format> was included by several headers to allow the formatter specializations to be properly defined. This PR splits out the necessary parts for formatter specializations and puts all formatter specializations other than those provided by <__msvc_formatter.hpp> into a new internal header <__msvc_ranges_tuple_formatter.hpp>.

The formattable concept is critical for these C++23 formatters. To ensure that formattable still works correctly, the definitions of basic_format_parse_context, basic_format_context, basic_format_arg, basic_format_args etc. are also moved to <__msvc_ranges_tuple_formatter.hpp>.

Newly added test files tests that these new formatter specializations are defined in the corresponding headers.

Notes: formatter<stacktrace_entry>::parse is templatized to allow _Fill_align_and_width_formatter_parse to be declared but not defined when including <stacktrace>.

⚠️ MSVC-internal changes are needed for the new internal header <__msvc_ranges_tuple_formatter.hpp>.

@StephanTLavavej StephanTLavavej added the throughput Must compile faster label Oct 5, 2024
@StephanTLavavej StephanTLavavej self-assigned this Oct 6, 2024
Declare `_Throw_format_error` above `basic_format_parse_context`, following the order of their definitions in `<__msvc_ranges_tuple_formatter.hpp>`.
@StephanTLavavej StephanTLavavej added the format C++20/23 format label Oct 10, 2024
stl/inc/thread Outdated Show resolved Hide resolved
stl/inc/stacktrace Outdated Show resolved Hide resolved
stl/inc/__msvc_formatter.hpp Outdated Show resolved Hide resolved
stl/inc/format Outdated Show resolved Hide resolved
@StephanTLavavej
Copy link
Member

Thanks for this very complicated but careful transformation! 😻 I found only a few issues and pushed changes - please double-check.

@StephanTLavavej StephanTLavavej removed their assignment Oct 10, 2024
@StephanTLavavej StephanTLavavej self-assigned this Oct 11, 2024
@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit 37120ed into microsoft:main Oct 12, 2024
39 checks passed
@StephanTLavavej
Copy link
Member

Thanks for this heroic throughput improvement! 🚀 🖥️ 📊

@frederick-vs-ja frederick-vs-ja deleted the fmt-inclusion-2 branch October 12, 2024 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
format C++20/23 format throughput Must compile faster
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants