Skip to content

Commit

Permalink
[libc++] Remove the type_traits includes from limits and new
Browse files Browse the repository at this point in the history
type_traits is currently unable to include __type_traits/noexcept_move_assign_container.h, because it would cause several include cycles.

type_traits -> __type_traits/noexcept_move_assign_container.h -> __memory/allocator_traits.h -> __memory/construct_at.h -> new -> exception -> type_traits

type_traits -> __type_traits/noexcept_move_assign_container.h -> __memory/allocator_traits.h -> __memory/construct_at.h -> new -> type_traits

type_traits -> __type_traits/noexcept_move_assign_container.h -> __memory/allocator_traits.h -> limits -> type_traits

This is a problem for clang modules after the std mega module is broken up (D144322), because it becomes a module cycle which is a hard error.

Unconditionally remove the type_traits includes from limits and new in all versions, and also remove the exception include from new. (These are already removed in C++23.)

Reviewed By: ldionne, Mordante, #libc

Differential Revision: https://reviews.llvm.org/D153214
  • Loading branch information
ian-twilightcoder committed Jun 24, 2023
1 parent e28b3ea commit 2af6d79
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 24 deletions.
4 changes: 4 additions & 0 deletions libcxx/docs/ReleaseNotes.rst
Expand Up @@ -83,6 +83,10 @@ Deprecations and Removals

- ``<algorithm>`` no longer includes ``<chrono>`` in any C++ version (it was previously included in C++17 and earlier).

- ``<limits>`` no longer includes ``<type_traits>`` in any C++ version (it was previously included in C++20 and earlier).

- ``<new>`` no longer includes ``<exception>`` or ``<type_traits>`` in any C++ version (they were previously included in C++20 and earlier).

- ``<string>`` no longer includes ``<vector>`` in any C++ version (it was previously included in C++20 and earlier).

- ``<string>``, ``<string_view>``, and ``<mutex>`` no longer include ``<functional>``
Expand Down
4 changes: 0 additions & 4 deletions libcxx/include/limits
Expand Up @@ -823,8 +823,4 @@ _LIBCPP_END_NAMESPACE_STD

_LIBCPP_POP_MACROS

#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <type_traits>
#endif

#endif // _LIBCPP_LIMITS
5 changes: 0 additions & 5 deletions libcxx/include/new
Expand Up @@ -365,9 +365,4 @@ inline constexpr size_t hardware_constructive_interference_size = __GCC_CONSTRUC

_LIBCPP_END_NAMESPACE_STD

#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <exception>
# include <type_traits>
#endif

#endif // _LIBCPP_NEW
6 changes: 3 additions & 3 deletions libcxx/test/libcxx/transitive_includes/cxx03.csv
Expand Up @@ -456,7 +456,6 @@ latch limits
latch ratio
latch type_traits
latch version
limits type_traits
limits version
list algorithm
list atomic
Expand Down Expand Up @@ -571,8 +570,6 @@ mutex typeinfo
mutex version
new cstddef
new cstdlib
new exception
new type_traits
new version
numbers concepts
numbers type_traits
Expand Down Expand Up @@ -639,6 +636,7 @@ ostream version
queue compare
queue concepts
queue cstddef
queue cstdint
queue cstdlib
queue deque
queue functional
Expand Down Expand Up @@ -774,6 +772,7 @@ sstream version
stack compare
stack concepts
stack cstddef
stack cstdint
stack deque
stack functional
stack initializer_list
Expand Down Expand Up @@ -936,6 +935,7 @@ valarray algorithm
valarray cmath
valarray concepts
valarray cstddef
valarray cstdint
valarray cstdlib
valarray cstring
valarray functional
Expand Down
6 changes: 3 additions & 3 deletions libcxx/test/libcxx/transitive_includes/cxx11.csv
Expand Up @@ -456,7 +456,6 @@ latch limits
latch ratio
latch type_traits
latch version
limits type_traits
limits version
list algorithm
list atomic
Expand Down Expand Up @@ -572,8 +571,6 @@ mutex typeinfo
mutex version
new cstddef
new cstdlib
new exception
new type_traits
new version
numbers concepts
numbers type_traits
Expand Down Expand Up @@ -640,6 +637,7 @@ ostream version
queue compare
queue concepts
queue cstddef
queue cstdint
queue cstdlib
queue deque
queue functional
Expand Down Expand Up @@ -775,6 +773,7 @@ sstream version
stack compare
stack concepts
stack cstddef
stack cstdint
stack deque
stack functional
stack initializer_list
Expand Down Expand Up @@ -937,6 +936,7 @@ valarray algorithm
valarray cmath
valarray concepts
valarray cstddef
valarray cstdint
valarray cstdlib
valarray cstring
valarray functional
Expand Down
6 changes: 3 additions & 3 deletions libcxx/test/libcxx/transitive_includes/cxx14.csv
Expand Up @@ -458,7 +458,6 @@ latch limits
latch ratio
latch type_traits
latch version
limits type_traits
limits version
list algorithm
list atomic
Expand Down Expand Up @@ -574,8 +573,6 @@ mutex typeinfo
mutex version
new cstddef
new cstdlib
new exception
new type_traits
new version
numbers concepts
numbers type_traits
Expand Down Expand Up @@ -642,6 +639,7 @@ ostream version
queue compare
queue concepts
queue cstddef
queue cstdint
queue cstdlib
queue deque
queue functional
Expand Down Expand Up @@ -777,6 +775,7 @@ sstream version
stack compare
stack concepts
stack cstddef
stack cstdint
stack deque
stack functional
stack initializer_list
Expand Down Expand Up @@ -939,6 +938,7 @@ valarray algorithm
valarray cmath
valarray concepts
valarray cstddef
valarray cstdint
valarray cstdlib
valarray cstring
valarray functional
Expand Down
6 changes: 3 additions & 3 deletions libcxx/test/libcxx/transitive_includes/cxx17.csv
Expand Up @@ -458,7 +458,6 @@ latch limits
latch ratio
latch type_traits
latch version
limits type_traits
limits version
list algorithm
list atomic
Expand Down Expand Up @@ -574,8 +573,6 @@ mutex typeinfo
mutex version
new cstddef
new cstdlib
new exception
new type_traits
new version
numbers concepts
numbers type_traits
Expand Down Expand Up @@ -642,6 +639,7 @@ ostream version
queue compare
queue concepts
queue cstddef
queue cstdint
queue cstdlib
queue deque
queue functional
Expand Down Expand Up @@ -777,6 +775,7 @@ sstream version
stack compare
stack concepts
stack cstddef
stack cstdint
stack deque
stack functional
stack initializer_list
Expand Down Expand Up @@ -939,6 +938,7 @@ valarray algorithm
valarray cmath
valarray concepts
valarray cstddef
valarray cstdint
valarray cstdlib
valarray cstring
valarray functional
Expand Down
6 changes: 3 additions & 3 deletions libcxx/test/libcxx/transitive_includes/cxx20.csv
Expand Up @@ -464,7 +464,6 @@ latch limits
latch ratio
latch type_traits
latch version
limits type_traits
limits version
list algorithm
list atomic
Expand Down Expand Up @@ -580,8 +579,6 @@ mutex typeinfo
mutex version
new cstddef
new cstdlib
new exception
new type_traits
new version
numbers concepts
numbers type_traits
Expand Down Expand Up @@ -648,6 +645,7 @@ ostream version
queue compare
queue concepts
queue cstddef
queue cstdint
queue cstdlib
queue deque
queue functional
Expand Down Expand Up @@ -783,6 +781,7 @@ sstream version
stack compare
stack concepts
stack cstddef
stack cstdint
stack deque
stack functional
stack initializer_list
Expand Down Expand Up @@ -944,6 +943,7 @@ valarray algorithm
valarray cmath
valarray concepts
valarray cstddef
valarray cstdint
valarray cstdlib
valarray cstring
valarray functional
Expand Down

0 comments on commit 2af6d79

Please sign in to comment.