From patchwork Wed Aug 9 21:41:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 799978 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-460143-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="mfoVBCAN"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xSPq82MlFz9s65 for ; Thu, 10 Aug 2017 07:41:37 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=cvjNNTglrAyONt0Z6 8rNmciGfw7ft1xhDW+sHEuoANVJnRUEOhRo94pBd+7Q7NTmhIK3R8P61PUPHmUVp 6WJxxed3JcUIw6BpoQtJcXfeyPAOpwC//bOVbU+xcoioRxNp8/RZ2iOJWWy2vJP6 yA0oGmbmnX55HmStGFtqkzlSbU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=default; bh=I/kkG6K871IqznFBxKOs8Us i1Vc=; b=mfoVBCANzrUCXhra7C6w1KlVwCxMVLZ4RAL9+MD4q3L22+ejWXq/Ykb tn5mT08rL7AAZvSlv+qzExMAF9Az/z8hujOHVjOdC8rgUrToobCBtFIKXIAkmcgj +dOu7bkO/eckeriA08Xkv+oPVNsMWwlPaHpduFaNztxCANcAzzkk= Received: (qmail 83304 invoked by alias); 9 Aug 2017 21:41:24 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 83093 invoked by uid 89); 9 Aug 2017 21:41:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 09 Aug 2017 21:41:13 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4B07BB6D95; Wed, 9 Aug 2017 21:41:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4B07BB6D95 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jwakely@redhat.com Received: from localhost (unknown [10.33.36.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA99077C09; Wed, 9 Aug 2017 21:41:11 +0000 (UTC) Date: Wed, 9 Aug 2017 22:41:11 +0100 From: Jonathan Wakely To: Katsuhiko Nishimra Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org, cfe-dev@lists.llvm.org Subject: Re: [PATCH] libstdc++: Support std::is_aggregate on clang++ (was [cfe-dev] clang++: std::is_aggregate unusable with clang-5.0/libstdc++-7) Message-ID: <20170809214110.GP15340@redhat.com> References: <20170727072715.43fqiep4nawwvzlc@netzach.ktns.kdns.info> <20170731145342.GW15340@redhat.com> <20170801150551.lvxoru7kq46mueqt@netzach.ktns.kdns.info> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170801150551.lvxoru7kq46mueqt@netzach.ktns.kdns.info> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.8.0 (2017-02-23) On 02/08/17 00:05 +0900, Katsuhiko Nishimra wrote: >On Mon, Jul 31, 2017 at 03:53:42PM +0100, Jonathan Wakely wrote: >> This __has_bultin check only exists for Clang, so should be replaced >> by the correct __is_identifier check, not left there in addition to >> it. > >I see. Actually I've guessed so, and thank you for clarifying it. >I'm attaching a replacing patch. Please take a look at it. Thanks, I've committed this to GCC trunk and will backport it to the gcc-7-branch after the GCC 7.2 release (which is due any day now). I've also committed the attached patch which changes our feature detection for a __has_unique_object_representations builtin, as I expect that will also need to use __is_identifier if/when Clang supports it. Tested powerpc64le-linux, and also tested using Clang version 5.0.0 (trunk 307530) to confirm that __is_aggregate is correctly detected and std::is_aggregate is defined. >From 1b22cc531027832cf1eb50b73354f1730edbba54 Mon Sep 17 00:00:00 2001 >From: Katsuhiko Nishimra >Date: Tue, 1 Aug 2017 20:36:58 +0900 >Subject: [PATCH] libstdc++: Support std::is_aggregate on clang++ > >Currently, libstdc++ tries to detect __is_aggregate built-in macro using >__has_builtin, but this fails on clang++ because __has_builtin on >clang++ detects only built-in functions, not built-in macros. This patch >adds a test using __is_identifier. Tested with clang++ >6.0.0-svn309616-1~exp1 and g++ 7.1.0-11 on Debian unstable. >--- > libstdc++-v3/include/std/type_traits | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > >diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits >index 390b6f40a..ee9c75baf 100644 >--- a/libstdc++-v3/include/std/type_traits >+++ b/libstdc++-v3/include/std/type_traits >@@ -2894,9 +2894,9 @@ template > > #if __GNUC__ >= 7 > # define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1 >-#elif defined __has_builtin >+#elif defined(__is_identifier) > // For non-GNU compilers: >-# if __has_builtin(__is_aggregate) >+# if ! __is_identifier(__is_aggregate) > # define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1 > # endif > #endif >-- >2.13.3 > commit 1b00aa3825ea05fea071f31d29aafff71a002c53 Author: Jonathan Wakely Date: Wed Aug 9 19:07:28 2017 +0100 Fix test for __has_unique_object_representations support in Clang * include/std/type_traits (_GLIBCXX_NO_BUILTIN_HAS_UNIQ_OBJ_REP): Replace with _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP and use __is_identifier to set it. diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index ee9c75b..f021c42 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -2873,14 +2873,16 @@ template template inline constexpr bool is_convertible_v = is_convertible<_From, _To>::value; -#ifdef __has_builtin -# if !__has_builtin(__has_unique_object_representations) -// Try not to break non-GNU compilers that don't support the built-in: -# define _GLIBCXX_NO_BUILTIN_HAS_UNIQ_OBJ_REP 1 +#if __GNUC__ >= 7 +# define _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP 1 +#elif defined(__is_identifier) +// For non-GNU compilers: +# if ! __is_identifier(__has_unique_object_representations) +# define _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP 1 # endif #endif -#ifndef _GLIBCXX_NO_BUILTIN_HAS_UNIQ_OBJ_REP +#ifdef _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP # define __cpp_lib_has_unique_object_representations 201606 /// has_unique_object_representations template @@ -2890,7 +2892,7 @@ template )> { }; #endif -#undef _GLIBCXX_NO_BUILTIN_HAS_UNIQ_OBJ_REP +#undef _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP #if __GNUC__ >= 7 # define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1