From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vk1-xa31.google.com (mail-vk1-xa31.google.com [IPv6:2607:f8b0:4864:20::a31]) by sourceware.org (Postfix) with ESMTPS id 6792A3858D37 for ; Thu, 31 Aug 2023 12:33:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6792A3858D37 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-vk1-xa31.google.com with SMTP id 71dfb90a1353d-48ff372840aso275612e0c.0 for ; Thu, 31 Aug 2023 05:33:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.washington.edu; s=goo201206; t=1693485194; x=1694089994; 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=Qj+HJsxY0gTJRoFWwBTA2n5XBB4T8/baBfdqM8U9lSY=; b=cTnaAmrpbPDHOA/K+Oj7Wtg5zZt0jy0KmtC3dSEzCgpQqERDvaie1iytkvDqXP4ZIa DGtmZ2SMgNqHShz/z8NovP4Rtbfnwg6Gt+fGotk8lOHOdy9da45TLcwdp9/mF5Fiu4jO 0n23JuF4eimyn8OyImAS2IM9NfDWQVOVJPXhY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693485194; x=1694089994; 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=Qj+HJsxY0gTJRoFWwBTA2n5XBB4T8/baBfdqM8U9lSY=; b=GDY/HcOJuqMeSDrle8mPV2PNc/opubX49vE9gQQKwIcxsnz8RCGCvMczfiqMsXjbFE c45WKlqXVyNKchehzu4N/zccqCksV1+icwet2M6e73gsO4ZEL/i3vEsxMq6F6BT40Ckp vWGh7/QYBoiTbqkm1D7plm8slAF0vds+WwyyrytI43a3+yD/LTzn3fL5E6Cul++evU4t lykbpSzrUseJh1Reh7WlLmjx9I9VCb69Q04FS7PzKxg3Yl6gDffyNKZaBPoHJVdqI7ks fXy9FxHUxsEYPYYnj6X2oXingzSZQa3UbfzglDmdOVnlCgmxU4amfNSgx/fm5tIE2qg6 w3fA== X-Gm-Message-State: AOJu0Yxg4BGwLiddor/RQC3zNN0VO4xIacWso8xE+mb5SkXYS6ys093L NKmTgywsPkOnxj3S3XGvauazBJyj9zBEHHqb8kDw3Q== X-Google-Smtp-Source: AGHT+IG7PTBPn/JKi2duBDXA+iO4qZlCFwo5YV5wF7zco5IemvWO04lVjBkMGsUTC9g0Hzf8CotKrrBMaHU6M4P80tQ= X-Received: by 2002:a1f:258a:0:b0:490:a0fb:e087 with SMTP id l132-20020a1f258a000000b00490a0fbe087mr3449100vkl.3.1693485193736; Thu, 31 Aug 2023 05:33:13 -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: Thu, 31 Aug 2023 05:32:57 -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=-12.7 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 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 used >> as a flag to toggle the use of built-in traits in the type_traits header >> through _GLIBCXX_NO_BUILTIN_TRAITS macro, without needing to modify the >> 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? > >> >> >> 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/include/= 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 compi= ler >> +// has a corresponding built-in type trait, 0 otherwise. >> +// _GLIBCXX_NO_BUILTIN_TRAITS can be defined to disable the use of buil= t-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 Doxyge= n. >> #define _GLIBCXX_DOXYGEN_ONLY(X) >> -- >> 2.41.0 >>