From patchwork Thu Feb 8 16:00:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1896647 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=FTty+dvu; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TW1v92G7Dz23h2 for ; Fri, 9 Feb 2024 03:01:40 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F148238582AA for ; Thu, 8 Feb 2024 16:01:37 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 D988E3858C5F for ; Thu, 8 Feb 2024 16:01:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D988E3858C5F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D988E3858C5F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707408079; cv=none; b=e2AzJ2X3/5Zi/lOZibdUXu6Ln7W+vKtmtpZhnbW5U29AJLBH6HlFSwFzPtomB2tfOVTZRrU8FotY83mb3IDtWchouFw/AageL4PoEMijYm3iUCIbkOPyNQn2pqz0az8u1lFPdlgkRL7EdRyfKRyx0YRAhCx6mlUjjIEyjYW+a10= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707408079; c=relaxed/simple; bh=d2aZxHmCCVAMKMU/F8K35+p40lYjxJFYhcUJhQ3T2+A=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Cyaj+xlZ1NUzprAm5CJqaUIEnSZmHQbMwOzAYZ6dfoFsb133ogGtW76V8M2W096UyWgUzkX7rvXAQtU5PQonFyDMf0/plljK+DiKviRH3d4tD6R05bIYs9FvNhe2pv17BI1dpVU+jLrBYyiZ76998DzvT9nU8pC7xsl64me8rBE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707408077; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aKZE4zDBVyghKEUi0B6nPE4288wKKl4+v+BSL4HYWmA=; b=FTty+dvuMicF1l112EIPP6W7AtUJJfYOZ0PAqRa1cxgt3OQ3mzksWG+wTNtZsAahuuccKF lUoknpbZ5cHnBTL0blb8KREfgqLjLGtTWB2djChZqKM18IhoBv1T5M0JEy2bJXoaDdbuyP 2CMs9exka98+sUWHMQrB7e4ONHYbkBk= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-221-VjPUna0RO1ur2BlZQ3aiTw-1; Thu, 08 Feb 2024 11:01:11 -0500 X-MC-Unique: VjPUna0RO1ur2BlZQ3aiTw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0D34938149BF; Thu, 8 Feb 2024 16:01:10 +0000 (UTC) Received: from localhost (unknown [10.42.28.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id CEB98111F9; Thu, 8 Feb 2024 16:01:09 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Guard tr2::bases and tr2::direct_bases with __has_builtin Date: Thu, 8 Feb 2024 16:00:44 +0000 Message-ID: <20240208160109.2697643-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Tested x86_64-linux. Pusued to trunk. I'll backport it too. -- >8 -- These non-standard extensions use GCC-specific built-ins. Use __has_builtin to avoid errors when Clang compiles this header. See https://github.com/llvm/llvm-project/issues/24289 libstdc++-v3/ChangeLog: * include/tr2/type_traits (bases, direct_bases): Use __has_builtin to check if required built-ins are supported. --- libstdc++-v3/include/tr2/type_traits | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/include/tr2/type_traits b/libstdc++-v3/include/tr2/type_traits index a7ebaf66947..603039de894 100644 --- a/libstdc++-v3/include/tr2/type_traits +++ b/libstdc++-v3/include/tr2/type_traits @@ -82,20 +82,23 @@ namespace tr2 /// Sequence abstraction metafunctions for manipulating a typelist. - +#if __has_builtin(__bases) /// Enumerate all the base classes of a class. Form of a typelist. template struct bases { typedef __reflection_typelist<__bases(_Tp)...> type; }; +#endif +#if __has_builtin(__direct_bases) /// Enumerate all the direct base classes of a class. Form of a typelist. template struct direct_bases { typedef __reflection_typelist<__direct_bases(_Tp)...> type; }; +#endif /// @} group metaprogramming }