Skip to content

Commit c166a9c

Browse files
authored
[libc++] Add #if 0 block to all the top-level headers (#119234)
Including The frozen C++03 headers results in a lot of formatting changes in the main headers, so this splits these changes into a separate commit instead. This is part of https://discourse.llvm.org/t/rfc-freezing-c-03-headers-in-libc.
1 parent dadd845 commit c166a9c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+6762
-6374
lines changed

libcxx/include/algorithm

+226-223
Large diffs are not rendered by default.

libcxx/include/any

+69-66
Original file line numberDiff line numberDiff line change
@@ -80,41 +80,43 @@ namespace std {
8080
8181
*/
8282

83-
#include <__config>
84-
#include <__memory/allocator.h>
85-
#include <__memory/allocator_destructor.h>
86-
#include <__memory/allocator_traits.h>
87-
#include <__memory/unique_ptr.h>
88-
#include <__type_traits/add_cv_quals.h>
89-
#include <__type_traits/add_pointer.h>
90-
#include <__type_traits/aligned_storage.h>
91-
#include <__type_traits/conditional.h>
92-
#include <__type_traits/decay.h>
93-
#include <__type_traits/enable_if.h>
94-
#include <__type_traits/is_constructible.h>
95-
#include <__type_traits/is_function.h>
96-
#include <__type_traits/is_nothrow_constructible.h>
97-
#include <__type_traits/is_reference.h>
98-
#include <__type_traits/is_same.h>
99-
#include <__type_traits/is_void.h>
100-
#include <__type_traits/remove_cv.h>
101-
#include <__type_traits/remove_cvref.h>
102-
#include <__type_traits/remove_reference.h>
103-
#include <__utility/forward.h>
104-
#include <__utility/in_place.h>
105-
#include <__utility/move.h>
106-
#include <__utility/unreachable.h>
107-
#include <__verbose_abort>
108-
#include <initializer_list>
109-
#include <typeinfo>
110-
#include <version>
111-
112-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
113-
# pragma GCC system_header
114-
#endif
83+
#if 0
84+
#else // 0
85+
# include <__config>
86+
# include <__memory/allocator.h>
87+
# include <__memory/allocator_destructor.h>
88+
# include <__memory/allocator_traits.h>
89+
# include <__memory/unique_ptr.h>
90+
# include <__type_traits/add_cv_quals.h>
91+
# include <__type_traits/add_pointer.h>
92+
# include <__type_traits/aligned_storage.h>
93+
# include <__type_traits/conditional.h>
94+
# include <__type_traits/decay.h>
95+
# include <__type_traits/enable_if.h>
96+
# include <__type_traits/is_constructible.h>
97+
# include <__type_traits/is_function.h>
98+
# include <__type_traits/is_nothrow_constructible.h>
99+
# include <__type_traits/is_reference.h>
100+
# include <__type_traits/is_same.h>
101+
# include <__type_traits/is_void.h>
102+
# include <__type_traits/remove_cv.h>
103+
# include <__type_traits/remove_cvref.h>
104+
# include <__type_traits/remove_reference.h>
105+
# include <__utility/forward.h>
106+
# include <__utility/in_place.h>
107+
# include <__utility/move.h>
108+
# include <__utility/unreachable.h>
109+
# include <__verbose_abort>
110+
# include <initializer_list>
111+
# include <typeinfo>
112+
# include <version>
113+
114+
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
115+
# pragma GCC system_header
116+
# endif
115117

116118
_LIBCPP_PUSH_MACROS
117-
#include <__undef_macros>
119+
# include <__undef_macros>
118120

119121
namespace std {
120122
class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_AVAILABILITY_BAD_ANY_CAST bad_any_cast : public bad_cast {
@@ -125,14 +127,14 @@ public:
125127

126128
_LIBCPP_BEGIN_NAMESPACE_STD
127129

128-
#if _LIBCPP_STD_VER >= 17
130+
# if _LIBCPP_STD_VER >= 17
129131

130132
[[noreturn]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST void __throw_bad_any_cast() {
131-
# if _LIBCPP_HAS_EXCEPTIONS
133+
# if _LIBCPP_HAS_EXCEPTIONS
132134
throw bad_any_cast();
133-
# else
135+
# else
134136
_LIBCPP_VERBOSE_ABORT("bad_any_cast was thrown in -fno-exceptions mode");
135-
# endif
137+
# endif
136138
}
137139

138140
// Forward declarations
@@ -174,10 +176,10 @@ inline _LIBCPP_HIDE_FROM_ABI constexpr const void* __get_fallback_typeid() {
174176

175177
template <class _Tp>
176178
inline _LIBCPP_HIDE_FROM_ABI bool __compare_typeid(type_info const* __id, const void* __fallback_id) {
177-
# if _LIBCPP_HAS_RTTI
179+
# if _LIBCPP_HAS_RTTI
178180
if (__id && *__id == typeid(_Tp))
179181
return true;
180-
# endif
182+
# endif
181183
return !__id && __fallback_id == __any_imp::__get_fallback_typeid<_Tp>();
182184
}
183185

@@ -264,15 +266,15 @@ public:
264266
// 6.3.4 any observers
265267
_LIBCPP_HIDE_FROM_ABI bool has_value() const _NOEXCEPT { return __h_ != nullptr; }
266268

267-
# if _LIBCPP_HAS_RTTI
269+
# if _LIBCPP_HAS_RTTI
268270
_LIBCPP_HIDE_FROM_ABI const type_info& type() const _NOEXCEPT {
269271
if (__h_) {
270272
return *static_cast<type_info const*>(this->__call(_Action::_TypeInfo));
271273
} else {
272274
return typeid(void);
273275
}
274276
}
275-
# endif
277+
# endif
276278

277279
private:
278280
typedef __any_imp::_Action _Action;
@@ -370,11 +372,11 @@ private:
370372
}
371373

372374
_LIBCPP_HIDE_FROM_ABI static void* __type_info() {
373-
# if _LIBCPP_HAS_RTTI
375+
# if _LIBCPP_HAS_RTTI
374376
return const_cast<void*>(static_cast<void const*>(&typeid(_Tp)));
375-
# else
377+
# else
376378
return nullptr;
377-
# endif
379+
# endif
378380
}
379381
};
380382

@@ -442,11 +444,11 @@ private:
442444
}
443445

444446
_LIBCPP_HIDE_FROM_ABI static void* __type_info() {
445-
# if _LIBCPP_HAS_RTTI
447+
# if _LIBCPP_HAS_RTTI
446448
return const_cast<void*>(static_cast<void const*>(&typeid(_Tp)));
447-
# else
449+
# else
448450
return nullptr;
449-
# endif
451+
# endif
450452
}
451453
};
452454

@@ -577,37 +579,38 @@ _LIBCPP_HIDE_FROM_ABI add_pointer_t<_ValueType> any_cast(any* __any) _NOEXCEPT {
577579
void* __p = __any->__call(
578580
_Action::_Get,
579581
nullptr,
580-
# if _LIBCPP_HAS_RTTI
582+
# if _LIBCPP_HAS_RTTI
581583
&typeid(_ValueType),
582-
# else
584+
# else
583585
nullptr,
584-
# endif
586+
# endif
585587
__any_imp::__get_fallback_typeid<_ValueType>());
586588
return std::__pointer_or_func_cast<_ReturnType>(__p, is_function<_ValueType>{});
587589
}
588590
return nullptr;
589591
}
590592

591-
#endif // _LIBCPP_STD_VER >= 17
593+
# endif // _LIBCPP_STD_VER >= 17
592594

593595
_LIBCPP_END_NAMESPACE_STD
594596

595597
_LIBCPP_POP_MACROS
596598

597-
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
598-
# include <chrono>
599-
#endif
600-
601-
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
602-
# include <atomic>
603-
# include <concepts>
604-
# include <cstdlib>
605-
# include <iosfwd>
606-
# include <iterator>
607-
# include <memory>
608-
# include <stdexcept>
609-
# include <type_traits>
610-
# include <variant>
611-
#endif
599+
# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
600+
# include <chrono>
601+
# endif
602+
603+
# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
604+
# include <atomic>
605+
# include <concepts>
606+
# include <cstdlib>
607+
# include <iosfwd>
608+
# include <iterator>
609+
# include <memory>
610+
# include <stdexcept>
611+
# include <type_traits>
612+
# include <variant>
613+
# endif
614+
#endif // 0
612615

613616
#endif // _LIBCPP_ANY

0 commit comments

Comments
 (0)