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.133.124]) by sourceware.org (Postfix) with ESMTPS id 7BDD5385783F for ; Thu, 23 Mar 2023 09:28:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7BDD5385783F 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=1679563718; 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=Vhko4DlK/PsFzvN/2281yfMron2RZAAgvH7eCva3Lbo=; b=eKK41XIO3hXV76A2mUMTWT+ax+QmOBVmT8UytPU0VmvNrPHTxCjR/K5dMKyLlDbn70N6Ct Bb9xddCkgOvFzvvQGqbBim7btOqS5ACdXFQAAXVf7DTYEMYpxRKxV0wF+ubIeaVlc05C9w CPyVx2+Y+mQPoPLaTqPWoMdY3h7qUFo= Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-418-9iSQP10xPf2lNHlZjX2NkQ-1; Thu, 23 Mar 2023 05:28:36 -0400 X-MC-Unique: 9iSQP10xPf2lNHlZjX2NkQ-1 Received: by mail-lj1-f197.google.com with SMTP id k10-20020a2eb74a000000b0029a4ab232c6so5024765ljo.17 for ; Thu, 23 Mar 2023 02:28:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679563715; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Vhko4DlK/PsFzvN/2281yfMron2RZAAgvH7eCva3Lbo=; b=r8Dm/ACVBe/MOrm+a6b/60LgZE6ZMBNfPRKL5r7E1lh8U5mqHqNmWB18HzqcnA3gv7 Sa+hmk1dMSi1iwPlEE+ZFdWeb3Xno9xQNqgedwzz3vdYRT0kd1EIgPELBrEnZT0Lk3Yg 6bcTHL7L4+Nj1aNQVoNGZOlX1TaZplV+LAW0/FQ/YcoFll6sY6DSxHEMQVh1eaCN3YDR 0Rqk5T/qPhttW/yt3FjSnHcS4cAOEpifp1Re9qjdXOglMQSNbVG3x9mM9O/etwwXaVLm a/in6QxK5TDVS3d61ZMIkRdlrRdiZHlgVFffvDrejc6db0HxIEN9SFhGHf0GGcesGt4n +9jA== X-Gm-Message-State: AO0yUKUZ3/sBUqXqnRAAMIRkQgW8ArzhgamKuRkhcW3TvJmCfrK4ygyI 0WYOEzeUfbw8NkUIBVyHBe0l232V0tPSjQ/okKb4ghNy8uyJdeCCbgY2xHAkZhyWEyTRMbmuND9 g1qvBCDgoZTKtAc9/vMqySjV6mDRReZieJA== X-Received: by 2002:a05:651c:108:b0:298:72a8:c6c4 with SMTP id a8-20020a05651c010800b0029872a8c6c4mr2942068ljb.9.1679563715185; Thu, 23 Mar 2023 02:28:35 -0700 (PDT) X-Google-Smtp-Source: AK7set/iUviIMj/UaQcGBdlzj7AoB3esn2tbYV8PhM/wclXNnqqDwd+SIYyhK3fZL1S3eEPj1Z05guLYI3ry0dl8p+w= X-Received: by 2002:a05:651c:108:b0:298:72a8:c6c4 with SMTP id a8-20020a05651c010800b0029872a8c6c4mr2942063ljb.9.1679563714820; Thu, 23 Mar 2023 02:28:34 -0700 (PDT) MIME-Version: 1.0 References: <20230323020458.54515-1-kmatsui@cs.washington.edu> In-Reply-To: <20230323020458.54515-1-kmatsui@cs.washington.edu> From: Jonathan Wakely Date: Thu, 23 Mar 2023 09:28:23 +0000 Message-ID: Subject: Re: [PATCH] libstdc++: use __bool_constant instead of integral_constant To: Ken Matsui Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="000000000000998b2e05f78de6b9" X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,HTML_MESSAGE,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --000000000000998b2e05f78de6b9 Content-Type: text/plain; charset="UTF-8" On Thu, 23 Mar 2023 at 02:06, Ken Matsui via Libstdc++ < libstdc++@gcc.gnu.org> wrote: > In the type_traits header, both integral_constant and __bool_constant > are used. Yes, this is just because we didn't have __bool_constant originally, and nobody has needed to touch the traits that still use integral_constant, so they never got updated. > This patch unifies those usages into __bool_constant. > Thanks, doing this for consistency seems reasonable, and safe to do now instead of waiting until after the GCC 13 release. I'll test and push the patch. Do you have a GCC copyright assignment on file with the FSF? If not, either you need to complete that paperwork, or add a DCO sign-off to all your patches: https://gcc.gnu.org/dco.html > > libstdc++-v3/ChangeLog: > > * include/std/type_traits: Use __bool_constant instead of > integral_constant. > --- > libstdc++-v3/include/std/type_traits | 32 ++++++++++++++-------------- > 1 file changed, 16 insertions(+), 16 deletions(-) > > diff --git a/libstdc++-v3/include/std/type_traits > b/libstdc++-v3/include/std/type_traits > index 2bd607a8b8f..bc6982f9e64 100644 > --- a/libstdc++-v3/include/std/type_traits > +++ b/libstdc++-v3/include/std/type_traits > @@ -578,19 +578,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > /// is_enum > template > struct is_enum > - : public integral_constant > + : public __bool_constant<__is_enum(_Tp)> > { }; > > /// is_union > template > struct is_union > - : public integral_constant > + : public __bool_constant<__is_union(_Tp)> > { }; > > /// is_class > template > struct is_class > - : public integral_constant > + : public __bool_constant<__is_class(_Tp)> > { }; > > /// is_function > @@ -784,7 +784,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > /// is_trivial > template > struct is_trivial > - : public integral_constant > + : public __bool_constant<__is_trivial(_Tp)> > { > > static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), > "template argument must be a complete class or an unbounded > array"); > @@ -793,7 +793,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > /// is_trivially_copyable > template > struct is_trivially_copyable > - : public integral_constant > + : public __bool_constant<__is_trivially_copyable(_Tp)> > { > > static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), > "template argument must be a complete class or an unbounded > array"); > @@ -802,7 +802,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > /// is_standard_layout > template > struct is_standard_layout > - : public integral_constant > + : public __bool_constant<__is_standard_layout(_Tp)> > { > > static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), > "template argument must be a complete class or an unbounded > array"); > @@ -817,7 +817,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > struct > _GLIBCXX20_DEPRECATED_SUGGEST("is_standard_layout && is_trivial") > is_pod > - : public integral_constant > + : public __bool_constant<__is_pod(_Tp)> > { > > static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), > "template argument must be a complete class or an unbounded > array"); > @@ -831,7 +831,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > struct > _GLIBCXX17_DEPRECATED > is_literal_type > - : public integral_constant > + : public __bool_constant<__is_literal_type(_Tp)> > { > > static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), > "template argument must be a complete class or an unbounded > array"); > @@ -840,13 +840,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > /// is_empty > template > struct is_empty > - : public integral_constant > + : public __bool_constant<__is_empty(_Tp)> > { }; > > /// is_polymorphic > template > struct is_polymorphic > - : public integral_constant > + : public __bool_constant<__is_polymorphic(_Tp)> > { }; > > #if __cplusplus >= 201402L > @@ -855,14 +855,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > /// @since C++14 > template > struct is_final > - : public integral_constant > + : public __bool_constant<__is_final(_Tp)> > { }; > #endif > > /// is_abstract > template > struct is_abstract > - : public integral_constant > + : public __bool_constant<__is_abstract(_Tp)> > { }; > > /// @cond undocumented > @@ -873,7 +873,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > > template > struct __is_signed_helper<_Tp, true> > - : public integral_constant > + : public __bool_constant<_Tp(-1) < _Tp(0)> > { }; > /// @endcond > > @@ -1333,7 +1333,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > /// has_virtual_destructor > template > struct has_virtual_destructor > - : public integral_constant > + : public __bool_constant<__has_virtual_destructor(_Tp)> > { > > static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), > "template argument must be a complete class or an unbounded > array"); > @@ -1392,7 +1392,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > template > struct is_same > #ifdef _GLIBCXX_HAVE_BUILTIN_IS_SAME > - : public integral_constant > + : public __bool_constant<__is_same(_Tp, _Up)> > #else > : public false_type > #endif > @@ -1408,7 +1408,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > /// is_base_of > template > struct is_base_of > - : public integral_constant > + : public __bool_constant<__is_base_of(_Base, _Derived)> > { }; > > #if __has_builtin(__is_convertible) > -- > 2.40.0 > > --000000000000998b2e05f78de6b9--