From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vs1-xe2f.google.com (mail-vs1-xe2f.google.com [IPv6:2607:f8b0:4864:20::e2f]) by sourceware.org (Postfix) with ESMTPS id 22EE8385840F for ; Thu, 23 Mar 2023 10:17:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 22EE8385840F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=cs.washington.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cs.washington.edu Received: by mail-vs1-xe2f.google.com with SMTP id h15so7258143vsh.0 for ; Thu, 23 Mar 2023 03:17:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.washington.edu; s=goo201206; t=1679566658; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Hb6K4z+guY5WvlP1GiUsPGmNJmg6183wuJJHUkvpz68=; b=YqirA7p8TotyEX26ZzkEVtaD0+RzSiq7zD7SMvyIeO5lYI/kxcIaocCTaTU41ztvQr QsztLfLG9rS9efJCv+wJUyYIVLJ6e/IV15a6jinGTL80OsR8J1Jrs4EOo4Y1HRlnIsBv M0VMMuRvow44OVQxmoHA5uQf6PqbSR0egTuKY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679566658; h=content-transfer-encoding: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=Hb6K4z+guY5WvlP1GiUsPGmNJmg6183wuJJHUkvpz68=; b=qAjC6SfU8D7Hnv1oHpzc5x+/Z3OPvFHlengzwl9Z43qQi+msE9nvGlvD3aar9pTUkV 4Boz7gZzmgogGizK3dz3+qYaD7LddraIVIWUtHoLhmbcMNXBXnSoPTjLqGZroj85wkQL buRH0c6l59BE1vzVcygx1o0mF555gZFgu27OLBvdiZXliOyhzCvl9VyLxEUqvWaR8OjH EtHKcS3GdjKQwjDtyYgE4nWDwEYWcWX0sBSs6x0McBEMZOkuQRNqA8CQ55vnGqGox2lN 2BAwHTWcCRkWPrKZYoRjran6CzfgMbJuQe2P8bBZqoS6Wqw4zG/Nckvn7E1Xb3md8YIs U75w== X-Gm-Message-State: AO0yUKWnV4TZvPfBZaJ+J9ytobxwCJMddHwk7d9g1xqAtl//Pu23EBoi caUimnaP61n/kx1CVpfxxKhyskmK5neYjBIwG5JFFw== X-Google-Smtp-Source: AK7set8gqoxZMFDAydEjTqMRRiSvrod7pRsZ1qCDwyMkjsgdPe56EKxVAloJC/GPesIicqCp6RJlN1JXKGV3HRPE5pc= X-Received: by 2002:a67:c899:0:b0:423:e2c4:351e with SMTP id v25-20020a67c899000000b00423e2c4351emr1490323vsk.6.1679566658366; Thu, 23 Mar 2023 03:17:38 -0700 (PDT) MIME-Version: 1.0 References: <20230323020458.54515-1-kmatsui@cs.washington.edu> In-Reply-To: From: Ken Matsui Date: Thu, 23 Mar 2023 03:17:27 -0700 Message-ID: Subject: Re: [PATCH] libstdc++: use __bool_constant instead of integral_constant To: Jonathan Wakely Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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: Thank you so much for your review! This is my first time contributing to GCC, so I do not have a GCC copyright assignment. I googled those two ways, but I am still confused... Is it correct that the DCO sign-off has been getting more common recently? If so, I will put the sign-off into all my patches. I would prefer to choose the more common and lightweight way. Sincerely, Ken Matsui On Thu, Mar 23, 2023 at 2:28=E2=80=AFAM Jonathan Wakely wrote: > > > > On Thu, 23 Mar 2023 at 02:06, Ken Matsui via Libstdc++ wrote: >> >> In the type_traits header, both integral_constant and __bool_const= ant >> 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 i= nstead of waiting until after the GCC 13 release. I'll test and push the pa= tch. > > 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 arra= y"); >> @@ -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 arra= y"); >> @@ -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 arra= y"); >> @@ -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 arra= y"); >> @@ -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 arra= y"); >> @@ -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 >=3D 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 arra= y"); >> @@ -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 >>