From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-x932.google.com (mail-ua1-x932.google.com [IPv6:2607:f8b0:4864:20::932]) by sourceware.org (Postfix) with ESMTPS id E35293858C5E for ; Mon, 11 Sep 2023 14:59:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E35293858C5E 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-ua1-x932.google.com with SMTP id a1e0cc1a2514c-7a52a1e2a59so1818344241.0 for ; Mon, 11 Sep 2023 07:59:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.washington.edu; s=goo201206; t=1694444350; x=1695049150; darn=gcc.gnu.org; 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=P6fjZvi77/SAC3KTTBdU8W4eyw5oqGUrEP0pw0pgFc8=; b=fXhc7+VAzYWYanNJaDPwSjY8Zhv0iJbE3zuqQWGXYeheAp4bgjY5tRQeL7dJzBDnJt fL6e6N3VJV5J1AWGIJGowT/2CRkw4ASwlu5qoEDf9aQ6boU5K0ayfIr/uPSANYqk1nt7 5pTjSWgVtrE9TnwhqAAM07fD8ZTTxmzp+dA6I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694444350; x=1695049150; 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=P6fjZvi77/SAC3KTTBdU8W4eyw5oqGUrEP0pw0pgFc8=; b=GkX5jnix2wQdNJuzXDV+Ni3R/F86g8Q/Q5pgfEuJ8SYuv9OtRtBRqh4I93x85+KTce i+RXB5JCTtZE99LJdp0119HboMfo5Mo+grtfXaytCCSaO57m4rEiujOf7VK01n874tsO lRNf9zi51tdHX+KN65KdX2JWIzvcSsD2xrzBtJ9B7vQpyvrCuQiAee4N4pOIS3s+jdYr /fpenhiWEx5ApFYHwmx00Ynt/Kr4MfWydJBwUqNofxpTT+5GANBEAeBOBggAsILWzKvL Tw5OyPSllgR/Gz2NBbuuNlh7F3gAI7xOUYKkyUBoFu2csccitU3Rg6cDQexsJEjwlxQ8 42Kg== X-Gm-Message-State: AOJu0YxHaJwnMPfIOh62QBowpsWTDfAmcNTXQn+LpbrR6pA2wk3kFsz4 Yk6/9pyX8mK5ogZn2TBuM3R1DKgGiAc7xL85k45yyA== X-Google-Smtp-Source: AGHT+IEtumQqtV9Ikp27COnSC0bxjs7WuyQz09xFfBBR1J1l/v/dqg3zhfHxRwyvphEF+jcibFWnPtJYzCjU2Q0PuNU= X-Received: by 2002:a05:6122:ca0:b0:495:d5a4:513 with SMTP id ba32-20020a0561220ca000b00495d5a40513mr4124687vkb.14.1694444350197; Mon, 11 Sep 2023 07:59:10 -0700 (PDT) MIME-Version: 1.0 References: <20230718223233.15328-1-kmatsui@gcc.gnu.org> <20230719193242.59472-1-kmatsui@gcc.gnu.org> In-Reply-To: From: Ken Matsui Date: Mon, 11 Sep 2023 07:58:34 -0700 Message-ID: Subject: Re: [PATCH v2] libstdc++: Define _GLIBCXX_HAS_BUILTIN_TRAIT To: Jonathan Wakely Cc: Ken Matsui , gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,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, Sep 11, 2023 at 7:51=E2=80=AFAM Jonathan Wakely wrote: > > On Thu, 31 Aug 2023 at 13:33, Ken Matsui wrot= e: > > > > On Tue, Aug 8, 2023 at 1:23=E2=80=AFPM Jonathan Wakely wrote: > > > > > > > > > > > > On Wed, 19 Jul 2023 at 20:33, Ken Matsui via Libstdc++ wrote: > > >> > > >> This patch defines _GLIBCXX_HAS_BUILTIN_TRAIT macro, which will be u= sed > > >> as a flag to toggle the use of built-in traits in the type_traits he= ader > > >> through _GLIBCXX_NO_BUILTIN_TRAITS macro, without needing to modify = the > > >> source code. > > >> > > >> libstdc++-v3/ChangeLog: > > >> > > >> * include/bits/c++config (_GLIBCXX_HAS_BUILTIN_TRAIT): Defin= e. > > >> (_GLIBCXX_HAS_BUILTIN): Keep defined. > > > > > > > > > I think this would be a little better as: > > > > > > * include/bits/c++config (_GLIBCXX_HAS_BUILTIN): Do not undef= . > > > (_GLIBCXX_HAS_BUILTIN_TRAIT): Define. > > > > > > OK for trunk with that change, thanks. > > > > > Thank you for your review! Patrick and I were discussing the naming > > conventions for the macros _GLIBCXX_HAS_BUILTIN_TRAIT and > > _GLIBCXX_NO_BUILTIN_TRAITS. It was brought to our attention that these > > namings might be ambiguous, as there are implementations that have > > corresponding built-ins but do not have fallback. Therefore, we > > believe that using _GLIBCXX_USE_BUILTIN_TRAIT instead of > > _GLIBCXX_HAS_BUILTIN_TRAIT would be more appropriate. Similarly, we > > think that _GLIBCXX_AVOID_BUILTIN_TRAITS would be a better choice than > > _GLIBCXX_NO_BUILTIN_TRAITS, as the latter implies that there are no > > built-ins, when in fact it is meant to express that the use of > > built-ins should be avoided when defining this macro. Could you please > > let me know your thoughts on these updated namings? > > Yes, I agree that makes sense. I think personally I'd go with > "DISABLE" instead of "AVOID", or even "DO_NOT_USE" (to mirror "USE" in > the macro for individual traits), but either is OK. I like the idea of mirroring "USE", so I would choose "DO_NOT_USE". Thank you for your response! > > > > > >> > > >> > > >> Signed-off-by: Ken Matsui > > >> --- > > >> libstdc++-v3/include/bits/c++config | 10 +++++++++- > > >> 1 file changed, 9 insertions(+), 1 deletion(-) > > >> > > >> diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/incl= ude/bits/c++config > > >> index dd47f274d5f..984985d6fff 100644 > > >> --- a/libstdc++-v3/include/bits/c++config > > >> +++ b/libstdc++-v3/include/bits/c++config > > >> @@ -854,7 +854,15 @@ namespace __gnu_cxx > > >> # define _GLIBCXX_HAVE_BUILTIN_LAUNDER 1 > > >> #endif > > >> > > >> -#undef _GLIBCXX_HAS_BUILTIN > > >> +// Returns 1 if _GLIBCXX_NO_BUILTIN_TRAITS is not defined and the c= ompiler > > >> +// has a corresponding built-in type trait, 0 otherwise. > > >> +// _GLIBCXX_NO_BUILTIN_TRAITS can be defined to disable the use of = built-in > > >> +// traits. > > >> +#ifndef _GLIBCXX_NO_BUILTIN_TRAITS > > >> +# define _GLIBCXX_HAS_BUILTIN_TRAIT(BT) _GLIBCXX_HAS_BUILTIN(BT) > > >> +#else > > >> +# define _GLIBCXX_HAS_BUILTIN_TRAIT(BT) 0 > > >> +#endif > > >> > > >> // Mark code that should be ignored by the compiler, but seen by Do= xygen. > > >> #define _GLIBCXX_DOXYGEN_ONLY(X) > > >> -- > > >> 2.41.0 > > >> > > >