[libcxx-commits] [PATCH] D153214: [libc++] Remove the type_traits includes from limits and new

Ian Anderson via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jun 17 18:57:03 PDT 2023


iana created this revision.
iana added reviewers: ldionne, Mordante, philnik, Bigcheese.
Herald added a subscriber: ributzka.
Herald added a project: All.
iana requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

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 <https://reviews.llvm.org/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.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D153214

Files:
  libcxx/docs/ReleaseNotes.rst
  libcxx/include/limits
  libcxx/include/new


Index: libcxx/include/new
===================================================================
--- libcxx/include/new
+++ libcxx/include/new
@@ -365,9 +365,4 @@
 
 _LIBCPP_END_NAMESPACE_STD
 
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-#  include <exception>
-#  include <type_traits>
-#endif
-
 #endif // _LIBCPP_NEW
Index: libcxx/include/limits
===================================================================
--- libcxx/include/limits
+++ libcxx/include/limits
@@ -823,8 +823,4 @@
 
 _LIBCPP_POP_MACROS
 
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-#  include <type_traits>
-#endif
-
 #endif // _LIBCPP_LIMITS
Index: libcxx/docs/ReleaseNotes.rst
===================================================================
--- libcxx/docs/ReleaseNotes.rst
+++ libcxx/docs/ReleaseNotes.rst
@@ -83,6 +83,10 @@
 
 - ``<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>``


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153214.532441.patch
Type: text/x-patch
Size: 1469 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230618/62187863/attachment.bin>


More information about the libcxx-commits mailing list