From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vs1-xe29.google.com (mail-vs1-xe29.google.com [IPv6:2607:f8b0:4864:20::e29]) by sourceware.org (Postfix) with ESMTPS id 8AE773858C5E for ; Mon, 20 Mar 2023 13:26:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8AE773858C5E 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-xe29.google.com with SMTP id c1so7707494vsk.2 for ; Mon, 20 Mar 2023 06:26:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.washington.edu; s=goo201206; t=1679318812; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=VU9UpVb1xoUnbv3o0l/ymOWEYT3nV4dgkBMn2DG6Ls8=; b=B7SaiyBe+uOzEOCvCfh0mWLb4Oy9B0AxuHDc0mNihaDbO1V8SkoFySAXqtdS1euFpZ On3mJ0Fz7SZOw6k2TE4ce/z8/OWa1+141G1bONCs9JhBr6yRe9a+CGhyUHLIrakAIKgg jm/HWo4r8PDEkhAZtPnBcJcEIBaEkeh+dUoy4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679318812; 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=VU9UpVb1xoUnbv3o0l/ymOWEYT3nV4dgkBMn2DG6Ls8=; b=Rt4J0mvNgRTSEiisDYsdWnsNAvzwo5vpU8An1Z8PtuqVAAtoOs6NogMuVKzFw2sVNY ue8gryi32053mXeBekf7FlWzC5EmzHYAGlNQRi4nLLjytR2TCh5VdxLe79L6VE3iURcn NcSVgD4XLzu2B8lhCXpHLd5M/G2+sjQYdJy8hcWNiWqQuilKYgwGUMtQb5ezS9au6Xlv r9NGQpZ0H3o6/KYEGKMM0t0uFKwUOGHhYiNr8OPyhkOAsezXeHpn9IW6bBmkEjDoEdnc UExM5O/EYanyJoTTml0xbnN0Z4c9hAmKVirCPj5xS0MFQvOLFG/QLcD9EGOEG9aGf+tZ hDBQ== X-Gm-Message-State: AO0yUKUVmjxUOhIErWENcvY5ma/g30gLJ6hbNBCK1IPf4q+xaBj0PPpN Iv86AfZfEGwUhsJLn8Awd5wlkoPziTY4q6u/VYdUhQ== X-Google-Smtp-Source: AK7set+p06yRU2Wjja3YETz2HVFcBscS4Bcz1vAF4t2FWlOgRGGsc7QmPQ77ds1EBpV/vxJtzW8JP3rDCpLwGBdHJHc= X-Received: by 2002:a67:d217:0:b0:425:de7e:3dce with SMTP id y23-20020a67d217000000b00425de7e3dcemr4060380vsi.6.1679318812075; Mon, 20 Mar 2023 06:26:52 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ken Matsui Date: Mon, 20 Mar 2023 06:26:41 -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="000000000000423b6805f754e1be" X-Spam-Status: No, score=-10.2 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=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: --000000000000423b6805f754e1be Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 > 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 > --000000000000423b6805f754e1be--