[libcxx-commits] [libcxx] r359232 - Remove libc++ checks and workarounds for unsupported old versions of GCC (<4.9).

Richard Smith via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 25 13:02:10 PDT 2019


Author: rsmith
Date: Thu Apr 25 13:02:10 2019
New Revision: 359232

URL: http://llvm.org/viewvc/llvm-project?rev=359232&view=rev
Log:
Remove libc++ checks and workarounds for unsupported old versions of GCC (<4.9).

Differential Revision: https://reviews.llvm.org/D61107

Modified:
    libcxx/trunk/include/__config
    libcxx/trunk/include/memory
    libcxx/trunk/include/type_traits

Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=359232&r1=359231&r2=359232&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Thu Apr 25 13:02:10 2019
@@ -519,13 +519,11 @@ typedef __char32_t char32_t;
 
 #define _LIBCPP_NORETURN __attribute__((noreturn))
 
-#if _GNUC_VER >= 407
 #define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
 #define _LIBCPP_IS_LITERAL(T) __is_literal_type(T)
 #define _LIBCPP_HAS_IS_FINAL
-#endif
 
-#if defined(__GNUC__) && _GNUC_VER >= 403
+#if defined(__GNUC__)
 #define _LIBCPP_HAS_IS_BASE_OF
 #endif
 
@@ -533,26 +531,19 @@ typedef __char32_t char32_t;
 #define _LIBCPP_NO_EXCEPTIONS
 #endif
 
-// constexpr was added to GCC in 4.6.
-#if _GNUC_VER < 406
-#  define _LIBCPP_HAS_NO_CONSTEXPR
-// Can only use constexpr in c++11 mode.
-#elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
-#  define _LIBCPP_HAS_NO_CONSTEXPR
-#endif
-
 // Determine if GCC supports relaxed constexpr
 #if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L
 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
 #endif
 
-// GCC 5 will support variable templates
+// GCC 5 supports variable templates
 #if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L
 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
 #endif
 
 #ifndef __GXX_EXPERIMENTAL_CXX0X__
 
+#define _LIBCPP_HAS_NO_CONSTEXPR
 #define _LIBCPP_HAS_NO_DECLTYPE
 #define _LIBCPP_HAS_NO_NULLPTR
 #define _LIBCPP_HAS_NO_UNICODE_CHARS
@@ -561,25 +552,6 @@ typedef __char32_t char32_t;
 #define _LIBCPP_HAS_NO_STRONG_ENUMS
 #define _LIBCPP_HAS_NO_NOEXCEPT
 
-#else  // __GXX_EXPERIMENTAL_CXX0X__
-
-#if _GNUC_VER < 403
-#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#endif
-
-
-#if _GNUC_VER < 404
-#define _LIBCPP_HAS_NO_DECLTYPE
-#define _LIBCPP_HAS_NO_UNICODE_CHARS
-#define _LIBCPP_HAS_NO_VARIADICS
-#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-#endif  // _GNUC_VER < 404
-
-#if _GNUC_VER < 406
-#define _LIBCPP_HAS_NO_NOEXCEPT
-#define _LIBCPP_HAS_NO_NULLPTR
-#endif
-
 #endif  // __GXX_EXPERIMENTAL_CXX0X__
 
 #if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)
@@ -883,7 +855,7 @@ template <unsigned> struct __static_asse
 
 #ifdef _LIBCPP_HAS_NO_DECLTYPE
 // GCC 4.6 provides __decltype in all standard modes.
-#  if __has_keyword(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= 406
+#  if __has_keyword(__decltype) || _LIBCPP_CLANG_VER >= 304 || defined(_LIBCPP_COMPILER_GCC)
 #    define decltype(__x) __decltype(__x)
 #  else
 #    define decltype(__x) __typeof__(__x)
@@ -1219,7 +1191,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanit
 
 #if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic)
 #  define _LIBCPP_HAS_C_ATOMIC_IMP
-#elif _GNUC_VER > 407
+#elif defined(_LIBCPP_COMPILER_GCC)
 #  define _LIBCPP_HAS_GCC_ATOMIC_IMP
 #endif
 

Modified: libcxx/trunk/include/memory
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=359232&r1=359231&r2=359232&view=diff
==============================================================================
--- libcxx/trunk/include/memory (original)
+++ libcxx/trunk/include/memory Thu Apr 25 13:02:10 2019
@@ -683,7 +683,7 @@ inline _LIBCPP_INLINE_VISIBILITY
 _ValueType __libcpp_relaxed_load(_ValueType const* __value) {
 #if !defined(_LIBCPP_HAS_NO_THREADS) && \
     defined(__ATOMIC_RELAXED) &&        \
-    (__has_builtin(__atomic_load_n) || _GNUC_VER >= 407)
+    (__has_builtin(__atomic_load_n) || defined(_LIBCPP_COMPILER_GCC))
     return __atomic_load_n(__value, __ATOMIC_RELAXED);
 #else
     return *__value;
@@ -695,7 +695,7 @@ inline _LIBCPP_INLINE_VISIBILITY
 _ValueType __libcpp_acquire_load(_ValueType const* __value) {
 #if !defined(_LIBCPP_HAS_NO_THREADS) && \
     defined(__ATOMIC_ACQUIRE) &&        \
-    (__has_builtin(__atomic_load_n) || _GNUC_VER >= 407)
+    (__has_builtin(__atomic_load_n) || defined(_LIBCPP_COMPILER_GCC))
     return __atomic_load_n(__value, __ATOMIC_ACQUIRE);
 #else
     return *__value;
@@ -3466,7 +3466,7 @@ uninitialized_move_n(_InputIt __first, _
                        && defined(__ATOMIC_RELAXED)                  \
                        && defined(__ATOMIC_ACQ_REL)
 #   define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT
-#elif !defined(__clang__) && defined(_GNUC_VER) && _GNUC_VER >= 407
+#elif defined(_LIBCPP_COMPILER_GCC)
 #   define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT
 #endif
 

Modified: libcxx/trunk/include/type_traits
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=359232&r1=359231&r2=359232&view=diff
==============================================================================
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Thu Apr 25 13:02:10 2019
@@ -833,7 +833,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR boo
 #endif
 // is_union
 
-#if __has_feature(is_union) || (_GNUC_VER >= 403)
+#if __has_feature(is_union) || defined(_LIBCPP_COMPILER_GCC)
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_union
     : public integral_constant<bool, __is_union(_Tp)> {};
@@ -854,7 +854,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR boo
 
 // is_class
 
-#if __has_feature(is_class) || (_GNUC_VER >= 403)
+#if __has_feature(is_class) || defined(_LIBCPP_COMPILER_GCC)
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_class
     : public integral_constant<bool, __is_class(_Tp)> {};
@@ -976,7 +976,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR boo
 
 // is_enum
 
-#if __has_feature(is_enum) || (_GNUC_VER >= 403)
+#if __has_feature(is_enum) || defined(_LIBCPP_COMPILER_GCC)
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_enum
     : public integral_constant<bool, __is_enum(_Tp)> {};
@@ -1617,7 +1617,7 @@ inline constexpr bool is_nothrow_convert
 
 // is_empty
 
-#if __has_feature(is_empty) || (_GNUC_VER >= 407)
+#if __has_feature(is_empty) || defined(_LIBCPP_COMPILER_GCC)
 
 template <class _Tp>
 struct _LIBCPP_TEMPLATE_VIS is_empty
@@ -1680,7 +1680,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR boo
 
 // has_virtual_destructor
 
-#if __has_feature(has_virtual_destructor) || (_GNUC_VER >= 403)
+#if __has_feature(has_virtual_destructor) || defined(_LIBCPP_COMPILER_GCC)
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor
     : public integral_constant<bool, __has_virtual_destructor(_Tp)> {};
@@ -2498,8 +2498,7 @@ struct __member_pointer_traits_imp<_Rp (
     typedef _Rp (_FnType) (_Param..., ...);
 };
 
-#if __has_feature(cxx_reference_qualified_functions) || \
-    (defined(_GNUC_VER) && _GNUC_VER >= 409)
+#if __has_feature(cxx_reference_qualified_functions) || defined(_LIBCPP_COMPILER_GCC)
 
 template <class _Rp, class _Class, class ..._Param>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false>
@@ -2629,7 +2628,7 @@ struct __member_pointer_traits_imp<_Rp (
     typedef _Rp (_FnType) (_Param..., ...);
 };
 
-#endif  // __has_feature(cxx_reference_qualified_functions) || _GNUC_VER >= 409
+#endif  // __has_feature(cxx_reference_qualified_functions) || defined(_LIBCPP_COMPILER_GCC)
 
 #else  // _LIBCPP_HAS_NO_VARIADICS
 
@@ -3503,7 +3502,7 @@ struct _LIBCPP_TEMPLATE_VIS is_trivially
 
 template <class _Tp>
 struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp>
-#if __has_feature(has_trivial_constructor) || (_GNUC_VER >= 403)
+#if __has_feature(has_trivial_constructor) || defined(_LIBCPP_COMPILER_GCC)
     : integral_constant<bool, __has_trivial_constructor(_Tp)>
 #else
     : integral_constant<bool, is_scalar<_Tp>::value>
@@ -3734,7 +3733,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR boo
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible
     : public integral_constant<bool, __is_trivially_destructible(_Tp)> {};
 
-#elif __has_feature(has_trivial_destructor) || (_GNUC_VER >= 403)
+#elif __has_feature(has_trivial_destructor) || defined(_LIBCPP_COMPILER_GCC)
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible
     : public integral_constant<bool, is_destructible<_Tp>::value && __has_trivial_destructor(_Tp)> {};
@@ -3769,7 +3768,7 @@ template <class _Tp, class... _Args>
 struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible
     : public integral_constant<bool, __is_nothrow_constructible(_Tp, _Args...)> {};
 
-#elif __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L)
+#elif !defined(_LIBCPP_HAS_NO_NOEXCEPT)
 
 template <bool, bool, class _Tp, class... _Args> struct __libcpp_is_nothrow_constructible;
 
@@ -3806,7 +3805,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_c
 {
 };
 
-#else  // __has_keyword(__is_nothrow_constructible) || __has_feature(cxx_noexcept)
+#else  // __has_keyword(__is_nothrow_constructible) || !defined(_LIBCPP_HAS_NO_NOEXCEPT)
 
 template <class _Tp, class... _Args>
 struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible
@@ -3816,7 +3815,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_c
 
 template <class _Tp>
 struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp>
-#if __has_feature(has_nothrow_constructor) || (_GNUC_VER >= 403)
+#if __has_feature(has_nothrow_constructor) || defined(_LIBCPP_COMPILER_GCC)
     : integral_constant<bool, __has_nothrow_constructor(_Tp)>
 #else
     : integral_constant<bool, is_scalar<_Tp>::value>
@@ -3830,7 +3829,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_c
 #else
 struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp>
 #endif
-#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
+#if __has_feature(has_nothrow_copy) || defined(_LIBCPP_COMPILER_GCC)
     : integral_constant<bool, __has_nothrow_copy(_Tp)>
 #else
     : integral_constant<bool, is_scalar<_Tp>::value>
@@ -3840,7 +3839,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_c
 
 template <class _Tp>
 struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, const _Tp&>
-#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
+#if __has_feature(has_nothrow_copy) || defined(_LIBCPP_COMPILER_GCC)
     : integral_constant<bool, __has_nothrow_copy(_Tp)>
 #else
     : integral_constant<bool, is_scalar<_Tp>::value>
@@ -3850,7 +3849,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_c
 
 template <class _Tp>
 struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp&>
-#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
+#if __has_feature(has_nothrow_copy) || defined(_LIBCPP_COMPILER_GCC)
     : integral_constant<bool, __has_nothrow_copy(_Tp)>
 #else
     : integral_constant<bool, is_scalar<_Tp>::value>
@@ -3858,7 +3857,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_c
 {
 };
 
-#endif  // __has_feature(cxx_noexcept)
+#endif  // _LIBCPP_HAS_NO_NOEXCEPT
 
 #else  // _LIBCPP_HAS_NO_VARIADICS
 
@@ -3889,7 +3888,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_c
 template <class _Tp>
 struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, __is_construct::__nat,
                                                        __is_construct::__nat>
-#if __has_feature(has_nothrow_constructor) || (_GNUC_VER >= 403)
+#if __has_feature(has_nothrow_constructor) || defined(_LIBCPP_COMPILER_GCC)
     : integral_constant<bool, __has_nothrow_constructor(_Tp)>
 #else
     : integral_constant<bool, is_scalar<_Tp>::value>
@@ -3900,7 +3899,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_c
 template <class _Tp>
 struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp,
                                                        __is_construct::__nat>
-#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
+#if __has_feature(has_nothrow_copy) || defined(_LIBCPP_COMPILER_GCC)
     : integral_constant<bool, __has_nothrow_copy(_Tp)>
 #else
     : integral_constant<bool, is_scalar<_Tp>::value>
@@ -3911,7 +3910,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_c
 template <class _Tp>
 struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, const _Tp&,
                                                        __is_construct::__nat>
-#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
+#if __has_feature(has_nothrow_copy) || defined(_LIBCPP_COMPILER_GCC)
     : integral_constant<bool, __has_nothrow_copy(_Tp)>
 #else
     : integral_constant<bool, is_scalar<_Tp>::value>
@@ -3922,7 +3921,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_c
 template <class _Tp>
 struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp&,
                                                        __is_construct::__nat>
-#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
+#if __has_feature(has_nothrow_copy) || defined(_LIBCPP_COMPILER_GCC)
     : integral_constant<bool, __has_nothrow_copy(_Tp)>
 #else
     : integral_constant<bool, is_scalar<_Tp>::value>
@@ -3987,7 +3986,7 @@ template <class _Tp, class _Arg>
 struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable
     : public integral_constant<bool, __is_nothrow_assignable(_Tp, _Arg)> {};
 
-#elif __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L)
+#elif !defined(_LIBCPP_HAS_NO_NOEXCEPT)
 
 template <bool, class _Tp, class _Arg> struct __libcpp_is_nothrow_assignable;
 
@@ -4009,7 +4008,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_a
 {
 };
 
-#else  // __has_keyword(__is_nothrow_assignable) || __has_feature(cxx_noexcept)
+#else  // __has_keyword(__is_nothrow_assignable) || !defined(_LIBCPP_HAS_NO_NOEXCEPT)
 
 template <class _Tp, class _Arg>
 struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable
@@ -4017,7 +4016,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_a
 
 template <class _Tp>
 struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable<_Tp&, _Tp>
-#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403)
+#if __has_feature(has_nothrow_assign) || defined(_LIBCPP_COMPILER_GCC)
     : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
 #else
     : integral_constant<bool, is_scalar<_Tp>::value> {};
@@ -4025,7 +4024,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_a
 
 template <class _Tp>
 struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable<_Tp&, _Tp&>
-#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403)
+#if __has_feature(has_nothrow_assign) || defined(_LIBCPP_COMPILER_GCC)
     : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
 #else
     : integral_constant<bool, is_scalar<_Tp>::value> {};
@@ -4033,7 +4032,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_a
 
 template <class _Tp>
 struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable<_Tp&, const _Tp&>
-#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403)
+#if __has_feature(has_nothrow_assign) || defined(_LIBCPP_COMPILER_GCC)
     : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
 #else
     : integral_constant<bool, is_scalar<_Tp>::value> {};
@@ -4043,7 +4042,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_a
 
 template <class _Tp>
 struct is_nothrow_assignable<_Tp&, _Tp&&>
-#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403)
+#if __has_feature(has_nothrow_assign) || defined(_LIBCPP_COMPILER_GCC)
     : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
 #else
     : integral_constant<bool, is_scalar<_Tp>::value> {};
@@ -4051,7 +4050,7 @@ struct is_nothrow_assignable<_Tp&, _Tp&&
 
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 
-#endif  // __has_feature(cxx_noexcept)
+#endif  // _LIBCPP_HAS_NO_NOEXCEPT
 
 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
 template <class _Tp, class _Arg>
@@ -4090,7 +4089,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR boo
 
 // is_nothrow_destructible
 
-#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L)
+#if !defined(_LIBCPP_HAS_NO_NOEXCEPT)
 
 template <bool, class _Tp> struct __libcpp_is_nothrow_destructible;
 
@@ -4157,7 +4156,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR boo
 
 // is_pod
 
-#if __has_feature(is_pod) || (_GNUC_VER >= 403)
+#if __has_feature(is_pod) || defined(_LIBCPP_COMPILER_GCC)
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pod
     : public integral_constant<bool, __is_pod(_Tp)> {};
@@ -4198,7 +4197,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR boo
 // is_standard_layout;
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_standard_layout
-#if __has_feature(is_standard_layout) || (_GNUC_VER >= 407)
+#if __has_feature(is_standard_layout) || defined(_LIBCPP_COMPILER_GCC)
     : public integral_constant<bool, __is_standard_layout(_Tp)>
 #else
     : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value>
@@ -4232,7 +4231,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR boo
 // is_trivial;
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivial
-#if __has_feature(is_trivial) || _GNUC_VER >= 407
+#if __has_feature(is_trivial) || defined(_LIBCPP_COMPILER_GCC)
     : public integral_constant<bool, __is_trivial(_Tp)>
 #else
     : integral_constant<bool, is_trivially_copyable<_Tp>::value &&




More information about the libcxx-commits mailing list