From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by sourceware.org (Postfix) with ESMTPS id 467573858C54; Mon, 27 Mar 2023 21:49:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 467573858C54 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-x52f.google.com with SMTP id eh3so41892132edb.11; Mon, 27 Mar 2023 14:49:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679953754; 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=C1kemRqUAbFfTTNtOt1aNPICmm2E+FzSynJqJxeGoVY=; b=VIjJe2BVMTRKg3gQWjPs2viwS4g6lTeslP1VTHKJdwOSIFQtVsiVQ1qq/QpnGxpdyy n5i7o4EbU5SbqWUAVVzQ327q5rAkYF4C8i17D9wlik1k1BmCZxijhEYuBdFNpQMjER66 sJyS71AAvNBY2OGaU80kcQ+0lpjzP8z0prCpmLFWP+M9kxmAZyqFMrcGTfLDjrwDf/GZ z8k4pkd2oF3EgKJP75taVod2/KMO2XVzxnoy6joT4aVIoc1CLXcJQE7631Ii/5RcbbDx CNc6k8VA7RFd9dEsDJGJBixE3doxLKotXqIpkt923EZntfhy+YOIGqiVrWurgj3fDZzy pU3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679953754; 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=C1kemRqUAbFfTTNtOt1aNPICmm2E+FzSynJqJxeGoVY=; b=F3VEEJTSnIlWIU3IyDqlR+m1dDem1e5a+/u2ZiGbYQSbbF5cwHLZjSynNFl7JHIume 2ae6g8p92uZ9KMdaY5sEOH5y83toWlzP1x2MjxWhTVgBuLEZ5MnzgKUs5BfsOzA3O198 LnLZ1eIi1O/sUOltd4a8X9DzykDb2SnTPcpD+YkdGd8vwrcQBw4fo1S26dpzt5b163w2 KCHgXGFVG8NSKn1FEiMVEo0PQl1AyYWxhQx3SiTUhyVzLAfjoBnMDN4npK0IC6xmDSOu bEcFqFZG2Ws1Sha1icnJLWRXAeiSFyRyz220L2/p5mv+dAhlP/eHxBLrDHRjkAucGyGO +x1A== X-Gm-Message-State: AAQBX9eHpAlUHweTxueti+3TY19D3UQ3ktklkcG1Qdi1omksoS+HnlKz uFGywLIpR8rpEpyu9a7YQhZQnS1ae0AGzR0Xt6Q= X-Google-Smtp-Source: AKy350bZT6RUXp0Mlr0KilOndtoEW9EhPfiQWznG9Mo82153bGM5cnph9zCxf0zgEDhJmYhc4UJiXAVKE6fEVLs9HxI= X-Received: by 2002:a17:907:1c09:b0:92f:b329:cb75 with SMTP id nc9-20020a1709071c0900b0092fb329cb75mr8273255ejc.5.1679953753863; Mon, 27 Mar 2023 14:49:13 -0700 (PDT) MIME-Version: 1.0 References: <7f83711f-5094-6c6d-822b-966293062afc@inria.fr> In-Reply-To: From: Jonathan Wakely Date: Mon, 27 Mar 2023 22:49:03 +0100 Message-ID: Subject: Re: [GSoC] Conflicted Built-in Trait Name To: Ken Matsui Cc: =?UTF-8?Q?Fran=C3=A7ois_Dumont?= , gcc@gcc.gnu.org, libstdc++@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,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: On Mon, 27 Mar 2023 at 22:43, Jonathan Wakely wrote= : > > On Mon, 27 Mar 2023 at 21:17, Ken Matsui via Libstdc++ > wrote: > > > > On Mon, Mar 27, 2023 at 10:33 AM Fran=C3=A7ois Dumont wrote: > > > > > > > > > On 26/03/2023 04:01, Ken Matsui via Libstdc++ wrote: > > > > On Sat, Mar 25, 2023 at 5:38=E2=80=AFAM Marc Glisse wrote: > > > >> On Sat, 25 Mar 2023, Ken Matsui via Gcc wrote: > > > >> > > > >>> Built-in trait naming simply adds two underscores (__) to the ori= ginal > > > >>> trait name. However, the same names are already in use for some > > > >>> built-in traits, such as is_void, is_pointer, and is_signed. > > > >>> > > > >>> For example, __is_void is used in the following files: > > > >>> > > > >>> * gcc/testsuite/g++.dg/tm/pr46567.C > > > >> This is a testcase, you can rename __is_void to whatever in there,= it > > > >> doesn't matter. > > > >> > > > >>> * libstdc++-v3/include/bits/cpp_type_traits.h > > > >> This __is_void seems to be used in a single place in > > > >> include/debug/helper_functions.h, couldn't we tweak that code so _= _is_void > > > >> becomes unused and can be removed? > > > > That worked. Thank you! > > > What worked ? > > > > If you meant about the code, I sent a patch series, as you can see in > > the following link. > > > > https://gcc.gnu.org/pipermail/gcc-patches/2023-March/614620.html > > > > * In the following patch, I replaced __is_void with std::is_void in > > helper_functions.h. > > You can't do that. std::is_void is not present in C++98 mode, but the > code in needs to work for C++98 mode. > > > https://gcc.gnu.org/pipermail/gcc-patches/2023-March/614624.html > > * And then, I deleted __is_void in cpp_type_traits.h. > > https://gcc.gnu.org/pipermail/gcc-patches/2023-March/614623.html > > * Also, I replaced __is_void with ____is_void in the testcase. > > https://gcc.gnu.org/pipermail/gcc-patches/2023-March/614625.html > > > > If you meant what tests had been done, I did the following tests > > because the header is under libstdc++. > > > > * make check-gcc-c++ (because the patches involve changes on GCC) > > * make check-target-libstdc++-v3 > > > > > > So, we can remove a code in a header as long as it is not standard = and > > > > is not used elsewhere, can't we? > > > > > > You can do anything you like as long as you run the testsuite before > > > presenting your patch. Here note that you'll need to run: > > > > > > make check-debug > > > > > > to run tests in _GLIBCXX_DEBUG mode which is making use of the code i= n > > > helper_functions.h. > > > > > > Clearly this usage of std::__is_void could be replaced with your buil= tin > > > by reimplementing _Distance_traits like this: > > > > > > template > > typename =3D typename std::__is_integer<_Iterator>::__type> > > > struct _Distance_traits > > > { > > > private: > > > typedef > > > typename std::iterator_traits<_Iterator>::difference_type _ItDif= fType; > > > > > > typedef > > > typename std::conditional<__is_void<_ItDiffType>, > > > std::ptrdiff_t, _ItDiffType>::type _DiffType; > > > > > > public: > > > typedef std::pair<_DiffType, _Distance_precision> __type; > > > }; > > > > > > this is untested, just to give you an idea of what your patch could b= e. > > > > > > Fran=C3=A7ois > > > > Thank you! I thought the tests that I did included the > > hepler_function.h header, but they don=E2=80=99t...? If not, I must che= ck if > > std::is_void in the type_traits header was correctly used. Something like this would work: --- a/libstdc++-v3/include/debug/helper_functions.h +++ b/libstdc++-v3/include/debug/helper_functions.h @@ -66,13 +66,12 @@ namespace __gnu_debug typedef typename std::iterator_traits<_Iterator>::difference_type _ItDiffTyp= e; - template::__type> + template struct _DiffTraits { typedef _DiffType __type; }; template - struct _DiffTraits<_DiffType, std::__true_type> + struct _DiffTraits<_DiffType, const void> { typedef std::ptrdiff_t __type; }; typedef typename _DiffTraits<_ItDiffType>::__type _DiffType;