[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
This commit is contained in:
Mark de Wever 2021-12-22 18:14:14 +01:00
parent 3064dd8ccf
commit bd6e6846e7
24 changed files with 24 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -11,6 +11,7 @@
#define _LIBCPP_EXECUTION
#include <__config>
#include <version>
#if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17
# include <__pstl_execution>

View File

@ -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>

View File

@ -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

View File

@ -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_

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -14,7 +14,7 @@ import sys
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):