From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vs1-xe35.google.com (mail-vs1-xe35.google.com [IPv6:2607:f8b0:4864:20::e35]) by sourceware.org (Postfix) with ESMTPS id 5C93F3858C5F for ; Mon, 27 Mar 2023 21:56:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5C93F3858C5F 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-xe35.google.com with SMTP id d2so8779661vso.9 for ; Mon, 27 Mar 2023 14:56:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.washington.edu; s=goo201206; t=1679954167; 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=ZauX8FRfbe2oo0ITEMdRxIDYC1ACr7ns0l+u1+mjdUk=; b=Hr1oB+/RSEzSErS4IAOQCllobYriIh21ibLKuvt36JtsByS2HZdUOCxBrDo7F7R1Zm lcmu+CR8R9K/lPLDzZO8VODH1iWSjY1ms01QHH5sgDRTNoTfBavz9NA9C7lB+ED7YPpq 4Fgd76ZNtT4kVUJ4OnXnjda74jRta4wCGwtko= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679954167; 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=ZauX8FRfbe2oo0ITEMdRxIDYC1ACr7ns0l+u1+mjdUk=; b=fF41Cu5NQkJGLDJYnlSVlTy8JdM4JmS9kve3/WZE631tSGTQJTMX/hEDMZ1aEQ2RPB OI81umqHcqJAWJWkJDMgjUm0j4R+b7IYcPvM7EZSMVIhkYOZGED/+pDpoh/nAGjJ6Rqc dFOSlqDgwqZGXgZLt6QhcJIxyxBbDvKuAm72E94VSIKeOdnetSSZpABBKYNn3TD2xzKo 5PpRSpGh1PRuKB62SXtkmE+uJf+mOLYc8mJiJsu3nRlqRt//fp9iIOq7U9cmv/xXI92s zVB/NGB9RIiuC0PhPjlYZ8NQPnALhPjJSn/QbBOgln4T6HXUb3uIztAXaqoDUrpJga0m /Q6w== X-Gm-Message-State: AAQBX9cUqLieVF3onGH5I1LAGPpWSoKaBJpkTLB/m/cWPAiK6dAXrylW ZSWo0oIQKUNtqQT245mLC2wzhiuB7pxlupNjJvnUJQ== X-Google-Smtp-Source: AKy350Z7vaEdP+cinkJ50Ya6Xiie0/RC6qlB7g2GT+OcqMnIDs2m7tCXrwQi2VeQdC1hi8nMNPOZxkUQG/VfGmK5GZc= X-Received: by 2002:a67:cb82:0:b0:426:40e7:9148 with SMTP id h2-20020a67cb82000000b0042640e79148mr6976389vsl.6.1679954167708; Mon, 27 Mar 2023 14:56:07 -0700 (PDT) MIME-Version: 1.0 References: <7f83711f-5094-6c6d-822b-966293062afc@inria.fr> In-Reply-To: From: Ken Matsui Date: Mon, 27 Mar 2023 14:55:56 -0700 Message-ID: Subject: Re: [GSoC] Conflicted Built-in Trait Name To: Jonathan Wakely 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=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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: Oh! Thank you! On Mon, Mar 27, 2023 at 2:49=E2=80=AFPM Jonathan Wakely wrote: > > On Mon, 27 Mar 2023 at 22:43, Jonathan Wakely wro= te: > > > > 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 o= riginal > > > > >>> 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 ther= e, 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 standar= d and > > > > > is not used elsewhere, can't we? > > > > > > > > You can do anything you like as long as you run the testsuite befor= e > > > > 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= in > > > > helper_functions.h. > > > > > > > > Clearly this usage of std::__is_void could be replaced with your bu= iltin > > > > 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 _ItD= iffType; > > > > > > > > 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= be. > > > > > > > > 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 c= heck 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 _ItDiffT= ype; > > - template - typename =3D typename std::__is_void<_DiffType>::__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;