From patchwork Thu Oct 9 18:18:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 398091 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 9439B1400B2 for ; Fri, 10 Oct 2014 05:18:28 +1100 (EST) 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=hqfYZsxBhvyIqdfFn rimAkLa/ep1qv1g5Kch9mEe9U1bXN/RTTgEQCYALR0cdV+I0skA4HdxayDpLFH5M oP4ndnDcGviY9MapCbavjcWwbIkhN43Yn4gEwUKHXGiGdrqGbzIm0ZXvLyz+uSao Y1trdpjjonflqQ0P+zSzfkdU7s= 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=a6nCQG4iinsuYEuT1ZiGW+3 +yPA=; b=CVANgYaj28MMqmn5RTpaqQ3C7eh7V0N6i9NqjvFw1fSqK4RWXTMVKPJ YV2I0ECeM5Y5F/Dd2uvlnjj7XzUnxQrmZ17tuMYt4elukF5c+/OcZmY1e7gQFdfv hH/pQfr1zrXvtC6DTbteXsUTPUL8m1F/kmEtRhwMAHzORINMxiU8= Received: (qmail 18185 invoked by alias); 9 Oct 2014 18:18:06 -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 18140 invoked by uid 89); 9 Oct 2014 18:18:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 09 Oct 2014 18:18:04 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s99II3Oh031074 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 9 Oct 2014 14:18:03 -0400 Received: from localhost (ovpn-116-121.ams2.redhat.com [10.36.116.121]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s99II2KC029886; Thu, 9 Oct 2014 14:18:02 -0400 Date: Thu, 9 Oct 2014 19:18:01 +0100 From: Jonathan Wakely To: Paolo Carlini Cc: Ville Voutilainen , "gcc-patches@gcc.gnu.org" , libstdc++@gcc.gnu.org Subject: Re: [PATCH] PR libstdc++/60132, implement the remaining C++11 is_trivially_* traits Message-ID: <20141009181801.GC4197@redhat.com> References: <20141008224510.GA4197@redhat.com> <54364682.7060301@oracle.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <54364682.7060301@oracle.com> User-Agent: Mutt/1.5.23 (2014-03-12) Now that we have is_trivially_copyable ... Update the docs and fix a TODO in . I asked Doug Gregor recently about the __is_location_invariant trait that he used in our std::tr1::function and std::function implementations and he confirmed that in C++11 std::is_trivially_copyable is a better test. Ville pointed out on IRC that we might also be able to use it in instead of __is_trivial but I haven't investigated that properly. Tested x86_64-linux, committed to trunk. commit 27ae8432c1af48d9fbc15754bf93285dcfbfdbc3 Author: Jonathan Wakely Date: Thu Oct 9 18:22:23 2014 +0100 * doc/xml/manual/status_cxx2011.xml: Update. * doc/html/manual/status.html: Regenerate. commit 4b6c1c0a6cb99c6fc7a8da5407fffed797a0bc29 Author: Jonathan Wakely Date: Thu Oct 9 13:42:57 2014 +0100 PR libstdc++/63322 * include/std/atomic (atomic): Add assertion for trivially copyable. * testsuite/29_atomics/atomic/60695.cc: Adjust line number. diff --git a/libstdc++-v3/include/std/atomic b/libstdc++-v3/include/std/atomic index be7d0be..85dc252 100644 --- a/libstdc++-v3/include/std/atomic +++ b/libstdc++-v3/include/std/atomic @@ -163,7 +163,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION private: _Tp _M_i; - // TODO: static_assert(is_trivially_copyable<_Tp>::value, ""); + static_assert(__is_trivially_copyable(_Tp), + "std::atomic requires a trivially copyable type"); static_assert(sizeof(_Tp) > 0, "Incomplete or zero-sized types are not supported"); diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/60695.cc b/libstdc++-v3/testsuite/29_atomics/atomic/60695.cc index 27c0c8f..10c5e3a 100644 --- a/libstdc++-v3/testsuite/29_atomics/atomic/60695.cc +++ b/libstdc++-v3/testsuite/29_atomics/atomic/60695.cc @@ -27,4 +27,4 @@ struct X { char stuff[0]; // GNU extension, type has zero size }; -std::atomic a; // { dg-error "not supported" "" { target *-*-* } 168 } +std::atomic a; // { dg-error "not supported" "" { target *-*-* } 169 } commit cfb875df06d5691b5d81de489d07c0da106da517 Author: Jonathan Wakely Date: Thu Oct 9 13:47:04 2014 +0100 PR libstdc++/61909 * include/std/functional (__is_location_invariant): Treat all trivially copyable types as location invariant. diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional index 15247bf..bed1eea 100644 --- a/libstdc++-v3/include/std/functional +++ b/libstdc++-v3/include/std/functional @@ -1743,11 +1743,12 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) /** * Trait identifying "location-invariant" types, meaning that the * address of the object (or any of its members) will not escape. - * Also implies a trivial copy constructor and assignment operator. + * Trivially copyable types are location-invariant and users can + * specialize this trait for other types. */ template struct __is_location_invariant - : __or_, is_member_pointer<_Tp>>::type + : is_trivially_copyable<_Tp>::type { }; class _Undefined_class; diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2011.xml b/libstdc++-v3/doc/xml/manual/status_cxx2011.xml index 108de36..c4b4457 100644 --- a/libstdc++-v3/doc/xml/manual/status_cxx2011.xml +++ b/libstdc++-v3/doc/xml/manual/status_cxx2011.xml @@ -811,16 +811,10 @@ particular release. - 20.9.4.3 Type properties - Partial - Missing is_trivially_copyable, - is_trivially_constructible, is_trivially_default_constructible, - is_trivially_copy_constructible, is_trivially_move_constructible, - is_trivially_assignable, is_trivially_default_assignable, - is_trivially_copy_assignable, is_trivially_move_assignable - + Y + 20.9.5