[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
NOKEYCHECK=True
GitOrigin-RevId: bd6e6846e7f431e9d84b1f257d4a0c8ddeac4fe2
diff --git a/include/bitset b/include/bitset
index 8f538e9..809fadf 100644
--- a/include/bitset
+++ b/include/bitset
@@ -120,6 +120,7 @@
#include <iosfwd>
#include <stdexcept>
#include <string>
+#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/include/codecvt b/include/codecvt
index 60d3db8..74839d1 100644
--- a/include/codecvt
+++ b/include/codecvt
@@ -56,6 +56,7 @@
#include <__config>
#include <__locale>
+#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/include/compare b/include/compare
index 5d07eba..d686b5a 100644
--- a/include/compare
+++ b/include/compare
@@ -145,6 +145,7 @@
#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/include/condition_variable b/include/condition_variable
index 0569e22..ecec3ea 100644
--- a/include/condition_variable
+++ b/include/condition_variable
@@ -109,6 +109,7 @@
#include <__config>
#include <__mutex_base>
#include <memory>
+#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/include/execution b/include/execution
index c1debcb..417b11b 100644
--- a/include/execution
+++ b/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/include/fstream b/include/fstream
index 3d64adc..fc0a920 100644
--- a/include/fstream
+++ b/include/fstream
@@ -187,6 +187,7 @@
#include <cstdlib>
#include <istream>
#include <ostream>
+#include <version>
#if !defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY)
# include <filesystem>
diff --git a/include/future b/include/future
index 6b666a7..e35eedf 100644
--- a/include/future
+++ b/include/future
@@ -374,6 +374,7 @@
#include <mutex>
#include <system_error>
#include <thread>
+#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/include/ios b/include/ios
index 237d146..74c3c63 100644
--- a/include/ios
+++ b/include/ios
@@ -214,6 +214,7 @@
#include <__locale>
#include <iosfwd>
#include <system_error>
+#include <version>
#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
#include <atomic> // for __xindex_
diff --git a/include/iosfwd b/include/iosfwd
index 938d712..c2ba8ee 100644
--- a/include/iosfwd
+++ b/include/iosfwd
@@ -96,6 +96,7 @@
#include <__config>
#include <__mbstate_t.h>
+#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/include/iostream b/include/iostream
index 7397acf..793f08a 100644
--- a/include/iostream
+++ b/include/iostream
@@ -38,6 +38,7 @@
#include <istream>
#include <ostream>
#include <streambuf>
+#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/include/latch b/include/latch
index e658259..2cc9222 100644
--- a/include/latch
+++ b/include/latch
@@ -43,6 +43,7 @@
#include <__availability>
#include <__config>
#include <atomic>
+#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/include/queue b/include/queue
index 03081eb..9fad802 100644
--- a/include/queue
+++ b/include/queue
@@ -213,6 +213,7 @@
#include <deque>
#include <functional>
#include <vector>
+#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/include/random b/include/random
index c88bfce..2e271ce 100644
--- a/include/random
+++ b/include/random
@@ -1715,6 +1715,7 @@
#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/include/ratio b/include/ratio
index 16b45a2..8859261 100644
--- a/include/ratio
+++ b/include/ratio
@@ -81,6 +81,7 @@
#include <climits>
#include <cstdint>
#include <type_traits>
+#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/include/semaphore b/include/semaphore
index 2c2518b..f83f7b4 100644
--- a/include/semaphore
+++ b/include/semaphore
@@ -49,6 +49,7 @@
#include <__config>
#include <__threading_support>
#include <atomic>
+#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/include/sstream b/include/sstream
index e63d143..6ad624a 100644
--- a/include/sstream
+++ b/include/sstream
@@ -184,6 +184,7 @@
#include <istream>
#include <ostream>
#include <string>
+#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/include/stack b/include/stack
index 5d959c3..3cf6cd2 100644
--- a/include/stack
+++ b/include/stack
@@ -91,6 +91,7 @@
#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/include/streambuf b/include/streambuf
index db3078d..aa66370 100644
--- a/include/streambuf
+++ b/include/streambuf
@@ -110,6 +110,7 @@
#include <__config>
#include <ios>
#include <iosfwd>
+#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/include/strstream b/include/strstream
index a5f17a9..c34a562 100644
--- a/include/strstream
+++ b/include/strstream
@@ -132,6 +132,7 @@
#include <__config>
#include <istream>
#include <ostream>
+#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/include/system_error b/include/system_error
index 059fa0e..6d3a6ca 100644
--- a/include/system_error
+++ b/include/system_error
@@ -150,6 +150,7 @@
#include <stdexcept>
#include <string>
#include <type_traits>
+#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/include/thread b/include/thread
index a4632f6..00c4ae3 100644
--- a/include/thread
+++ b/include/thread
@@ -97,6 +97,7 @@
#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/include/typeindex b/include/typeindex
index 790aea4..ede0c7f 100644
--- a/include/typeindex
+++ b/include/typeindex
@@ -49,6 +49,7 @@
#include <__functional_base>
#include <compare>
#include <typeinfo>
+#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/include/valarray b/include/valarray
index 909e042..a55d921 100644
--- a/include/valarray
+++ b/include/valarray
@@ -348,6 +348,7 @@
#include <functional>
#include <initializer_list>
#include <new>
+#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/utils/graph_header_deps.py b/utils/graph_header_deps.py
index 95b0a48..8c19165 100755
--- a/utils/graph_header_deps.py
+++ b/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):