Skip to content

[libc++] Add #if 0 block to all the top-level headers #119234

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading