Skip to content

Commit

Permalink
[libc++] Add #if 0 block to all the top-level headers (#119234)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
philnik777 authored Dec 10, 2024
1 parent dadd845 commit c166a9c
Show file tree
Hide file tree
Showing 123 changed files with 6,762 additions and 6,374 deletions.
449 changes: 226 additions & 223 deletions libcxx/include/algorithm

Large diffs are not rendered by default.

135 changes: 69 additions & 66 deletions libcxx/include/any
Original file line number Diff line number Diff line change
Expand Up @@ -80,41 +80,43 @@ namespace std {
*/

#include <__config>
#include <__memory/allocator.h>
#include <__memory/allocator_destructor.h>
#include <__memory/allocator_traits.h>
#include <__memory/unique_ptr.h>
#include <__type_traits/add_cv_quals.h>
#include <__type_traits/add_pointer.h>
#include <__type_traits/aligned_storage.h>
#include <__type_traits/conditional.h>
#include <__type_traits/decay.h>
#include <__type_traits/enable_if.h>
#include <__type_traits/is_constructible.h>
#include <__type_traits/is_function.h>
#include <__type_traits/is_nothrow_constructible.h>
#include <__type_traits/is_reference.h>
#include <__type_traits/is_same.h>
#include <__type_traits/is_void.h>
#include <__type_traits/remove_cv.h>
#include <__type_traits/remove_cvref.h>
#include <__type_traits/remove_reference.h>
#include <__utility/forward.h>
#include <__utility/in_place.h>
#include <__utility/move.h>
#include <__utility/unreachable.h>
#include <__verbose_abort>
#include <initializer_list>
#include <typeinfo>
#include <version>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
#if 0
#else // 0
# include <__config>
# include <__memory/allocator.h>
# include <__memory/allocator_destructor.h>
# include <__memory/allocator_traits.h>
# include <__memory/unique_ptr.h>
# include <__type_traits/add_cv_quals.h>
# include <__type_traits/add_pointer.h>
# include <__type_traits/aligned_storage.h>
# include <__type_traits/conditional.h>
# include <__type_traits/decay.h>
# include <__type_traits/enable_if.h>
# include <__type_traits/is_constructible.h>
# include <__type_traits/is_function.h>
# include <__type_traits/is_nothrow_constructible.h>
# include <__type_traits/is_reference.h>
# include <__type_traits/is_same.h>
# include <__type_traits/is_void.h>
# include <__type_traits/remove_cv.h>
# include <__type_traits/remove_cvref.h>
# include <__type_traits/remove_reference.h>
# include <__utility/forward.h>
# include <__utility/in_place.h>
# include <__utility/move.h>
# include <__utility/unreachable.h>
# include <__verbose_abort>
# include <initializer_list>
# include <typeinfo>
# include <version>

# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
# endif

_LIBCPP_PUSH_MACROS
#include <__undef_macros>
# include <__undef_macros>

namespace std {
class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_AVAILABILITY_BAD_ANY_CAST bad_any_cast : public bad_cast {
Expand All @@ -125,14 +127,14 @@ public:

_LIBCPP_BEGIN_NAMESPACE_STD

#if _LIBCPP_STD_VER >= 17
# if _LIBCPP_STD_VER >= 17

[[noreturn]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST void __throw_bad_any_cast() {
# if _LIBCPP_HAS_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
throw bad_any_cast();
# else
# else
_LIBCPP_VERBOSE_ABORT("bad_any_cast was thrown in -fno-exceptions mode");
# endif
# endif
}

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

template <class _Tp>
inline _LIBCPP_HIDE_FROM_ABI bool __compare_typeid(type_info const* __id, const void* __fallback_id) {
# if _LIBCPP_HAS_RTTI
# if _LIBCPP_HAS_RTTI
if (__id && *__id == typeid(_Tp))
return true;
# endif
# endif
return !__id && __fallback_id == __any_imp::__get_fallback_typeid<_Tp>();
}

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

# if _LIBCPP_HAS_RTTI
# if _LIBCPP_HAS_RTTI
_LIBCPP_HIDE_FROM_ABI const type_info& type() const _NOEXCEPT {
if (__h_) {
return *static_cast<type_info const*>(this->__call(_Action::_TypeInfo));
} else {
return typeid(void);
}
}
# endif
# endif

private:
typedef __any_imp::_Action _Action;
Expand Down Expand Up @@ -370,11 +372,11 @@ private:
}

_LIBCPP_HIDE_FROM_ABI static void* __type_info() {
# if _LIBCPP_HAS_RTTI
# if _LIBCPP_HAS_RTTI
return const_cast<void*>(static_cast<void const*>(&typeid(_Tp)));
# else
# else
return nullptr;
# endif
# endif
}
};

Expand Down Expand Up @@ -442,11 +444,11 @@ private:
}

_LIBCPP_HIDE_FROM_ABI static void* __type_info() {
# if _LIBCPP_HAS_RTTI
# if _LIBCPP_HAS_RTTI
return const_cast<void*>(static_cast<void const*>(&typeid(_Tp)));
# else
# else
return nullptr;
# endif
# endif
}
};

Expand Down Expand Up @@ -577,37 +579,38 @@ _LIBCPP_HIDE_FROM_ABI add_pointer_t<_ValueType> any_cast(any* __any) _NOEXCEPT {
void* __p = __any->__call(
_Action::_Get,
nullptr,
# if _LIBCPP_HAS_RTTI
# if _LIBCPP_HAS_RTTI
&typeid(_ValueType),
# else
# else
nullptr,
# endif
# endif
__any_imp::__get_fallback_typeid<_ValueType>());
return std::__pointer_or_func_cast<_ReturnType>(__p, is_function<_ValueType>{});
}
return nullptr;
}

#endif // _LIBCPP_STD_VER >= 17
# endif // _LIBCPP_STD_VER >= 17

_LIBCPP_END_NAMESPACE_STD

_LIBCPP_POP_MACROS

#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
# include <chrono>
#endif

#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <atomic>
# include <concepts>
# include <cstdlib>
# include <iosfwd>
# include <iterator>
# include <memory>
# include <stdexcept>
# include <type_traits>
# include <variant>
#endif
# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
# include <chrono>
# endif

# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <atomic>
# include <concepts>
# include <cstdlib>
# include <iosfwd>
# include <iterator>
# include <memory>
# include <stdexcept>
# include <type_traits>
# include <variant>
# endif
#endif // 0

#endif // _LIBCPP_ANY
Loading

0 comments on commit c166a9c

Please sign in to comment.