Skip to content

Commit 69fecaa

Browse files
authored
[libc++] Clean up some now dead code with the upgrade to GCC 14 (#97746)
1 parent 3fed312 commit 69fecaa

17 files changed

+31
-273
lines changed

libcxx/include/__config

Lines changed: 17 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -162,16 +162,6 @@ _LIBCPP_HARDENING_MODE_DEBUG
162162
# define _LIBCPP_CXX03_LANG
163163
# endif
164164

165-
// TODO: Remove once we switch to GCC 14
166-
# ifndef __has_extension
167-
# define __has_extension(__x) 0
168-
# endif
169-
170-
// TODO: Remove once we switch to GCC 14
171-
# ifndef __has_feature
172-
# define __has_feature(__x) 0
173-
# endif
174-
175165
# ifndef __has_constexpr_builtin
176166
# define __has_constexpr_builtin(x) 0
177167
# endif
@@ -348,44 +338,30 @@ typedef __char32_t char32_t;
348338

349339
# define _LIBCPP_PREFERRED_ALIGNOF(_Tp) __alignof(_Tp)
350340

351-
# if defined(_LIBCPP_COMPILER_CLANG_BASED)
352-
353341
// Objective-C++ features (opt-in)
354-
# if __has_feature(objc_arc)
355-
# define _LIBCPP_HAS_OBJC_ARC
356-
# endif
357-
358-
# if __has_feature(objc_arc_weak)
359-
# define _LIBCPP_HAS_OBJC_ARC_WEAK
360-
# endif
361-
362-
# if __has_extension(blocks)
363-
# define _LIBCPP_HAS_EXTENSION_BLOCKS
364-
# endif
365-
366-
# if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && defined(__APPLE__)
367-
# define _LIBCPP_HAS_BLOCKS_RUNTIME
368-
# endif
369-
370-
# if !__has_feature(address_sanitizer)
371-
# define _LIBCPP_HAS_NO_ASAN
372-
# endif
373-
374-
# define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__))
342+
# if __has_feature(objc_arc)
343+
# define _LIBCPP_HAS_OBJC_ARC
344+
# endif
375345

376-
# define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__
346+
# if __has_feature(objc_arc_weak)
347+
# define _LIBCPP_HAS_OBJC_ARC_WEAK
348+
# endif
377349

378-
# elif defined(_LIBCPP_COMPILER_GCC)
350+
# if __has_extension(blocks)
351+
# define _LIBCPP_HAS_EXTENSION_BLOCKS
352+
# endif
379353

380-
# if !defined(__SANITIZE_ADDRESS__)
381-
# define _LIBCPP_HAS_NO_ASAN
382-
# endif
354+
# if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && defined(__APPLE__)
355+
# define _LIBCPP_HAS_BLOCKS_RUNTIME
356+
# endif
383357

384-
# define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__))
358+
# if !__has_feature(address_sanitizer)
359+
# define _LIBCPP_HAS_NO_ASAN
360+
# endif
385361

386-
# define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__
362+
# define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__))
387363

388-
# endif // _LIBCPP_COMPILER_[CLANG|GCC]
364+
# define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__
389365

390366
# if defined(_LIBCPP_OBJECT_FORMAT_COFF)
391367

libcxx/include/__tuple/tuple_element.h

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -40,32 +40,6 @@ struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const volatile _Tp> {
4040

4141
#ifndef _LIBCPP_CXX03_LANG
4242

43-
# if !__has_builtin(__type_pack_element)
44-
45-
namespace __indexer_detail {
46-
47-
template <size_t _Idx, class _Tp>
48-
struct __indexed {
49-
using type _LIBCPP_NODEBUG = _Tp;
50-
};
51-
52-
template <class _Types, class _Indexes>
53-
struct __indexer;
54-
55-
template <class... _Types, size_t... _Idx>
56-
struct __indexer<__tuple_types<_Types...>, __tuple_indices<_Idx...>> : __indexed<_Idx, _Types>... {};
57-
58-
template <size_t _Idx, class _Tp>
59-
__indexed<_Idx, _Tp> __at_index(__indexed<_Idx, _Tp> const&);
60-
61-
} // namespace __indexer_detail
62-
63-
template <size_t _Idx, class... _Types>
64-
using __type_pack_element _LIBCPP_NODEBUG = typename decltype(__indexer_detail::__at_index<_Idx>(
65-
__indexer_detail::__indexer< __tuple_types<_Types...>,
66-
typename __make_tuple_indices<sizeof...(_Types)>::type >{}))::type;
67-
# endif
68-
6943
template <size_t _Ip, class... _Types>
7044
struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, __tuple_types<_Types...> > {
7145
static_assert(_Ip < sizeof...(_Types), "tuple_element index out of range");

libcxx/include/__type_traits/is_function.h

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,19 @@
1111

1212
#include <__config>
1313
#include <__type_traits/integral_constant.h>
14-
#include <__type_traits/is_const.h>
15-
#include <__type_traits/is_reference.h>
1614

1715
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1816
# pragma GCC system_header
1917
#endif
2018

2119
_LIBCPP_BEGIN_NAMESPACE_STD
2220

23-
#if __has_builtin(__is_function)
24-
2521
template <class _Tp>
2622
struct _LIBCPP_TEMPLATE_VIS is_function : integral_constant<bool, __is_function(_Tp)> {};
2723

28-
#else
29-
30-
template <class _Tp>
31-
struct _LIBCPP_TEMPLATE_VIS is_function
32-
: public integral_constant<bool, !(is_reference<_Tp>::value || is_const<const _Tp>::value)> {};
33-
34-
#endif // __has_builtin(__is_function)
35-
3624
#if _LIBCPP_STD_VER >= 17
3725
template <class _Tp>
38-
inline constexpr bool is_function_v = is_function<_Tp>::value;
26+
inline constexpr bool is_function_v = __is_function(_Tp);
3927
#endif
4028

4129
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__type_traits/is_member_function_pointer.h

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,13 @@
1111

1212
#include <__config>
1313
#include <__type_traits/integral_constant.h>
14-
#include <__type_traits/is_function.h>
15-
#include <__type_traits/remove_cv.h>
16-
#include <cstddef>
1714

1815
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1916
# pragma GCC system_header
2017
#endif
2118

2219
_LIBCPP_BEGIN_NAMESPACE_STD
2320

24-
template <class _Tp>
25-
struct __libcpp_is_member_pointer {
26-
enum { __is_member = false, __is_func = false, __is_obj = false };
27-
};
28-
template <class _Tp, class _Up>
29-
struct __libcpp_is_member_pointer<_Tp _Up::*> {
30-
enum {
31-
__is_member = true,
32-
__is_func = is_function<_Tp>::value,
33-
__is_obj = !__is_func,
34-
};
35-
};
36-
37-
#if __has_builtin(__is_member_function_pointer)
38-
3921
template <class _Tp>
4022
struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer : _BoolConstant<__is_member_function_pointer(_Tp)> {};
4123

@@ -44,19 +26,6 @@ template <class _Tp>
4426
inline constexpr bool is_member_function_pointer_v = __is_member_function_pointer(_Tp);
4527
# endif
4628

47-
#else // __has_builtin(__is_member_function_pointer)
48-
49-
template <class _Tp>
50-
struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer
51-
: public _BoolConstant<__libcpp_is_member_pointer<__remove_cv_t<_Tp> >::__is_func> {};
52-
53-
# if _LIBCPP_STD_VER >= 17
54-
template <class _Tp>
55-
inline constexpr bool is_member_function_pointer_v = is_member_function_pointer<_Tp>::value;
56-
# endif
57-
58-
#endif // __has_builtin(__is_member_function_pointer)
59-
6029
_LIBCPP_END_NAMESPACE_STD
6130

6231
#endif // _LIBCPP___TYPE_TRAITS_IS_MEMBER_FUNCTION_POINTER_H

libcxx/include/__type_traits/is_member_object_pointer.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818

1919
_LIBCPP_BEGIN_NAMESPACE_STD
2020

21-
#if __has_builtin(__is_member_object_pointer)
22-
2321
template <class _Tp>
2422
struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer : _BoolConstant<__is_member_object_pointer(_Tp)> {};
2523

@@ -28,19 +26,6 @@ template <class _Tp>
2826
inline constexpr bool is_member_object_pointer_v = __is_member_object_pointer(_Tp);
2927
# endif
3028

31-
#else // __has_builtin(__is_member_object_pointer)
32-
33-
template <class _Tp>
34-
struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer
35-
: public _BoolConstant<__libcpp_is_member_pointer<__remove_cv_t<_Tp> >::__is_obj> {};
36-
37-
# if _LIBCPP_STD_VER >= 17
38-
template <class _Tp>
39-
inline constexpr bool is_member_object_pointer_v = is_member_object_pointer<_Tp>::value;
40-
# endif
41-
42-
#endif // __has_builtin(__is_member_object_pointer)
43-
4429
_LIBCPP_END_NAMESPACE_STD
4530

4631
#endif // _LIBCPP___TYPE_TRAITS_IS_MEMBER_FUNCTION_POINTER_H

libcxx/include/__type_traits/is_member_pointer.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,13 @@
1111

1212
#include <__config>
1313
#include <__type_traits/integral_constant.h>
14-
#include <__type_traits/is_member_function_pointer.h>
1514

1615
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1716
# pragma GCC system_header
1817
#endif
1918

2019
_LIBCPP_BEGIN_NAMESPACE_STD
2120

22-
#if __has_builtin(__is_member_pointer)
23-
2421
template <class _Tp>
2522
struct _LIBCPP_TEMPLATE_VIS is_member_pointer : _BoolConstant<__is_member_pointer(_Tp)> {};
2623

@@ -29,19 +26,6 @@ template <class _Tp>
2926
inline constexpr bool is_member_pointer_v = __is_member_pointer(_Tp);
3027
# endif
3128

32-
#else // __has_builtin(__is_member_pointer)
33-
34-
template <class _Tp>
35-
struct _LIBCPP_TEMPLATE_VIS is_member_pointer
36-
: public _BoolConstant<__libcpp_is_member_pointer<__remove_cv_t<_Tp> >::__is_member> {};
37-
38-
# if _LIBCPP_STD_VER >= 17
39-
template <class _Tp>
40-
inline constexpr bool is_member_pointer_v = is_member_pointer<_Tp>::value;
41-
# endif
42-
43-
#endif // __has_builtin(__is_member_pointer)
44-
4529
_LIBCPP_END_NAMESPACE_STD
4630

4731
#endif // _LIBCPP___TYPE_TRAITS_IS_MEMBER_POINTER_H

libcxx/include/__type_traits/is_nothrow_constructible.h

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -13,96 +13,35 @@
1313
#include <__type_traits/add_lvalue_reference.h>
1414
#include <__type_traits/add_rvalue_reference.h>
1515
#include <__type_traits/integral_constant.h>
16-
#include <__type_traits/is_constructible.h>
17-
#include <__type_traits/is_reference.h>
18-
#include <__utility/declval.h>
19-
#include <cstddef>
2016

2117
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2218
# pragma GCC system_header
2319
#endif
2420

2521
_LIBCPP_BEGIN_NAMESPACE_STD
2622

27-
// GCC is disabled due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611
28-
#if __has_builtin(__is_nothrow_constructible) && !defined(_LIBCPP_COMPILER_GCC)
29-
3023
template < class _Tp, class... _Args>
3124
struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible
3225
: public integral_constant<bool, __is_nothrow_constructible(_Tp, _Args...)> {};
33-
#else
34-
35-
template <bool, bool, class _Tp, class... _Args>
36-
struct __libcpp_is_nothrow_constructible;
37-
38-
template <class _Tp, class... _Args>
39-
struct __libcpp_is_nothrow_constructible</*is constructible*/ true, /*is reference*/ false, _Tp, _Args...>
40-
: public integral_constant<bool, noexcept(_Tp(std::declval<_Args>()...))> {};
41-
42-
template <class _Tp>
43-
void __implicit_conversion_to(_Tp) noexcept {}
44-
45-
template <class _Tp, class _Arg>
46-
struct __libcpp_is_nothrow_constructible</*is constructible*/ true, /*is reference*/ true, _Tp, _Arg>
47-
: public integral_constant<bool, noexcept(std::__implicit_conversion_to<_Tp>(std::declval<_Arg>()))> {};
48-
49-
template <class _Tp, bool _IsReference, class... _Args>
50-
struct __libcpp_is_nothrow_constructible</*is constructible*/ false, _IsReference, _Tp, _Args...> : public false_type {
51-
};
52-
53-
template <class _Tp, class... _Args>
54-
struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible
55-
: __libcpp_is_nothrow_constructible<is_constructible<_Tp, _Args...>::value,
56-
is_reference<_Tp>::value,
57-
_Tp,
58-
_Args...> {};
59-
60-
template <class _Tp, size_t _Ns>
61-
struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp[_Ns]>
62-
: __libcpp_is_nothrow_constructible<is_constructible<_Tp>::value, is_reference<_Tp>::value, _Tp> {};
63-
64-
#endif // __has_builtin(__is_nothrow_constructible)
6526

6627
#if _LIBCPP_STD_VER >= 17
6728
template <class _Tp, class... _Args>
6829
inline constexpr bool is_nothrow_constructible_v = is_nothrow_constructible<_Tp, _Args...>::value;
6930
#endif
7031

71-
// TODO: remove this implementation once https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611 is fixed
72-
#ifdef _LIBCPP_COMPILER_GCC
73-
74-
template <class _Tp>
75-
struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_constructible
76-
: public is_nothrow_constructible<_Tp, __add_lvalue_reference_t<const _Tp> > {};
77-
78-
#else // _LIBCPP_COMPILER_GCC
79-
8032
template <class _Tp>
8133
struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_constructible
8234
: public integral_constant< bool, __is_nothrow_constructible(_Tp, __add_lvalue_reference_t<const _Tp>)> {};
8335

84-
#endif // _LIBCPP_COMPILER_GCC
85-
8636
#if _LIBCPP_STD_VER >= 17
8737
template <class _Tp>
8838
inline constexpr bool is_nothrow_copy_constructible_v = is_nothrow_copy_constructible<_Tp>::value;
8939
#endif
9040

91-
// TODO: remove this implementation once https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611 is fixed
92-
#ifndef _LIBCPP_COMPILER_GCC
93-
9441
template <class _Tp>
9542
struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible
9643
: public integral_constant<bool, __is_nothrow_constructible(_Tp, __add_rvalue_reference_t<_Tp>)> {};
9744

98-
#else // _LIBCPP_COMPILER_GCC
99-
100-
template <class _Tp>
101-
struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible
102-
: public is_nothrow_constructible<_Tp, __add_rvalue_reference_t<_Tp> > {};
103-
104-
#endif // _LIBCPP_COMPILER_GCC
105-
10645
#if _LIBCPP_STD_VER >= 17
10746
template <class _Tp>
10847
inline constexpr bool is_nothrow_move_constructible_v = is_nothrow_move_constructible<_Tp>::value;

0 commit comments

Comments
 (0)