[libcxx-commits] [libcxx] [libc++] Remove transitive includes from empty headers (PR #116295)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Nov 16 06:17:02 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Nikolas Klauser (philnik777)
<details>
<summary>Changes</summary>
This removes transitive includes that are only in a header that is empty in a given C++ version.
---
Full diff: https://github.com/llvm/llvm-project/pull/116295.diff
12 Files Affected:
- (modified) libcxx/include/bit (-4)
- (modified) libcxx/include/charconv (-7)
- (modified) libcxx/include/compare (-6)
- (modified) libcxx/include/expected (-6)
- (modified) libcxx/include/mdspan (-9)
- (modified) libcxx/include/memory_resource (-9)
- (modified) libcxx/include/ranges (-8)
- (modified) libcxx/test/libcxx/transitive_includes/cxx03.csv (-107)
- (modified) libcxx/test/libcxx/transitive_includes/cxx11.csv (-107)
- (modified) libcxx/test/libcxx/transitive_includes/cxx14.csv (-110)
- (modified) libcxx/test/libcxx/transitive_includes/cxx17.csv (-77)
- (modified) libcxx/test/libcxx/transitive_includes/cxx20.csv (-53)
``````````diff
diff --git a/libcxx/include/bit b/libcxx/include/bit
index 94387d101a398f..092aebca26a31d 100644
--- a/libcxx/include/bit
+++ b/libcxx/include/bit
@@ -87,10 +87,6 @@ namespace std {
# pragma GCC system_header
#endif
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
-# include <cstdint>
-#endif
-
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <cstdlib>
# include <iosfwd>
diff --git a/libcxx/include/charconv b/libcxx/include/charconv
index 8f5e697eec4396..a65b3d35270803 100644
--- a/libcxx/include/charconv
+++ b/libcxx/include/charconv
@@ -101,13 +101,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
_LIBCPP_END_NAMESPACE_STD
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 14
-# include <cerrno>
-# include <cstddef>
-# include <initializer_list>
-# include <new>
-#endif
-
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <cmath>
# include <concepts>
diff --git a/libcxx/include/compare b/libcxx/include/compare
index de0e4c7ec2280c..440d4c4b4dd26d 100644
--- a/libcxx/include/compare
+++ b/libcxx/include/compare
@@ -164,12 +164,6 @@ namespace std {
# pragma GCC system_header
#endif
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
-# include <cstddef>
-# include <cstdint>
-# include <limits>
-#endif
-
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <cmath>
# include <cstddef>
diff --git a/libcxx/include/expected b/libcxx/include/expected
index 6a2f12f2bf3b5d..3c7ef336432a10 100644
--- a/libcxx/include/expected
+++ b/libcxx/include/expected
@@ -53,10 +53,4 @@ namespace std {
# pragma GCC system_header
#endif
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <cstddef>
-# include <initializer_list>
-# include <new>
-#endif
-
#endif // _LIBCPP_EXPECTED
diff --git a/libcxx/include/mdspan b/libcxx/include/mdspan
index 29190e4a9953ed..d6191a197e15c6 100644
--- a/libcxx/include/mdspan
+++ b/libcxx/include/mdspan
@@ -426,13 +426,4 @@ namespace std {
# pragma GCC system_header
#endif
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <array>
-# include <cinttypes>
-# include <concepts>
-# include <cstddef>
-# include <limits>
-# include <span>
-#endif
-
#endif // _LIBCPP_MDSPAN
diff --git a/libcxx/include/memory_resource b/libcxx/include/memory_resource
index e98ca20aa058c3..7de69e67b7c062 100644
--- a/libcxx/include/memory_resource
+++ b/libcxx/include/memory_resource
@@ -66,15 +66,6 @@ namespace std::pmr {
# pragma GCC system_header
#endif
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 14
-# include <cstddef>
-# include <cstdint>
-# include <limits>
-# include <mutex>
-# include <new>
-# include <tuple>
-#endif
-
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <stdexcept>
#endif
diff --git a/libcxx/include/ranges b/libcxx/include/ranges
index b17a399e0ed65b..d8ee6f75e8b23c 100644
--- a/libcxx/include/ranges
+++ b/libcxx/include/ranges
@@ -446,14 +446,6 @@ namespace std {
# pragma GCC system_header
#endif
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
-# include <cstddef>
-# include <limits>
-# include <optional>
-# include <span>
-# include <tuple>
-#endif
-
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <cstdlib>
# include <iosfwd>
diff --git a/libcxx/test/libcxx/transitive_includes/cxx03.csv b/libcxx/test/libcxx/transitive_includes/cxx03.csv
index d70541290023b2..72fccfd3649325 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx03.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx03.csv
@@ -242,17 +242,14 @@ ccomplex utility
ccomplex variant
ccomplex vector
ccomplex version
-charconv cerrno
charconv cmath
charconv concepts
charconv cstddef
charconv cstdint
charconv cstdlib
charconv cstring
-charconv initializer_list
charconv iosfwd
charconv limits
-charconv new
charconv type_traits
charconv version
chrono algorithm
@@ -571,12 +568,6 @@ exception typeinfo
exception version
execution cstddef
execution version
-expected cstddef
-expected cstdint
-expected cstdlib
-expected initializer_list
-expected new
-expected type_traits
expected version
experimental/iterator algorithm
experimental/iterator atomic
@@ -1340,53 +1331,6 @@ map utility
map variant
map vector
map version
-mdspan algorithm
-mdspan array
-mdspan atomic
-mdspan bit
-mdspan cctype
-mdspan cerrno
-mdspan cinttypes
-mdspan climits
-mdspan clocale
-mdspan cmath
-mdspan compare
-mdspan concepts
-mdspan cstdarg
-mdspan cstddef
-mdspan cstdint
-mdspan cstdio
-mdspan cstdlib
-mdspan cstring
-mdspan ctime
-mdspan cwchar
-mdspan cwctype
-mdspan exception
-mdspan functional
-mdspan initializer_list
-mdspan ios
-mdspan iosfwd
-mdspan iterator
-mdspan limits
-mdspan locale
-mdspan memory
-mdspan mutex
-mdspan new
-mdspan optional
-mdspan ratio
-mdspan span
-mdspan stdexcept
-mdspan streambuf
-mdspan string
-mdspan string_view
-mdspan system_error
-mdspan tuple
-mdspan type_traits
-mdspan typeinfo
-mdspan unordered_map
-mdspan utility
-mdspan variant
-mdspan vector
mdspan version
memory atomic
memory cctype
@@ -1416,42 +1360,15 @@ memory typeinfo
memory utility
memory variant
memory version
-memory_resource algorithm
-memory_resource atomic
-memory_resource bit
-memory_resource cctype
-memory_resource cerrno
-memory_resource climits
-memory_resource cmath
-memory_resource compare
-memory_resource concepts
memory_resource cstddef
memory_resource cstdint
-memory_resource cstdio
memory_resource cstdlib
-memory_resource cstring
-memory_resource ctime
-memory_resource cwchar
-memory_resource cwctype
memory_resource exception
-memory_resource initializer_list
memory_resource iosfwd
-memory_resource iterator
-memory_resource limits
-memory_resource memory
-memory_resource mutex
memory_resource new
-memory_resource optional
-memory_resource ratio
memory_resource stdexcept
-memory_resource string
-memory_resource string_view
-memory_resource system_error
-memory_resource tuple
memory_resource type_traits
memory_resource typeinfo
-memory_resource utility
-memory_resource variant
memory_resource version
mutex algorithm
mutex atomic
@@ -1772,52 +1689,28 @@ random utility
random variant
random vector
random version
-ranges algorithm
-ranges array
-ranges atomic
-ranges bit
ranges cctype
-ranges cerrno
-ranges climits
-ranges clocale
ranges cmath
ranges compare
ranges concepts
-ranges cstdarg
ranges cstddef
ranges cstdint
ranges cstdio
ranges cstdlib
ranges cstring
-ranges ctime
ranges cwchar
ranges cwctype
ranges exception
-ranges functional
ranges initializer_list
-ranges ios
ranges iosfwd
ranges iterator
ranges limits
-ranges locale
-ranges memory
-ranges mutex
ranges new
-ranges optional
-ranges ratio
-ranges span
-ranges stdexcept
-ranges streambuf
-ranges string
-ranges string_view
-ranges system_error
ranges tuple
ranges type_traits
ranges typeinfo
-ranges unordered_map
ranges utility
ranges variant
-ranges vector
ranges version
ratio climits
ratio cstdint
diff --git a/libcxx/test/libcxx/transitive_includes/cxx11.csv b/libcxx/test/libcxx/transitive_includes/cxx11.csv
index d70541290023b2..72fccfd3649325 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx11.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx11.csv
@@ -242,17 +242,14 @@ ccomplex utility
ccomplex variant
ccomplex vector
ccomplex version
-charconv cerrno
charconv cmath
charconv concepts
charconv cstddef
charconv cstdint
charconv cstdlib
charconv cstring
-charconv initializer_list
charconv iosfwd
charconv limits
-charconv new
charconv type_traits
charconv version
chrono algorithm
@@ -571,12 +568,6 @@ exception typeinfo
exception version
execution cstddef
execution version
-expected cstddef
-expected cstdint
-expected cstdlib
-expected initializer_list
-expected new
-expected type_traits
expected version
experimental/iterator algorithm
experimental/iterator atomic
@@ -1340,53 +1331,6 @@ map utility
map variant
map vector
map version
-mdspan algorithm
-mdspan array
-mdspan atomic
-mdspan bit
-mdspan cctype
-mdspan cerrno
-mdspan cinttypes
-mdspan climits
-mdspan clocale
-mdspan cmath
-mdspan compare
-mdspan concepts
-mdspan cstdarg
-mdspan cstddef
-mdspan cstdint
-mdspan cstdio
-mdspan cstdlib
-mdspan cstring
-mdspan ctime
-mdspan cwchar
-mdspan cwctype
-mdspan exception
-mdspan functional
-mdspan initializer_list
-mdspan ios
-mdspan iosfwd
-mdspan iterator
-mdspan limits
-mdspan locale
-mdspan memory
-mdspan mutex
-mdspan new
-mdspan optional
-mdspan ratio
-mdspan span
-mdspan stdexcept
-mdspan streambuf
-mdspan string
-mdspan string_view
-mdspan system_error
-mdspan tuple
-mdspan type_traits
-mdspan typeinfo
-mdspan unordered_map
-mdspan utility
-mdspan variant
-mdspan vector
mdspan version
memory atomic
memory cctype
@@ -1416,42 +1360,15 @@ memory typeinfo
memory utility
memory variant
memory version
-memory_resource algorithm
-memory_resource atomic
-memory_resource bit
-memory_resource cctype
-memory_resource cerrno
-memory_resource climits
-memory_resource cmath
-memory_resource compare
-memory_resource concepts
memory_resource cstddef
memory_resource cstdint
-memory_resource cstdio
memory_resource cstdlib
-memory_resource cstring
-memory_resource ctime
-memory_resource cwchar
-memory_resource cwctype
memory_resource exception
-memory_resource initializer_list
memory_resource iosfwd
-memory_resource iterator
-memory_resource limits
-memory_resource memory
-memory_resource mutex
memory_resource new
-memory_resource optional
-memory_resource ratio
memory_resource stdexcept
-memory_resource string
-memory_resource string_view
-memory_resource system_error
-memory_resource tuple
memory_resource type_traits
memory_resource typeinfo
-memory_resource utility
-memory_resource variant
memory_resource version
mutex algorithm
mutex atomic
@@ -1772,52 +1689,28 @@ random utility
random variant
random vector
random version
-ranges algorithm
-ranges array
-ranges atomic
-ranges bit
ranges cctype
-ranges cerrno
-ranges climits
-ranges clocale
ranges cmath
ranges compare
ranges concepts
-ranges cstdarg
ranges cstddef
ranges cstdint
ranges cstdio
ranges cstdlib
ranges cstring
-ranges ctime
ranges cwchar
ranges cwctype
ranges exception
-ranges functional
ranges initializer_list
-ranges ios
ranges iosfwd
ranges iterator
ranges limits
-ranges locale
-ranges memory
-ranges mutex
ranges new
-ranges optional
-ranges ratio
-ranges span
-ranges stdexcept
-ranges streambuf
-ranges string
-ranges string_view
-ranges system_error
ranges tuple
ranges type_traits
ranges typeinfo
-ranges unordered_map
ranges utility
ranges variant
-ranges vector
ranges version
ratio climits
ratio cstdint
diff --git a/libcxx/test/libcxx/transitive_includes/cxx14.csv b/libcxx/test/libcxx/transitive_includes/cxx14.csv
index 90bff887eb2781..fd36dace19c76c 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx14.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx14.csv
@@ -247,17 +247,14 @@ ccomplex utility
ccomplex variant
ccomplex vector
ccomplex version
-charconv cerrno
charconv cmath
charconv concepts
charconv cstddef
charconv cstdint
charconv cstdlib
charconv cstring
-charconv initializer_list
charconv iosfwd
charconv limits
-charconv new
charconv type_traits
charconv version
chrono algorithm
@@ -582,12 +579,6 @@ exception typeinfo
exception version
execution cstddef
execution version
-expected cstddef
-expected cstdint
-expected cstdlib
-expected initializer_list
-expected new
-expected type_traits
expected version
experimental/iterator algorithm
experimental/iterator atomic
@@ -1370,54 +1361,6 @@ map utility
map variant
map vector
map version
-mdspan algorithm
-mdspan array
-mdspan atomic
-mdspan bit
-mdspan cctype
-mdspan cerrno
-mdspan cinttypes
-mdspan climits
-mdspan clocale
-mdspan cmath
-mdspan compare
-mdspan concepts
-mdspan cstdarg
-mdspan cstddef
-mdspan cstdint
-mdspan cstdio
-mdspan cstdlib
-mdspan cstring
-mdspan ctime
-mdspan cwchar
-mdspan cwctype
-mdspan exception
-mdspan execution
-mdspan functional
-mdspan initializer_list
-mdspan ios
-mdspan iosfwd
-mdspan iterator
-mdspan limits
-mdspan locale
-mdspan memory
-mdspan mutex
-mdspan new
-mdspan optional
-mdspan ratio
-mdspan span
-mdspan stdexcept
-mdspan streambuf
-mdspan string
-mdspan string_view
-mdspan system_error
-mdspan tuple
-mdspan type_traits
-mdspan typeinfo
-mdspan unordered_map
-mdspan utility
-mdspan variant
-mdspan vector
mdspan version
memory atomic
memory cctype
@@ -1447,43 +1390,15 @@ memory typeinfo
memory utility
memory variant
memory version
-memory_resource algorithm
-memory_resource atomic
-memory_resource bit
-memory_resource cctype
-memory_resource cerrno
-memory_resource climits
-memory_resource cmath
-memory_resource compare
-memory_resource concepts
memory_resource cstddef
memory_resource cstdint
-memory_resource cstdio
memory_resource cstdlib
-memory_resource cstring
-memory_resource ctime
-memory_resource cwchar
-memory_resource cwctype
memory_resource exception
-memory_resource execution
-memory_resource initializer_list
memory_resource iosfwd
-memory_resource iterator
-memory_resource limits
-memory_resource memory
-memory_resource mutex
memory_resource new
-memory_resource optional
-memory_resource ratio
memory_resource stdexcept
-memory_resource string
-memory_resource string_view
-memory_resource system_error
-memory_resource tuple
memory_resource type_traits
memory_resource typeinfo
-memory_resource utility
-memory_resource variant
memory_resource version
mutex algorithm
mutex atomic
@@ -1808,53 +1723,28 @@ random utility
random variant
random vector
random version
-ranges algorithm
-ranges array
-ranges atomic
-ranges bit
ranges cctype
-ranges cerrno
-ranges climits
-ranges clocale
ranges cmath
ranges compare
ranges concepts
-ranges cstdarg
ranges cstddef
ranges cstdint
ranges cstdio
ranges cstdlib
ranges cstring
-ranges ctime
ranges cwchar
ranges cwctype
ranges exception
-ranges execution
-ranges functional
ranges initializer_list
-ranges ios
ranges iosfwd
ranges iterator
ranges limits
-ranges locale
-ranges memory
-ranges mutex
ranges new
-ranges optional
-ranges ratio
-ranges span
-ranges stdexcept
-ranges streambuf
-ranges string
-ranges string_view
-ranges system_error
ranges tuple
ranges type_traits
ranges typeinfo
-ranges unordered_map
ranges utility
ranges variant
-ranges vector
ranges version
ratio climits
ratio cstdint
diff --git a/libcxx/test/libcxx/transitive_includes/cxx17.csv b/libcxx/test/libcxx/transitive_includes/cxx17.csv
index 2f908e7f78ec15..eaec25f81e5821 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx17.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx17.csv
@@ -571,12 +571,6 @@ exception typeinfo
exception version
execution cstddef
execution version
-expected cstddef
-expected cstdint
-expected cstdlib
-expected initializer_list
-expected new
-expected type_traits
expected version
experimental/iterator algorithm
experimental/iterator atomic
@@ -1364,53 +1358,6 @@ map utility
map variant
map vector
map version
-mdspan algorithm
-mdspan array
-mdspan atomic
-mdspan bit
-mdspan cctype
-mdspan cerrno
-mdspan cinttypes
-mdspan climits
-mdspan clocale
-mdspan cmath
-mdspan compare
-mdspan concepts
-mdspan cstdarg
-mdspan cstddef
-mdspan cstdint
-mdspan cstdio
-mdspan cstdlib
-mdspan cstring
-mdspan ctime
-mdspan cwchar
-mdspan cwctype
-mdspan exception
-mdspan functional
-mdspan initializer_list
-mdspan ios
-mdspan iosfwd
-mdspan iterator
-mdspan limits
-mdspan locale
-mdspan memory
-mdspan mutex
-mdspan new
-mdspan optional
-mdspan ratio
-mdspan span
-mdspan stdexcept
-mdspan streambuf
-mdspan string
-mdspan string_view
-mdspan system_error
-mdspan tuple
-mdspan type_traits
-mdspan typeinfo
-mdspan unordered_map
-mdspan utility
-mdspan variant
-mdspan vector
mdspan version
memory atomic
memory cctype
@@ -1796,52 +1743,28 @@ random utility
random variant
random vector
random version
-ranges algorithm
-ranges array
-ranges atomic
-ranges bit
ranges cctype
-ranges cerrno
-ranges climits
-ranges clocale
ranges cmath
ranges compare
ranges concepts
-ranges cstdarg
ranges cstddef
ranges cstdint
ranges cstdio
ranges cstdlib
ranges cstring
-ranges ctime
ranges cwchar
ranges cwctype
ranges exception
-ranges functional
ranges initializer_list
-ranges ios
ranges iosfwd
ranges iterator
ranges limits
-ranges locale
-ranges memory
-ranges mutex
ranges new
-ranges optional
-ranges ratio
-ranges span
-ranges stdexcept
-ranges streambuf
-ranges string
-ranges string_view
-ranges system_error
ranges tuple
ranges type_traits
ranges typeinfo
-ranges unordered_map
ranges utility
ranges variant
-ranges vector
ranges version
ratio climits
ratio cstdint
diff --git a/libcxx/test/libcxx/transitive_includes/cxx20.csv b/libcxx/test/libcxx/transitive_includes/cxx20.csv
index 1a198aa4562fdd..89c28e49d6c9de 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx20.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx20.csv
@@ -567,12 +567,6 @@ exception typeinfo
exception version
execution cstddef
execution version
-expected cstddef
-expected cstdint
-expected cstdlib
-expected initializer_list
-expected new
-expected type_traits
expected version
experimental/iterator algorithm
experimental/iterator atomic
@@ -1358,53 +1352,6 @@ map utility
map variant
map vector
map version
-mdspan algorithm
-mdspan array
-mdspan atomic
-mdspan bit
-mdspan cctype
-mdspan cerrno
-mdspan cinttypes
-mdspan climits
-mdspan clocale
-mdspan cmath
-mdspan compare
-mdspan concepts
-mdspan cstdarg
-mdspan cstddef
-mdspan cstdint
-mdspan cstdio
-mdspan cstdlib
-mdspan cstring
-mdspan ctime
-mdspan cwchar
-mdspan cwctype
-mdspan exception
-mdspan functional
-mdspan initializer_list
-mdspan ios
-mdspan iosfwd
-mdspan iterator
-mdspan limits
-mdspan locale
-mdspan memory
-mdspan mutex
-mdspan new
-mdspan optional
-mdspan ratio
-mdspan span
-mdspan stdexcept
-mdspan streambuf
-mdspan string
-mdspan string_view
-mdspan system_error
-mdspan tuple
-mdspan type_traits
-mdspan typeinfo
-mdspan unordered_map
-mdspan utility
-mdspan variant
-mdspan vector
mdspan version
memory atomic
memory cctype
``````````
</details>
https://github.com/llvm/llvm-project/pull/116295
More information about the libcxx-commits
mailing list