From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vs1-xe31.google.com (mail-vs1-xe31.google.com [IPv6:2607:f8b0:4864:20::e31]) by sourceware.org (Postfix) with ESMTPS id 319013851142 for ; Mon, 20 Mar 2023 22:25:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 319013851142 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-xe31.google.com with SMTP id h15so669852vsh.0 for ; Mon, 20 Mar 2023 15:25:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.washington.edu; s=goo201206; t=1679351107; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=HFlhMDIh9nSvoOHU4Y33zcVijQwaS3auw4nKzsFCTu4=; b=heCeR2MDGAsjB9tg/g2mwXAWx0Ts2e2/QDUr/NFOffLQZ1Thc3ECcfxY4T32yXW0Ni 510M3MypfKHP9iO6tGrA5ZuXmL/8gm+fteQrlP3HMuTs8Ym9E9utLTzjopqWuB/klLZ5 xne+x3ugrTvShl9lM1aYVGbd6tbnPLcj+f7nY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679351107; 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=HFlhMDIh9nSvoOHU4Y33zcVijQwaS3auw4nKzsFCTu4=; b=TN1rD9uE0JaW4/zOAECaKBnLdnSlHxv96axWQOEAc9XZvZMVhcdelxJNGuC+j/kGyZ oNHY2TI/iNxK3GTPeEsetWeYgX/5hrzMwRU0xepkdH364iJQ2dYis9IiCOiETIV6mbnR f6YyNwlpUjN/T2+oNzef8VOR60dhOLZgHHBwU2VhwrJXoIXqoE8tCXZlWJUeeJF189QO VXlQKczIloueT5PObpc8keCghBMC1eUFpsAzK+ucVkJIpVCBf+j+GDiKfVsTThH2nAjw Wz1VCURzTneVy0tv8P9IsT/Cy/btJrNQ2H6Ly+mf72o+2y8myW6ePUMJCShwWVrby8M1 Pzjg== X-Gm-Message-State: AAQBX9doAnPuFuEUQmZh1zOOZdXsulMM6TajZ8BDgv5IkYhH54FU905u bMKHeBtVPp8tSi4ARbAx2/tk1MHYAb4pTpezBr0kvA== X-Google-Smtp-Source: AK7set9FuJ/3MwoHGqOobljqeEbcpHaX7tpmNC/B+Fc9J41I0yerUfQUxp5Mv73jQ/eDaq8hhRTOzkxfCwZU1vcjrOc= X-Received: by 2002:a67:d71e:0:b0:423:e2c4:351e with SMTP id p30-20020a67d71e000000b00423e2c4351emr360716vsj.6.1679351107440; Mon, 20 Mar 2023 15:25:07 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ken Matsui Date: Mon, 20 Mar 2023 15:24:56 -0700 Message-ID: Subject: Re: [PATCH] libstdc++: use new built-in trait __remove_pointer To: Jonathan Wakely Cc: gcc-patches , Patrick Palka , "libstdc++" Content-Type: multipart/alternative; boundary="0000000000003668a505f75c6621" X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP 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: --0000000000003668a505f75c6621 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Please disregard this email. On Mon, Mar 20, 2023 at 6:26=E2=80=AFAM Ken Matsui wrote: > Thank you! > > On Mon, Mar 20, 2023 at 2:12=E2=80=AFAM Jonathan Wakely > wrote: > >> On Mon, 20 Mar 2023 at 08:08, Ken Matsui >> wrote: >> > >> > Ooh... Thank you for pointing that out! >> > >> > > The helper doesn't need to be defined for the case where we don't use >> it. >> > >> > I thought that macroing them out leads to compiler errors since users >> > are possibly using those helpers. But do we not have to care about >> > that? >> >> No, absolutely not. >> >> > >> > --- >> > libstdc++-v3/ChangeLog: >> > >> > * include/std/type_traits (remove_pointer): Use __remove_pointer >> built-in trait. >> > >> > --- >> > diff --git a/libstdc++-v3/include/std/type_traits >> > b/libstdc++-v3/include/std/type_traits >> > index 2bd607a8b8f..cba98091aad 100644 >> > --- a/libstdc++-v3/include/std/type_traits >> > +++ b/libstdc++-v3/include/std/type_traits >> > @@ -2025,17 +2025,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> > >> > template >> > struct __remove_pointer_helper >> > - { typedef _Tp type; }; >> > + { using type =3D _Tp; }; >> > >> > template >> > struct __remove_pointer_helper<_Tp, _Up*> >> > - { typedef _Up type; }; >> > + { using type =3D _Up; }; >> > >> > /// remove_pointer >> > +#if __has_builtin(__remove_pointer) >> > + template >> > + struct remove_pointer >> > + { using type =3D __remove_pointer(_Tp); }; >> > +#else >> > template >> > struct remove_pointer >> > : public __remove_pointer_helper<_Tp, __remove_cv_t<_Tp>> >> > { }; >> > +#endif >> > >> > template >> > struct __add_pointer_helper >> > >> > On Mon, Mar 20, 2023 at 12:57=E2=80=AFAM Jonathan Wakely >> wrote: >> > > >> > > >> > > >> > > On Mon, 20 Mar 2023, 07:32 Ken Matsui via Libstdc++, < >> libstdc++@gcc.gnu.org> wrote: >> > >> >> > >> CCing libstdc++@gcc.gnu.org. >> > >> >> > >> On Sun, Mar 19, 2023 at 7:53=E2=80=AFPM Ken Matsui < >> kmatsui@cs.washington.edu> wrote: >> > >> > >> > >> > libstdc++-v3/ChangeLog: >> > >> > >> > >> > * include/std/type_traits (is_reference): Use __remove_pointer >> built-in trait. >> > > >> > > >> > > The changelog entry says is_reference but the patch is for >> remove_pointer. >> > > >> > > >> > >> > >> > >> > --- >> > >> > diff --git a/libstdc++-v3/include/std/type_traits >> > >> > b/libstdc++-v3/include/std/type_traits >> > >> > index 2bd607a8b8f..cba98091aad 100644 >> > >> > --- a/libstdc++-v3/include/std/type_traits >> > >> > +++ b/libstdc++-v3/include/std/type_traits >> > >> > @@ -2025,17 +2025,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> > >> > >> > >> > template >> > >> > struct __remove_pointer_helper >> > >> > - { typedef _Tp type; }; >> > >> > + { using type =3D _Tp; }; >> > >> > >> > >> > template >> > >> > struct __remove_pointer_helper<_Tp, _Up*> >> > >> > - { typedef _Up type; }; >> > >> > + { using type =3D _Up; }; >> > > >> > > >> > > The helper doesn't need to be defined for the case where we don't use >> it. >> > > >> > > >> > >> > >> > >> > /// remove_pointer >> > >> > +#if __has_builtin(__remove_pointer) >> > >> > + template >> > >> > + struct remove_pointer >> > >> > + { using type =3D __remove_pointer(_Tp); }; >> > >> > +#else >> > >> > template >> > >> > struct remove_pointer >> > >> > : public __remove_pointer_helper<_Tp, __remove_cv_t<_Tp>> >> > >> > { }; >> > >> > +#endif >> > >> > >> > >> > template >> > >> > struct __add_pointer_helper >> > --0000000000003668a505f75c6621--