aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2020-12-16 17:18:10 +0000
committerJonathan Wakely <jwakely@redhat.com>2020-12-16 19:25:09 +0000
commit4d4f82959aa0802611f1183389c4c74d22431e49 (patch)
treeb9e3b2ff64247297e6785b321bddf52be5a41c63 /libstdc++-v3
parent767537a8b027bcb5807bb45b0268c5da98c2c7a0 (diff)
downloadgcc-4d4f82959aa0802611f1183389c4c74d22431e49.zip
gcc-4d4f82959aa0802611f1183389c4c74d22431e49.tar.gz
gcc-4d4f82959aa0802611f1183389c4c74d22431e49.tar.bz2
libstdc++: Simplify built-in detection in <utility>
Now that GCC supports __has_builtin there is no need to test whether it's defined, we can just use it unconditionally. libstdc++-v3/ChangeLog: * include/std/utility: Use __has_builtin without checking if it's defined.
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/include/std/utility16
1 files changed, 5 insertions, 11 deletions
diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility
index 4a9ad60..61573f4 100644
--- a/libstdc++-v3/include/std/utility
+++ b/libstdc++-v3/include/std/utility
@@ -297,27 +297,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// extract the elements in a tuple.
template<size_t... _Indexes> struct _Index_tuple { };
-#ifdef __has_builtin
-# if __has_builtin(__make_integer_seq)
-# define _GLIBCXX_USE_MAKE_INTEGER_SEQ 1
-# endif
-#endif
-
// Builds an _Index_tuple<0, 1, 2, ..., _Num-1>.
template<size_t _Num>
struct _Build_index_tuple
{
-#if _GLIBCXX_USE_MAKE_INTEGER_SEQ
+#if __has_builtin(__make_integer_seq)
template<typename, size_t... _Indices>
using _IdxTuple = _Index_tuple<_Indices...>;
+ // Clang defines __make_integer_seq for this purpose.
using __type = __make_integer_seq<_IdxTuple, size_t, _Num>;
#else
+ // For GCC and other compilers, use __integer_pack instead.
using __type = _Index_tuple<__integer_pack(_Num)...>;
#endif
};
-#if __cplusplus > 201103L
+#if __cplusplus >= 201402L
#define __cpp_lib_integer_sequence 201304
@@ -332,14 +328,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// Alias template make_integer_sequence
template<typename _Tp, _Tp _Num>
using make_integer_sequence
-#if _GLIBCXX_USE_MAKE_INTEGER_SEQ
+#if __has_builtin(__make_integer_seq)
= __make_integer_seq<integer_sequence, _Tp, _Num>;
#else
= integer_sequence<_Tp, __integer_pack(_Num)...>;
#endif
-#undef _GLIBCXX_USE_MAKE_INTEGER_SEQ
-
/// Alias template index_sequence
template<size_t... _Idx>
using index_sequence = integer_sequence<size_t, _Idx...>;