From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 7AE9D3858C5E for ; Tue, 1 Aug 2023 17:24:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7AE9D3858C5E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690910662; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=fo6CBTPCopAr9IwKjp0LJ/lzxBs/V0YFF6CYPjl3oXM=; b=gI90HG827yAfSmS+s8WBZh1Ju6Ug1tntqng9u+0Hotts4TaX/IhLAvDpOKA1OLuzQNk0ki LDmt3I6EGUvbSjuf64oYMmu9sBw28s5+kTUS1h8afXfPfeAJX7J2UPoS22dYS+0Mbt0Y1+ mT5FW7ymQsq2YNHDUAV5sjrV8cIMAMo= Received: from mail-oo1-f71.google.com (mail-oo1-f71.google.com [209.85.161.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-93-MjiP9JyjONG5d475gVtouw-1; Tue, 01 Aug 2023 13:24:20 -0400 X-MC-Unique: MjiP9JyjONG5d475gVtouw-1 Received: by mail-oo1-f71.google.com with SMTP id 006d021491bc7-560c7abdbdcso9222735eaf.0 for ; Tue, 01 Aug 2023 10:24:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690910660; x=1691515460; h=mime-version:references:message-id:in-reply-to:subject:cc:to:date :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=fo6CBTPCopAr9IwKjp0LJ/lzxBs/V0YFF6CYPjl3oXM=; b=WoqYWwHLVAUQnoDqiP3DCWDlMSwPq5fE8tI/jhqHwlDs/uo0urqSLn2IGYdfcTw6sM 8rQDf0syAA3CgJUjEEVptIvNs/P35Hlh6qfqMs/Pqs3gIb5qIMNly//8tqcHDzZVUQKz Kp3LVw8qHrM2r0xFwju2mxSV/gr+eYX+qBYALHOUBo9PDznSd4ZHL6MxA//9kmLJyELa n8clanfqjsWjkHlcEbWsUR4K4FNoDR1OxON7ClOt/ZMvnltGRjpU8Xp1vtouQpsx/Ipy nSPvrTavzfdm6Rg9xeEyzw/J1XWg7fq+PhOkSLlzbwYev6qyAHoLdHv9lIfXhhkS+AaC /0/g== X-Gm-Message-State: ABy/qLZe7Gog9rQkESQpa4jqSL1s++56bG1CcR8lXlX/XYlqgdoIM+BX FvwRF64Xdo8/ujfI7/hkl/LwnEec8PFTTRpsbX1BEggihnBR4cjeLAerjAyPjIKTMRSq9mqLIW6 BSBX/qdWk2n2qX3M= X-Received: by 2002:a05:6358:7e9a:b0:12f:22c1:66aa with SMTP id o26-20020a0563587e9a00b0012f22c166aamr3486334rwn.3.1690910659798; Tue, 01 Aug 2023 10:24:19 -0700 (PDT) X-Google-Smtp-Source: APBJJlFe0g8+MXxJr3EGT1giefYNCMtTinKW2sE2b1cqRXs1BPxg3HIIvjI1f2GomwLWdjqLmKT6gA== X-Received: by 2002:a05:6358:7e9a:b0:12f:22c1:66aa with SMTP id o26-20020a0563587e9a00b0012f22c166aamr3486316rwn.3.1690910659334; Tue, 01 Aug 2023 10:24:19 -0700 (PDT) Received: from [192.168.1.130] (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id w18-20020ae9e512000000b0075cd80fde9esm4261638qkf.89.2023.08.01.10.24.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 10:24:19 -0700 (PDT) From: Patrick Palka X-Google-Original-From: Patrick Palka Date: Tue, 1 Aug 2023 13:24:18 -0400 (EDT) To: Ken Matsui cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org Subject: Re: [PATCH v3 2/2] libstdc++: Use _GLIBCXX_HAS_BUILTIN_TRAIT In-Reply-To: <20230728035737.50181-2-kmatsui@gcc.gnu.org> Message-ID: References: <20230719193242.59472-1-kmatsui@gcc.gnu.org> <20230728035737.50181-1-kmatsui@gcc.gnu.org> <20230728035737.50181-2-kmatsui@gcc.gnu.org> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-14.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, 27 Jul 2023, Ken Matsui via Gcc-patches wrote: > This patch uses _GLIBCXX_HAS_BUILTIN_TRAIT macro instead of > __has_builtin in the type_traits header. This macro supports to toggle > the use of built-in traits in the type_traits header through > _GLIBCXX_NO_BUILTIN_TRAITS macro, without needing to modify the > source code. > > libstdc++-v3/ChangeLog: > > * include/std/type_traits (__has_builtin): Replace with ... > (_GLIBCXX_HAS_BUILTIN): ... this. > > Signed-off-by: Ken Matsui > --- > libstdc++-v3/include/std/type_traits | 26 +++++++++++++------------- > 1 file changed, 13 insertions(+), 13 deletions(-) > > diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits > index 9f086992ebc..12423361b6e 100644 > --- a/libstdc++-v3/include/std/type_traits > +++ b/libstdc++-v3/include/std/type_traits > @@ -1411,7 +1411,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > : public __bool_constant<__is_base_of(_Base, _Derived)> > { }; > > -#if __has_builtin(__is_convertible) > +#if _GLIBCXX_HAS_BUILTIN_TRAIT(__is_convertible) > template > struct is_convertible > : public __bool_constant<__is_convertible(_From, _To)> > @@ -1462,7 +1462,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > #if __cplusplus >= 202002L > #define __cpp_lib_is_nothrow_convertible 201806L > > -#if __has_builtin(__is_nothrow_convertible) > +#if _GLIBCXX_HAS_BUILTIN_TRAIT(__is_nothrow_convertible) > /// is_nothrow_convertible_v > template > inline constexpr bool is_nothrow_convertible_v > @@ -1537,7 +1537,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > { using type = _Tp; }; > > /// remove_cv > -#if __has_builtin(__remove_cv) > +#if _GLIBCXX_HAS_BUILTIN_TRAIT(__remove_cv) > template > struct remove_cv > { using type = __remove_cv(_Tp); }; > @@ -1606,7 +1606,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > // Reference transformations. > > /// remove_reference > -#if __has_builtin(__remove_reference) > +#if _GLIBCXX_HAS_BUILTIN_TRAIT(__remove_reference) > template > struct remove_reference > { using type = __remove_reference(_Tp); }; > @@ -2963,7 +2963,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > template bool _Nothrow = noexcept(_S_conv<_Tp>(_S_get())), > typename = decltype(_S_conv<_Tp>(_S_get())), > -#if __has_builtin(__reference_converts_from_temporary) > +#if _GLIBCXX_HAS_BUILTIN_TRAIT(__reference_converts_from_temporary) > bool _Dangle = __reference_converts_from_temporary(_Tp, _Res_t) > #else > bool _Dangle = false > @@ -3420,7 +3420,7 @@ template > */ > #define __cpp_lib_remove_cvref 201711L > > -#if __has_builtin(__remove_cvref) > +#if _GLIBCXX_HAS_BUILTIN_TRAIT(__remove_cvref) > template > struct remove_cvref > { using type = __remove_cvref(_Tp); }; > @@ -3515,7 +3515,7 @@ template > : public bool_constant> > { }; > > -#if __has_builtin(__is_layout_compatible) > +#if _GLIBCXX_HAS_BUILTIN_TRAIT(__is_layout_compatible) Hmm, I was thinking we'd use this macro only for traits that have a fallback non-built-in implementation so that we could easily use/test their fallback implementation. For traits that don't have such a fallback, using this macro would mean that trait would no longer get defined at all, which doesn't seem as useful. Perhaps let's initially adjust only the traits that have a fallback implementation? We could then verify that using the fallback implementation for all such traits works as expected by running the testsuite with: make check RUNTESTFLAGS="conformance.exp --target_board=unix/-D_GLIBCXX_NO_BUILTIN_TRAITS" > > /// @since C++20 > template > @@ -3529,7 +3529,7 @@ template > constexpr bool is_layout_compatible_v > = __is_layout_compatible(_Tp, _Up); > > -#if __has_builtin(__builtin_is_corresponding_member) > +#if _GLIBCXX_HAS_BUILTIN_TRAIT(__builtin_is_corresponding_member) > #define __cpp_lib_is_layout_compatible 201907L > > /// @since C++20 > @@ -3540,7 +3540,7 @@ template > #endif > #endif > > -#if __has_builtin(__is_pointer_interconvertible_base_of) > +#if _GLIBCXX_HAS_BUILTIN_TRAIT(__is_pointer_interconvertible_base_of) > /// True if `_Derived` is standard-layout and has a base class of type `_Base` > /// @since C++20 > template > @@ -3554,7 +3554,7 @@ template > constexpr bool is_pointer_interconvertible_base_of_v > = __is_pointer_interconvertible_base_of(_Base, _Derived); > > -#if __has_builtin(__builtin_is_pointer_interconvertible_with_class) > +#if _GLIBCXX_HAS_BUILTIN_TRAIT(__builtin_is_pointer_interconvertible_with_class) > #define __cpp_lib_is_pointer_interconvertible 201907L > > /// True if `__mp` points to the first member of a standard-layout type > @@ -3590,8 +3590,8 @@ template > template > inline constexpr bool is_scoped_enum_v = is_scoped_enum<_Tp>::value; > > -#if __has_builtin(__reference_constructs_from_temporary) \ > - && __has_builtin(__reference_converts_from_temporary) > +#if _GLIBCXX_HAS_BUILTIN_TRAIT(__reference_constructs_from_temporary) \ > + && _GLIBCXX_HAS_BUILTIN_TRAIT(__reference_converts_from_temporary) > > #define __cpp_lib_reference_from_temporary 202202L > > @@ -3632,7 +3632,7 @@ template > template > inline constexpr bool reference_converts_from_temporary_v > = reference_converts_from_temporary<_Tp, _Up>::value; > -#endif // __has_builtin for reference_from_temporary > +#endif // _GLIBCXX_HAS_BUILTIN_TRAIT for reference_from_temporary > #endif // C++23 > > #if _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED > -- > 2.41.0 > >