[libcxx-commits] [libcxx] [libc++] Remove <queue> and <stack> includes from <format> (PR #85520)

Nico Weber via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 10 09:32:02 PDT 2024


nico wrote:

Compile time when including standard library headers is a major pain point, so thank you for working on this!

This has the effect of making `<string>` no longer include `<vector>`. That's great -- but it also requires some amount of cleanup. For our codebase it wasn't terrible, but a bit annoying. We use C++20, but we don't use `<format>` anywhere directly, and some people maintain the linux build building with libstdc++. Still, we had to clean up a bunch of files on a bunch of platforms where we exclusively use libc++ (...even though we don't use <format> ourselves).

I imagine it might be somewhat annoying for larger codebases. There's probably not too much we can do about this though.

The only thing I can think of is to be mindful of not adding unnecessary includes in the first place when adding new headers or when adding features. How do you find which includes you can remove? Maybe it's possible to do something similar on reviews when new code gets added?

To be clear, no action needed and I'm very appreciative of this change and changes like it. Just thinking out loud some on how to maybe make this a bit easier on libc++'s users.

https://github.com/llvm/llvm-project/pull/85520


More information about the libcxx-commits mailing list