From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id D24453858C5E for ; Mon, 11 Sep 2023 14:51:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D24453858C5E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694443865; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=t6Xn8Z8WoRMM7VDRyY3cRhyI0rfKrK0/K9fuK56yyx0=; b=Ppk9UXs9GNU4I2+j5SgGSRLaIS3aEqA7MBWeYnWUYz4ZfoUDnQOliqc9UqXofMqcE+ArvA fpGZoUz41m+fht0rJ5XyyXE6WkuhncMISmYsj2hI65I7ZLWlxktpTYg8f5jOLAizzE+wOH gkJZHK4sNTqPfWih6pfjT7QwbdHAyn8= Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-223-xi5ij5hCMfaMOgKGXg4MMQ-1; Mon, 11 Sep 2023 10:51:03 -0400 X-MC-Unique: xi5ij5hCMfaMOgKGXg4MMQ-1 Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2bcc2fd542bso49705651fa.3 for ; Mon, 11 Sep 2023 07:51:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694443862; x=1695048662; 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=t6Xn8Z8WoRMM7VDRyY3cRhyI0rfKrK0/K9fuK56yyx0=; b=Lzhf1NrzoTJDvOm6ca7jLqjjf6FGxqX6OEvBNufZQKjI19ZgqP1u873hO2VlAgsCQ3 haIbXifz5pzJ7CboJB7dOF0a3TYsDSBynqD+Vc//MRzM3O7pxtQyauHTvzihuiq9fpJe 0In1l5SMf4WFInwKwTmVemKxgYFpJR4N1TM07U5j8LAG59TEJQAMTKgrKB3ZN+pyzUjd 5L7IguE6mSV6vzPgUr8r7IopY6n3zBHMw41YJAnxGEDvHdbhZ4dOeqdynT/In0SlujyD zJ6Ex0qTnIwdsja0uRtM+CKs7aBtcxcQODYUzymL8ZIWlUsap0MkJAsXIGTwhDSUA5Vm YukA== X-Gm-Message-State: AOJu0YzNdiHHi3RItVlEdmc/Ik0G2XHXLZFZhcw4yh8ZePTZzuBMTBNl DKiGaQ58+1RTE4zEOtBfgdbshfSnVcXQP5EVY26NLWtpDC8Vi+oQ9qseOEf3ne3Ro+3+7Ceihne 3AP3gaTOxIElhmyU6oiKCPgV6eZ4nvnA= X-Received: by 2002:a2e:879a:0:b0:2bc:ff80:f639 with SMTP id n26-20020a2e879a000000b002bcff80f639mr8533379lji.7.1694443861847; Mon, 11 Sep 2023 07:51:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE3hklmGNFsX6jRcmPSHOjA4AQ/CG9D0JsqehKV//s4hk1s3X8xF3UZnmMH6eyRukTdYhn07Eu4xqcKB9bPFFE= X-Received: by 2002:a2e:879a:0:b0:2bc:ff80:f639 with SMTP id n26-20020a2e879a000000b002bcff80f639mr8533358lji.7.1694443861501; Mon, 11 Sep 2023 07:51:01 -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: Jonathan Wakely Date: Mon, 11 Sep 2023 15:50:50 +0100 Message-ID: Subject: Re: [PATCH v2] libstdc++: Define _GLIBCXX_HAS_BUILTIN_TRAIT To: Ken Matsui Cc: Ken Matsui , gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,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: On Thu, 31 Aug 2023 at 13:33, Ken Matsui wrote: > > 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 use= d > >> as a flag to toggle the use of built-in traits in the type_traits head= er > >> through _GLIBCXX_NO_BUILTIN_TRAITS macro, without needing to modify th= e > >> source code. > >> > >> libstdc++-v3/ChangeLog: > >> > >> * include/bits/c++config (_GLIBCXX_HAS_BUILTIN_TRAIT): Define. > >> (_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. > > > >> > >> > >> 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/includ= e/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 com= piler > >> +// has a corresponding built-in type trait, 0 otherwise. > >> +// _GLIBCXX_NO_BUILTIN_TRAITS can be defined to disable the use of bu= ilt-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 Doxy= gen. > >> #define _GLIBCXX_DOXYGEN_ONLY(X) > >> -- > >> 2.41.0 > >> >