This should be a trivial NFC.
It's worth remarking that historically libc++ includes <__config> before all other headers (in case some header depends on <__config> macros). However, if all our headers include <__config>, then it doesn't really matter — maybe we include <__bit> first, but then <__bit> includes <__config>, so it all works out.
I'm not sure what's going on with the errors in https://buildkite.com/llvm-project/libcxx-ci/builds/3355 (on the Apple builds only).
@teemperor wrote:
I don't know enough modules to say whether that flag would help. However, I don't think the problem here is related to textual headers at all (I mean, it's not because of headers like <cassert>). The problem here seems to be that e.g. <mutex> and <thread> both #include <__threading_support>; and so the contents of header "__threading_support" were winding up duplicated in both module std.mutex and module std.thread. (We see random heisenbuggy duplication issues with other headers too, e.g. the partial specializations in "__iterator/iterator_traits.h" end up duplicated and thus ambiguous.)
What we really need is a way to "share" the common helper header __threading_support between mutex and thread (and so on). My impression is that the only(?) tool we have right now for doing that is to make __threading_support a whole module in its own right.
Personally I would be quite happy to replace all of module.modulemap with a single umbrella module std that simply includes everything; and then worry about "modularizing the STL" sometime down the road. This year in particular we seem to be having our hands full merely "headerizing" it! :)