[libc++] Clean up some now dead code with the upgrade to GCC 14 (#97746)

This commit is contained in:
Nikolas Klauser 2024-07-13 09:41:36 +02:00 committed by GitHub
parent 3fed312d2b
commit 69fecaa1a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 31 additions and 273 deletions

View File

@ -162,16 +162,6 @@ _LIBCPP_HARDENING_MODE_DEBUG
# define _LIBCPP_CXX03_LANG
# endif
// TODO: Remove once we switch to GCC 14
# ifndef __has_extension
# define __has_extension(__x) 0
# endif
// TODO: Remove once we switch to GCC 14
# ifndef __has_feature
# define __has_feature(__x) 0
# endif
# ifndef __has_constexpr_builtin
# define __has_constexpr_builtin(x) 0
# endif
@ -348,44 +338,30 @@ typedef __char32_t char32_t;
# define _LIBCPP_PREFERRED_ALIGNOF(_Tp) __alignof(_Tp)
# if defined(_LIBCPP_COMPILER_CLANG_BASED)
// Objective-C++ features (opt-in)
# if __has_feature(objc_arc)
# define _LIBCPP_HAS_OBJC_ARC
# endif
# if __has_feature(objc_arc)
# define _LIBCPP_HAS_OBJC_ARC
# endif
# if __has_feature(objc_arc_weak)
# define _LIBCPP_HAS_OBJC_ARC_WEAK
# endif
# if __has_feature(objc_arc_weak)
# define _LIBCPP_HAS_OBJC_ARC_WEAK
# endif
# if __has_extension(blocks)
# define _LIBCPP_HAS_EXTENSION_BLOCKS
# endif
# if __has_extension(blocks)
# define _LIBCPP_HAS_EXTENSION_BLOCKS
# endif
# if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && defined(__APPLE__)
# define _LIBCPP_HAS_BLOCKS_RUNTIME
# endif
# if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && defined(__APPLE__)
# define _LIBCPP_HAS_BLOCKS_RUNTIME
# endif
# if !__has_feature(address_sanitizer)
# define _LIBCPP_HAS_NO_ASAN
# endif
# if !__has_feature(address_sanitizer)
# define _LIBCPP_HAS_NO_ASAN
# endif
# define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__))
# define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__))
# define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__
# elif defined(_LIBCPP_COMPILER_GCC)
# if !defined(__SANITIZE_ADDRESS__)
# define _LIBCPP_HAS_NO_ASAN
# endif
# define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__))
# define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__
# endif // _LIBCPP_COMPILER_[CLANG|GCC]
# define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__
# if defined(_LIBCPP_OBJECT_FORMAT_COFF)

View File

@ -40,32 +40,6 @@ struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const volatile _Tp> {
#ifndef _LIBCPP_CXX03_LANG
# if !__has_builtin(__type_pack_element)
namespace __indexer_detail {
template <size_t _Idx, class _Tp>
struct __indexed {
using type _LIBCPP_NODEBUG = _Tp;
};
template <class _Types, class _Indexes>
struct __indexer;
template <class... _Types, size_t... _Idx>
struct __indexer<__tuple_types<_Types...>, __tuple_indices<_Idx...>> : __indexed<_Idx, _Types>... {};
template <size_t _Idx, class _Tp>
__indexed<_Idx, _Tp> __at_index(__indexed<_Idx, _Tp> const&);
} // namespace __indexer_detail
template <size_t _Idx, class... _Types>
using __type_pack_element _LIBCPP_NODEBUG = typename decltype(__indexer_detail::__at_index<_Idx>(
__indexer_detail::__indexer< __tuple_types<_Types...>,
typename __make_tuple_indices<sizeof...(_Types)>::type >{}))::type;
# endif
template <size_t _Ip, class... _Types>
struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, __tuple_types<_Types...> > {
static_assert(_Ip < sizeof...(_Types), "tuple_element index out of range");

View File

@ -11,8 +11,6 @@
#include <__config>
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_const.h>
#include <__type_traits/is_reference.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@ -20,22 +18,12 @@
_LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_function)
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_function : integral_constant<bool, __is_function(_Tp)> {};
#else
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_function
: public integral_constant<bool, !(is_reference<_Tp>::value || is_const<const _Tp>::value)> {};
#endif // __has_builtin(__is_function)
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_function_v = is_function<_Tp>::value;
inline constexpr bool is_function_v = __is_function(_Tp);
#endif
_LIBCPP_END_NAMESPACE_STD

View File

@ -11,9 +11,6 @@
#include <__config>
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_function.h>
#include <__type_traits/remove_cv.h>
#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@ -21,21 +18,6 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct __libcpp_is_member_pointer {
enum { __is_member = false, __is_func = false, __is_obj = false };
};
template <class _Tp, class _Up>
struct __libcpp_is_member_pointer<_Tp _Up::*> {
enum {
__is_member = true,
__is_func = is_function<_Tp>::value,
__is_obj = !__is_func,
};
};
#if __has_builtin(__is_member_function_pointer)
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer : _BoolConstant<__is_member_function_pointer(_Tp)> {};
@ -44,19 +26,6 @@ template <class _Tp>
inline constexpr bool is_member_function_pointer_v = __is_member_function_pointer(_Tp);
# endif
#else // __has_builtin(__is_member_function_pointer)
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer
: public _BoolConstant<__libcpp_is_member_pointer<__remove_cv_t<_Tp> >::__is_func> {};
# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_member_function_pointer_v = is_member_function_pointer<_Tp>::value;
# endif
#endif // __has_builtin(__is_member_function_pointer)
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP___TYPE_TRAITS_IS_MEMBER_FUNCTION_POINTER_H

View File

@ -18,8 +18,6 @@
_LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_member_object_pointer)
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer : _BoolConstant<__is_member_object_pointer(_Tp)> {};
@ -28,19 +26,6 @@ template <class _Tp>
inline constexpr bool is_member_object_pointer_v = __is_member_object_pointer(_Tp);
# endif
#else // __has_builtin(__is_member_object_pointer)
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer
: public _BoolConstant<__libcpp_is_member_pointer<__remove_cv_t<_Tp> >::__is_obj> {};
# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_member_object_pointer_v = is_member_object_pointer<_Tp>::value;
# endif
#endif // __has_builtin(__is_member_object_pointer)
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP___TYPE_TRAITS_IS_MEMBER_FUNCTION_POINTER_H

View File

@ -11,7 +11,6 @@
#include <__config>
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_member_function_pointer.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@ -19,8 +18,6 @@
_LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_member_pointer)
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_member_pointer : _BoolConstant<__is_member_pointer(_Tp)> {};
@ -29,19 +26,6 @@ template <class _Tp>
inline constexpr bool is_member_pointer_v = __is_member_pointer(_Tp);
# endif
#else // __has_builtin(__is_member_pointer)
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_member_pointer
: public _BoolConstant<__libcpp_is_member_pointer<__remove_cv_t<_Tp> >::__is_member> {};
# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_member_pointer_v = is_member_pointer<_Tp>::value;
# endif
#endif // __has_builtin(__is_member_pointer)
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP___TYPE_TRAITS_IS_MEMBER_POINTER_H

View File

@ -13,10 +13,6 @@
#include <__type_traits/add_lvalue_reference.h>
#include <__type_traits/add_rvalue_reference.h>
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_constructible.h>
#include <__type_traits/is_reference.h>
#include <__utility/declval.h>
#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@ -24,85 +20,28 @@
_LIBCPP_BEGIN_NAMESPACE_STD
// GCC is disabled due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611
#if __has_builtin(__is_nothrow_constructible) && !defined(_LIBCPP_COMPILER_GCC)
template < class _Tp, class... _Args>
struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible
: public integral_constant<bool, __is_nothrow_constructible(_Tp, _Args...)> {};
#else
template <bool, bool, class _Tp, class... _Args>
struct __libcpp_is_nothrow_constructible;
template <class _Tp, class... _Args>
struct __libcpp_is_nothrow_constructible</*is constructible*/ true, /*is reference*/ false, _Tp, _Args...>
: public integral_constant<bool, noexcept(_Tp(std::declval<_Args>()...))> {};
template <class _Tp>
void __implicit_conversion_to(_Tp) noexcept {}
template <class _Tp, class _Arg>
struct __libcpp_is_nothrow_constructible</*is constructible*/ true, /*is reference*/ true, _Tp, _Arg>
: public integral_constant<bool, noexcept(std::__implicit_conversion_to<_Tp>(std::declval<_Arg>()))> {};
template <class _Tp, bool _IsReference, class... _Args>
struct __libcpp_is_nothrow_constructible</*is constructible*/ false, _IsReference, _Tp, _Args...> : public false_type {
};
template <class _Tp, class... _Args>
struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible
: __libcpp_is_nothrow_constructible<is_constructible<_Tp, _Args...>::value,
is_reference<_Tp>::value,
_Tp,
_Args...> {};
template <class _Tp, size_t _Ns>
struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp[_Ns]>
: __libcpp_is_nothrow_constructible<is_constructible<_Tp>::value, is_reference<_Tp>::value, _Tp> {};
#endif // __has_builtin(__is_nothrow_constructible)
#if _LIBCPP_STD_VER >= 17
template <class _Tp, class... _Args>
inline constexpr bool is_nothrow_constructible_v = is_nothrow_constructible<_Tp, _Args...>::value;
#endif
// TODO: remove this implementation once https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611 is fixed
#ifdef _LIBCPP_COMPILER_GCC
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_constructible
: public is_nothrow_constructible<_Tp, __add_lvalue_reference_t<const _Tp> > {};
#else // _LIBCPP_COMPILER_GCC
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_constructible
: public integral_constant< bool, __is_nothrow_constructible(_Tp, __add_lvalue_reference_t<const _Tp>)> {};
#endif // _LIBCPP_COMPILER_GCC
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_nothrow_copy_constructible_v = is_nothrow_copy_constructible<_Tp>::value;
#endif
// TODO: remove this implementation once https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611 is fixed
#ifndef _LIBCPP_COMPILER_GCC
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible
: public integral_constant<bool, __is_nothrow_constructible(_Tp, __add_rvalue_reference_t<_Tp>)> {};
#else // _LIBCPP_COMPILER_GCC
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible
: public is_nothrow_constructible<_Tp, __add_rvalue_reference_t<_Tp> > {};
#endif // _LIBCPP_COMPILER_GCC
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_nothrow_move_constructible_v = is_nothrow_move_constructible<_Tp>::value;

View File

@ -11,10 +11,6 @@
#include <__config>
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_array.h>
#include <__type_traits/is_class.h>
#include <__type_traits/is_scalar.h>
#include <__type_traits/is_union.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@ -22,30 +18,13 @@
_LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_object)
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_object : _BoolConstant<__is_object(_Tp)> {};
# if _LIBCPP_STD_VER >= 17
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_object_v = __is_object(_Tp);
# endif
#else // __has_builtin(__is_object)
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_object
: public integral_constant<bool,
is_scalar<_Tp>::value || is_array<_Tp>::value || is_union<_Tp>::value ||
is_class<_Tp>::value > {};
# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_object_v = is_object<_Tp>::value;
# endif
#endif // __has_builtin(__is_object)
#endif
_LIBCPP_END_NAMESPACE_STD

View File

@ -18,7 +18,15 @@
_LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_lvalue_reference) && __has_builtin(__is_rvalue_reference) && __has_builtin(__is_reference)
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_reference : _BoolConstant<__is_reference(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_reference_v = __is_reference(_Tp);
#endif
#if __has_builtin(__is_lvalue_reference) && __has_builtin(__is_rvalue_reference)
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : _BoolConstant<__is_lvalue_reference(_Tp)> {};
@ -26,19 +34,14 @@ struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : _BoolConstant<__is_lvalue_refe
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference : _BoolConstant<__is_rvalue_reference(_Tp)> {};
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_reference : _BoolConstant<__is_reference(_Tp)> {};
# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_reference_v = __is_reference(_Tp);
template <class _Tp>
inline constexpr bool is_lvalue_reference_v = __is_lvalue_reference(_Tp);
template <class _Tp>
inline constexpr bool is_rvalue_reference_v = __is_rvalue_reference(_Tp);
# endif
#else // __has_builtin(__is_lvalue_reference) && etc...
#else // __has_builtin(__is_lvalue_reference)
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : public false_type {};
@ -50,17 +53,7 @@ struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference : public false_type {};
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference<_Tp&&> : public true_type {};
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_reference : public false_type {};
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&> : public true_type {};
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&&> : public true_type {};
# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_reference_v = is_reference<_Tp>::value;
template <class _Tp>
inline constexpr bool is_lvalue_reference_v = is_lvalue_reference<_Tp>::value;
@ -68,7 +61,7 @@ template <class _Tp>
inline constexpr bool is_rvalue_reference_v = is_rvalue_reference<_Tp>::value;
# endif
#endif // __has_builtin(__is_lvalue_reference) && etc...
#endif // __has_builtin(__is_lvalue_reference)
_LIBCPP_END_NAMESPACE_STD

View File

@ -11,9 +11,6 @@
#include <__config>
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_convertible.h>
#include <__type_traits/is_enum.h>
#include <__type_traits/underlying_type.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@ -23,31 +20,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 23
// TODO: GCC and Clang both have this builtin. Remove the false case once we've updated to GCC 14.
# if __has_builtin(__is_scoped_enum)
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_scoped_enum : bool_constant<__is_scoped_enum(_Tp)> {};
template <class _Tp>
inline constexpr bool is_scoped_enum_v = __is_scoped_enum(_Tp);
# else
template <class _Tp, bool = is_enum_v<_Tp> >
struct __is_scoped_enum_helper : false_type {};
template <class _Tp>
struct __is_scoped_enum_helper<_Tp, true> : public bool_constant<!is_convertible_v<_Tp, underlying_type_t<_Tp> > > {};
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_scoped_enum : public __is_scoped_enum_helper<_Tp> {};
template <class _Tp>
inline constexpr bool is_scoped_enum_v = is_scoped_enum<_Tp>::value;
# endif // __has_builtin(__is_scoped_enum)
#endif // _LIBCPP_STD_VER >= 23
_LIBCPP_END_NAMESPACE_STD

View File

@ -855,7 +855,6 @@ string_view version
strstream istream
strstream ostream
strstream version
syncstream cstddef
syncstream ios
syncstream iosfwd
syncstream map

1 algorithm atomic
855 strstream istream
856 strstream ostream
857 strstream version
syncstream cstddef
858 syncstream ios
859 syncstream iosfwd
860 syncstream map

View File

@ -862,7 +862,6 @@ string_view version
strstream istream
strstream ostream
strstream version
syncstream cstddef
syncstream ios
syncstream iosfwd
syncstream map

1 algorithm atomic
862 strstream istream
863 strstream ostream
864 strstream version
syncstream cstddef
865 syncstream ios
866 syncstream iosfwd
867 syncstream map

View File

@ -865,7 +865,6 @@ string_view version
strstream istream
strstream ostream
strstream version
syncstream cstddef
syncstream ios
syncstream iosfwd
syncstream map

1 algorithm atomic
865 strstream istream
866 strstream ostream
867 strstream version
syncstream cstddef
868 syncstream ios
869 syncstream iosfwd
870 syncstream map

View File

@ -866,7 +866,6 @@ string_view version
strstream istream
strstream ostream
strstream version
syncstream cstddef
syncstream ios
syncstream iosfwd
syncstream map

1 algorithm atomic
866 strstream istream
867 strstream ostream
868 strstream version
syncstream cstddef
869 syncstream ios
870 syncstream iosfwd
871 syncstream map

View File

@ -873,7 +873,6 @@ string_view version
strstream istream
strstream ostream
strstream version
syncstream cstddef
syncstream ios
syncstream iosfwd
syncstream map

1 algorithm atomic
873 strstream istream
874 strstream ostream
875 strstream version
syncstream cstddef
876 syncstream ios
877 syncstream iosfwd
878 syncstream map

View File

@ -599,7 +599,6 @@ string_view version
strstream istream
strstream ostream
strstream version
syncstream cstddef
syncstream ios
syncstream iosfwd
syncstream map

1 algorithm climits
599 strstream istream
600 strstream ostream
601 strstream version
syncstream cstddef
602 syncstream ios
603 syncstream iosfwd
604 syncstream map

View File

@ -599,7 +599,6 @@ string_view version
strstream istream
strstream ostream
strstream version
syncstream cstddef
syncstream ios
syncstream iosfwd
syncstream map

1 algorithm climits
599 strstream istream
600 strstream ostream
601 strstream version
syncstream cstddef
602 syncstream ios
603 syncstream iosfwd
604 syncstream map