[libcxx-commits] [libcxx] bd6e684 - [libc++] Add the version header to all headers.

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jan 4 10:51:05 PST 2022


Author: Mark de Wever
Date: 2022-01-04T19:50:59+01:00
New Revision: bd6e6846e7f431e9d84b1f257d4a0c8ddeac4fe2

URL: https://github.com/llvm/llvm-project/commit/bd6e6846e7f431e9d84b1f257d4a0c8ddeac4fe2
DIFF: https://github.com/llvm/llvm-project/commit/bd6e6846e7f431e9d84b1f257d4a0c8ddeac4fe2.diff

LOG: [libc++] Add the version header to all headers.

Some headers which require the version header depend on other headers to
provide it. Include the version header in all top-level headers to make
sure a header cleanup can't remove the version header.

Note this doesn't add the version header to the c headers.

Reviewed By: #libc, Quuxplusone, ldionne

Differential Revision: https://reviews.llvm.org/D116172

Added: 
    

Modified: 
    libcxx/include/bitset
    libcxx/include/codecvt
    libcxx/include/compare
    libcxx/include/condition_variable
    libcxx/include/execution
    libcxx/include/fstream
    libcxx/include/future
    libcxx/include/ios
    libcxx/include/iosfwd
    libcxx/include/iostream
    libcxx/include/latch
    libcxx/include/queue
    libcxx/include/random
    libcxx/include/ratio
    libcxx/include/semaphore
    libcxx/include/sstream
    libcxx/include/stack
    libcxx/include/streambuf
    libcxx/include/strstream
    libcxx/include/system_error
    libcxx/include/thread
    libcxx/include/typeindex
    libcxx/include/valarray
    libcxx/utils/graph_header_deps.py

Removed: 
    


################################################################################
diff  --git a/libcxx/include/bitset b/libcxx/include/bitset
index 8f538e92e7ff2..809fadf6d228a 100644
--- a/libcxx/include/bitset
+++ b/libcxx/include/bitset
@@ -120,6 +120,7 @@ template <size_t N> struct hash<std::bitset<N>>;
 #include <iosfwd>
 #include <stdexcept>
 #include <string>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header

diff  --git a/libcxx/include/codecvt b/libcxx/include/codecvt
index 60d3db882c031..74839d199686a 100644
--- a/libcxx/include/codecvt
+++ b/libcxx/include/codecvt
@@ -56,6 +56,7 @@ class codecvt_utf8_utf16
 
 #include <__config>
 #include <__locale>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header

diff  --git a/libcxx/include/compare b/libcxx/include/compare
index 5d07ebaf2fbd4..d686b5a369f2b 100644
--- a/libcxx/include/compare
+++ b/libcxx/include/compare
@@ -145,6 +145,7 @@ namespace std {
 #include <__compare/three_way_comparable.h>
 #include <__compare/weak_order.h>
 #include <__config>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header

diff  --git a/libcxx/include/condition_variable b/libcxx/include/condition_variable
index 0569e2254d1d8..ecec3ea8c017c 100644
--- a/libcxx/include/condition_variable
+++ b/libcxx/include/condition_variable
@@ -109,6 +109,7 @@ public:
 #include <__config>
 #include <__mutex_base>
 #include <memory>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header

diff  --git a/libcxx/include/execution b/libcxx/include/execution
index c1debcb72ff1d..417b11b103a23 100644
--- a/libcxx/include/execution
+++ b/libcxx/include/execution
@@ -11,6 +11,7 @@
 #define _LIBCPP_EXECUTION
 
 #include <__config>
+#include <version>
 
 #if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17
 #   include <__pstl_execution>

diff  --git a/libcxx/include/fstream b/libcxx/include/fstream
index 3d64adcb23d10..fc0a9204ed605 100644
--- a/libcxx/include/fstream
+++ b/libcxx/include/fstream
@@ -187,6 +187,7 @@ typedef basic_fstream<wchar_t> wfstream;
 #include <cstdlib>
 #include <istream>
 #include <ostream>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY)
 #   include <filesystem>

diff  --git a/libcxx/include/future b/libcxx/include/future
index 6b666a70f48ed..e35eedf356414 100644
--- a/libcxx/include/future
+++ b/libcxx/include/future
@@ -374,6 +374,7 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>;
 #include <mutex>
 #include <system_error>
 #include <thread>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header

diff  --git a/libcxx/include/ios b/libcxx/include/ios
index 237d146dfb85c..74c3c63bd347f 100644
--- a/libcxx/include/ios
+++ b/libcxx/include/ios
@@ -214,6 +214,7 @@ storage-class-specifier const error_category& iostream_category() noexcept;
 #include <__locale>
 #include <iosfwd>
 #include <system_error>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
 #include <atomic>     // for __xindex_

diff  --git a/libcxx/include/iosfwd b/libcxx/include/iosfwd
index 938d712cf36b0..c2ba8ee9e652a 100644
--- a/libcxx/include/iosfwd
+++ b/libcxx/include/iosfwd
@@ -96,6 +96,7 @@ using u32streampos = fpos<char_traits<char32_t>::state_type>;
 
 #include <__config>
 #include <__mbstate_t.h>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header

diff  --git a/libcxx/include/iostream b/libcxx/include/iostream
index 7397acfc678b7..793f08ab13301 100644
--- a/libcxx/include/iostream
+++ b/libcxx/include/iostream
@@ -38,6 +38,7 @@ extern wostream wclog;
 #include <istream>
 #include <ostream>
 #include <streambuf>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header

diff  --git a/libcxx/include/latch b/libcxx/include/latch
index e65825991b590..2cc9222baadcb 100644
--- a/libcxx/include/latch
+++ b/libcxx/include/latch
@@ -43,6 +43,7 @@ namespace std
 #include <__availability>
 #include <__config>
 #include <atomic>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header

diff  --git a/libcxx/include/queue b/libcxx/include/queue
index 03081eb844ba8..9fad80253c502 100644
--- a/libcxx/include/queue
+++ b/libcxx/include/queue
@@ -213,6 +213,7 @@ template <class T, class Container, class Compare>
 #include <deque>
 #include <functional>
 #include <vector>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header

diff  --git a/libcxx/include/random b/libcxx/include/random
index c88bfce03b197..2e271cec46ad7 100644
--- a/libcxx/include/random
+++ b/libcxx/include/random
@@ -1715,6 +1715,7 @@ class piecewise_linear_distribution
 #include <__random/uniform_real_distribution.h>
 #include <__random/weibull_distribution.h>
 #include <initializer_list>
+#include <version>
 
 #include <algorithm>   // for backward compatibility; TODO remove it
 #include <cmath>       // for backward compatibility; TODO remove it

diff  --git a/libcxx/include/ratio b/libcxx/include/ratio
index 16b45a28ed8bb..8859261208d06 100644
--- a/libcxx/include/ratio
+++ b/libcxx/include/ratio
@@ -81,6 +81,7 @@ typedef ratio<1000000000000000000000000, 1> yotta;  // not supported
 #include <climits>
 #include <cstdint>
 #include <type_traits>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header

diff  --git a/libcxx/include/semaphore b/libcxx/include/semaphore
index 2c2518bce46a2..f83f7b4551116 100644
--- a/libcxx/include/semaphore
+++ b/libcxx/include/semaphore
@@ -49,6 +49,7 @@ using binary_semaphore = counting_semaphore<1>;
 #include <__config>
 #include <__threading_support>
 #include <atomic>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header

diff  --git a/libcxx/include/sstream b/libcxx/include/sstream
index e63d1434ac769..6ad624a93a653 100644
--- a/libcxx/include/sstream
+++ b/libcxx/include/sstream
@@ -184,6 +184,7 @@ typedef basic_stringstream<wchar_t> wstringstream;
 #include <istream>
 #include <ostream>
 #include <string>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header

diff  --git a/libcxx/include/stack b/libcxx/include/stack
index 5d959c33c7424..3cf6cd2332823 100644
--- a/libcxx/include/stack
+++ b/libcxx/include/stack
@@ -91,6 +91,7 @@ template <class T, class Container>
 #include <__memory/uses_allocator.h>
 #include <__utility/forward.h>
 #include <deque>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header

diff  --git a/libcxx/include/streambuf b/libcxx/include/streambuf
index db3078d809a5b..aa66370f1b687 100644
--- a/libcxx/include/streambuf
+++ b/libcxx/include/streambuf
@@ -110,6 +110,7 @@ protected:
 #include <__config>
 #include <ios>
 #include <iosfwd>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header

diff  --git a/libcxx/include/strstream b/libcxx/include/strstream
index a5f17a9dc3196..c34a5628b6346 100644
--- a/libcxx/include/strstream
+++ b/libcxx/include/strstream
@@ -132,6 +132,7 @@ private:
 #include <__config>
 #include <istream>
 #include <ostream>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header

diff  --git a/libcxx/include/system_error b/libcxx/include/system_error
index 059fa0e2d511b..6d3a6ca650386 100644
--- a/libcxx/include/system_error
+++ b/libcxx/include/system_error
@@ -150,6 +150,7 @@ template <> struct hash<std::error_condition>;
 #include <stdexcept>
 #include <string>
 #include <type_traits>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header

diff  --git a/libcxx/include/thread b/libcxx/include/thread
index a4632f6fe524c..00c4ae35eccbc 100644
--- a/libcxx/include/thread
+++ b/libcxx/include/thread
@@ -97,6 +97,7 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
 #include <system_error>
 #include <tuple>
 #include <type_traits>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header

diff  --git a/libcxx/include/typeindex b/libcxx/include/typeindex
index 790aea4d47634..ede0c7fb25c20 100644
--- a/libcxx/include/typeindex
+++ b/libcxx/include/typeindex
@@ -49,6 +49,7 @@ struct hash<type_index>
 #include <__functional_base>
 #include <compare>
 #include <typeinfo>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header

diff  --git a/libcxx/include/valarray b/libcxx/include/valarray
index 909e0422c476d..a55d921872ba3 100644
--- a/libcxx/include/valarray
+++ b/libcxx/include/valarray
@@ -348,6 +348,7 @@ template <class T> unspecified2 end(const valarray<T>& v);
 #include <functional>
 #include <initializer_list>
 #include <new>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header

diff  --git a/libcxx/utils/graph_header_deps.py b/libcxx/utils/graph_header_deps.py
index 95b0a482ae094..8c19165ab493e 100755
--- a/libcxx/utils/graph_header_deps.py
+++ b/libcxx/utils/graph_header_deps.py
@@ -14,7 +14,7 @@
 
 
 def is_config_header(h):
-    return os.path.basename(h) in ['__config', '__libcpp_version', '__undef_macros']
+    return os.path.basename(h) in ['__config', '__libcpp_version', '__undef_macros', 'version']
 
 
 def is_experimental_header(h):


        


More information about the libcxx-commits mailing list