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 E522D3858017 for ; Tue, 8 Aug 2023 20:23:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E522D3858017 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=1691526188; 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=Cnv8WMmuTCu/P0TnUUsLnRJAs4/EL5WMDyFMOyxllQjZMGlOHr1Oj81h7RoMiq1mJCWuJ6 Bh4YS56jqzYI6erFsfrV0L64Pcem1wb+i8jDOPxB8SfrF4Cmfsgg5q+ySm6CFY3k7mJIN5 fjx6SAJMLw/YgfL5HG3uXlgkYuZOM6k= Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-547-PFNeVZYmNbmJ1sHoakagQQ-1; Tue, 08 Aug 2023 16:22:24 -0400 X-MC-Unique: PFNeVZYmNbmJ1sHoakagQQ-1 Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2b9e8abe56bso59153371fa.2 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=DSUt5REDJQ92oHkJHxxlpz83TCTqzS7smd3z1ISXIf+Z6iIZeXSBbpQMaXo9w0Tvxp haKuX8EZNfOc4ab2KmJXSZxTdoLSVxVKa+Px2LjJrY3Q011GlxxFUdqSIPX4X+xmnV/b y3w7T4dDkFL+F0lj4iUsvXM6ySvTotqMMkhX/8qYN3PUqnShCm9E8y4062NfNZFKfgAg eGAaqcI1Tb4gAophg8Cx/5Rm4DNkKVYlrs8bxlgqfvkZW0czJ3trostNGONmJRUIrltp H+b9q8ryJpT0Hf2r8JbZonukbsAFrjoSKdG7JVfDLdysdgZBfWzzIYsNG4oZO+VBCqaV V6mQ== X-Gm-Message-State: AOJu0Yxpkg2aG5dRTjyUOTPMo4pQYfQu/t2sXguZmwKj+Pk5uIi6YXW+ Tl3/kfVQQk/eEdAkYtuj3cgCKURAI3OkTwedTcd5GUYuQhMGTotlDc/tr32bGY/D5zevERBW5Vg Uj6xBdWQ6yrP+DHZuywKQZ9ilK/Q9INTcVA== X-Received: by 2002:a2e:780b:0:b0:2b8:36d4:7b0a with SMTP id t11-20020a2e780b000000b002b836d47b0amr445953ljc.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.1 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=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: --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--