From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by sourceware.org (Postfix) with ESMTPS id 2027C3858C54; Mon, 27 Mar 2023 21:43:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2027C3858C54 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-x532.google.com with SMTP id i5so42137706eda.0; Mon, 27 Mar 2023 14:43:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679953421; 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=KJVKUlyhHqFkhBDDBP2Uq4ii1MWyeR5J2bYn1t6OAoU=; b=deodwwuPUUOjrloYge43iX0ZJvTL+v8XCCVqAtmMFMzs6SYAGsUzCQGqH87ZygURY0 5PwN1JouJeePdhNoZJd97+X6Hrg1XHdzaDF5588jUKmbLoAR4kE7KY6QTAREAl6wwI/O WmedJjFQ6jt5yoRAc/ArorveGjFqYFHpTaOjMHqNyIJmhhBZ7HxHDOqyUPfOgo6u7YAd mQIsOcADJQlGFdyLxuob9RND4fH/uZRWFH1TzK/LOqOqJqZV8lk0rO14Vzj7AkG2P4Gm iN+HcbTgf7S8t/PoMEM+5lke4G0KZeVvjGzsxFktBdYZppjo77SYz+ZSdSjRT1u9RwIF C9cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679953421; 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=KJVKUlyhHqFkhBDDBP2Uq4ii1MWyeR5J2bYn1t6OAoU=; b=oEdcwHGkD1hwTnU1Pj6i4LKztYJnxe+5HM3K29ktMnPDuiAZlLHuRpbRA7jXUqceoM Mqrs6Rv9zPLYPhYGq2lHRkEZNA7sRUGYK5E1YfHlMnIYKz//clrwLaydDGS74oYwSVbU uYGi8SruzkdyA1OFiDA9Oi4fJhAt5MdMg1GDF0Jlb2px5H8XXIJmnv16ec85yUcXLp+S E8BwPzVK0Ty+kK5r3kyxCKDehQ/AoyKvTAXntrC08CI/wNKfnafTRs0ev+D4UZoFmnJ0 zj1TcNzTlAe8RE0LD5KCKGpMri4zsQLotWWDms5yDcDi/5oe6u5UsVK/u9dnQoRdLRFG 1IOA== X-Gm-Message-State: AAQBX9feOnhdc26HlV+/bj0GfS2TJK9F3UZXhbeeFIEdcEKk9TltiF5V 0QLRT3anSBj8yhaN4VeKEaz81uqyfi7c9X4oLqw= X-Google-Smtp-Source: AKy350ZGHeQ3NiblwIhmN9We3RBBxO+VxDYA+JtV2AmSfqZdCIAZLqfqI8gPtrcI2dBrWDk6tF9GSrgH4ESnNzuhak4= X-Received: by 2002:a17:907:1c09:b0:92f:b329:cb75 with SMTP id nc9-20020a1709071c0900b0092fb329cb75mr8264065ejc.5.1679953420725; Mon, 27 Mar 2023 14:43:40 -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:43:29 +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 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 origi= nal > > >>> 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, i= t > > >> 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 __i= s_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 an= d > > > 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 in > > helper_functions.h. > > > > Clearly this usage of std::__is_void could be replaced with your builti= n > > 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 _ItDiffT= ype; > > > > 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 check= if > std::is_void in the type_traits header was correctly used.