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.133.124]) by sourceware.org (Postfix) with ESMTPS id D104E3858421 for ; Tue, 8 Aug 2023 20:23:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D104E3858421 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=1691526211; 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: in-reply-to:in-reply-to:references:references; bh=tf3zxbY9SVf3EBwDWkcjNJ1Wpb3dM9Qrlb5v5c4qpPQ=; b=GawDUsFdSETNdEr2m31WWWGs4IblksKp0+rF9TdmRjS/DxsXzDUpvd0NZ0Ph39afYaMx2q iR5zaDUWZCoPiitIbnMswSv8CwNNKM/dMi2rpQSEVuRA3PGAJnyQ7fEAl2PK6TCMIwQQSb dA21F5MU51aZI+e8VFFi2eELNh/Ffhk= Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-637-chy7S_WJPK6AlvIZXrYCbg-1; Tue, 08 Aug 2023 16:22:24 -0400 X-MC-Unique: chy7S_WJPK6AlvIZXrYCbg-1 Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2ba1949656bso49009121fa.0 for ; Tue, 08 Aug 2023 13:22:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691526142; x=1692130942; h=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=tf3zxbY9SVf3EBwDWkcjNJ1Wpb3dM9Qrlb5v5c4qpPQ=; b=cTxqoWXveaINlRgGkL1f/bxy3v9jVGvnnWdevFi1Jjx1rYxghdkSUnqn01gbKW0kop QlmL0g1xYs7C+CC2jXmvpu1qHjOfRz/mRncsuWWnrdqAEEQT7f8lulsCmFfuMxJvcvFb 31/5HKZ9tB50ROLyJBfw9stkh4o6Iqz0ukrwAQVxC33/GF50UUSEOmbyNCbMT1LAXZR+ IgRrKX2gD4CUIEqHIYp0VUAO+++2Z4BKm/b0HwmigKz93ECbHwMHt8KPTFKBeMLBu0RM OD56Jmz69N9ZRH6q3t1JPJnTVVmcql2wDDqhKarQh9v/dANQn0GIGyMP8DQzUnO2xR/X i7ag== X-Gm-Message-State: AOJu0YxKItRl/9QmO0gcvif9cd+ugISl+vRbJAjkrIcBwuJWUUnc2UId WUQer8aH9BEnRvSf8yTcilOc0JJTcCJQcvaxvZ6qjX2p6p/fT8U6M/5TLaLodyXygKXGgRzkgu4 /fuhkJ2Xbs9zJ37dmTuVl/tIQsYBRZXU= X-Received: by 2002:a2e:780b:0:b0:2b8:36d4:7b0a with SMTP id t11-20020a2e780b000000b002b836d47b0amr445951ljc.29.1691526142499; Tue, 08 Aug 2023 13:22:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFT/lyHx318twE9xzqgbNNEBCTkqZXnpMH1ubZE5kg/4jzzMEwrueitGOSFuAaHKPDhZty6c8bJC8UvuGUII5I= X-Received: by 2002:a2e:780b:0:b0:2b8:36d4:7b0a with SMTP id t11-20020a2e780b000000b002b836d47b0amr445945ljc.29.1691526142163; Tue, 08 Aug 2023 13:22:22 -0700 (PDT) MIME-Version: 1.0 References: <20230718223233.15328-1-kmatsui@gcc.gnu.org> <645412ed-82dd-fe17-d25a-68bbe0ccf8ac@idea> In-Reply-To: <645412ed-82dd-fe17-d25a-68bbe0ccf8ac@idea> From: Jonathan Wakely Date: Tue, 8 Aug 2023 21:22:11 +0100 Message-ID: Subject: Re: [PATCH] libstdc++: Define _GLIBCXX_HAS_BUILTIN_TRAIT To: Patrick Palka Cc: Ken Matsui , gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="000000000000d51bab06026f1e7d" X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,HTML_MESSAGE,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: --000000000000d51bab06026f1e7d Content-Type: text/plain; charset="UTF-8" On Wed, 19 Jul 2023 at 19:48, Patrick Palka via Libstdc++ < libstdc++@gcc.gnu.org> wrote: > On Tue, 18 Jul 2023, Ken Matsui via Libstdc++ wrote: > > > This patch defines _GLIBCXX_HAS_BUILTIN_TRAIT, which will be used as a > > flag to toggle built-in traits in the type_traits header. Through this > > macro function and _GLIBCXX_NO_BUILTIN_TRAITS macro, we can switch the > > use of built-in traits without needing to modify the source code. > > > > libstdc++-v3/ChangeLog: > > > > * include/bits/c++config (_GLIBCXX_HAS_BUILTIN_TRAIT): Define. > > The ChangeLog entry should also mention the change to _GLIBCXX_HAS_BUILTIN, > e.g. > > (_GLIBCXX_HAS_BUILTIN): Keep defined. > > > > > Signed-off-by: Ken Matsui > > --- > > libstdc++-v3/include/bits/c++config | 6 +++++- > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > diff --git a/libstdc++-v3/include/bits/c++config > b/libstdc++-v3/include/bits/c++config > > index dd47f274d5f..de13f61db71 100644 > > --- a/libstdc++-v3/include/bits/c++config > > +++ b/libstdc++-v3/include/bits/c++config > > @@ -854,7 +854,11 @@ namespace __gnu_cxx > > # define _GLIBCXX_HAVE_BUILTIN_LAUNDER 1 > > #endif > > > > -#undef _GLIBCXX_HAS_BUILTIN > > +// Returns true if _GLIBCXX_NO_BUILTIN_TRAITS is not defined and the > compiler > > +// has a corresponding built-in type trait. _GLIBCXX_NO_BUILTIN_TRAITS > is > > +// defined to disable the use of built-in traits. > > +#define _GLIBCXX_HAS_BUILTIN_TRAIT(BT) \ > > + (!defined(_GLIBCXX_NO_BUILTIN_TRAITS) && _GLIBCXX_HAS_BUILTIN(BT)) > > Since we don't expect _GLIBCXX_NO_BUILTIN_TRAITS to get > defined/undefined in the middle of preprocessing, perhaps we should > factor out the _GLIBCXX_NO_BUILTIN_TRAITS test from the macro function > and instead conditionally define the macro function to 0 according > _GLIBCXX_NO_BUILTIN_TRAITS? > Also a macro that expands to a use of `defined` is undefined, see [cpp.cond] p10. GCC allows it, but Clang warns. > > > > // Mark code that should be ignored by the compiler, but seen by > Doxygen. > > #define _GLIBCXX_DOXYGEN_ONLY(X) > > -- > > 2.41.0 > > > > > > --000000000000d51bab06026f1e7d--