From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 8912E3836C38; Wed, 16 Dec 2020 19:25:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8912E3836C38 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r11-6155] libstdc++: Simplify built-in detection in X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: 767537a8b027bcb5807bb45b0268c5da98c2c7a0 X-Git-Newrev: 4d4f82959aa0802611f1183389c4c74d22431e49 Message-Id: <20201216192552.8912E3836C38@sourceware.org> Date: Wed, 16 Dec 2020 19:25:52 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Dec 2020 19:25:52 -0000 https://gcc.gnu.org/g:4d4f82959aa0802611f1183389c4c74d22431e49 commit r11-6155-g4d4f82959aa0802611f1183389c4c74d22431e49 Author: Jonathan Wakely Date: Wed Dec 16 17:18:10 2020 +0000 libstdc++: Simplify built-in detection in 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. Diff: --- libstdc++-v3/include/std/utility | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility index 4a9ad604cbc..61573f42f3f 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 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 struct _Build_index_tuple { -#if _GLIBCXX_USE_MAKE_INTEGER_SEQ +#if __has_builtin(__make_integer_seq) template 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 using make_integer_sequence -#if _GLIBCXX_USE_MAKE_INTEGER_SEQ +#if __has_builtin(__make_integer_seq) = __make_integer_seq; #else = integer_sequence<_Tp, __integer_pack(_Num)...>; #endif -#undef _GLIBCXX_USE_MAKE_INTEGER_SEQ - /// Alias template index_sequence template using index_sequence = integer_sequence;