From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 118649 invoked by alias); 30 Oct 2015 19:33:00 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 118633 invoked by uid 89); 30 Oct 2015 19:33:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 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; Fri, 30 Oct 2015 19:32:59 +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 (Postfix) with ESMTPS id CAE2D3672A9 for ; Fri, 30 Oct 2015 19:32:57 +0000 (UTC) Received: from [10.10.116.31] (ovpn-116-31.rdu2.redhat.com [10.10.116.31]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t9UJWvSe027279 for ; Fri, 30 Oct 2015 15:32:57 -0400 Subject: Re: C++ PATCH for C++14 sized deallocation To: gcc-patches List References: <548F28D2.5090505@redhat.com> From: Jason Merrill Message-ID: <5633C5E8.80604@redhat.com> Date: Fri, 30 Oct 2015 19:41:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <548F28D2.5090505@redhat.com> Content-Type: multipart/mixed; boundary="------------080900020404040704080700" X-SW-Source: 2015-10/txt/msg03446.txt.bz2 This is a multi-part message in MIME format. --------------080900020404040704080700 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 889 On 12/15/2014 01:30 PM, Jason Merrill wrote: > This patch implements the last remaining language feature for C++14, > global sized deallocation. C++ has always had sized deallocation at > class scope, but didn't for deletes that use the global operator delete. > > The support can be controlled separately from the -std level with the > -fsized-deallocation flag (same as clang). > > The compiler will warn about the unsized variant being defined without > the sized variant (or vice versa) with the -Wsized-deallocation flag, > which is also enabled by -Wextra. > > This patch also adds -Wc++14-compat, which currently only warns about a > deallocation function with a second size_t parameter changing from being > a placement delete to a usual deallocation function. > > Tested x86_64-pc-linux-gnu, applying to trunk. I suppose we should also declare these functions in . Jason --------------080900020404040704080700 Content-Type: text/x-patch; name="declare-sized-deletes.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="declare-sized-deletes.patch" Content-length: 1693 commit d37df45bae7ad7afb1825dd294eefea0781b245f Author: Jason Merrill Date: Thu Oct 29 11:27:33 2015 -0400 * libsupc++/new: Declare sized deletes. diff --git a/libstdc++-v3/libsupc++/new b/libstdc++-v3/libsupc++/new index bd50b6c..0f6a05a 100644 --- a/libstdc++-v3/libsupc++/new +++ b/libstdc++-v3/libsupc++/new @@ -116,6 +116,12 @@ void operator delete(void*) _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); void operator delete[](void*) _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); +#if __cpp_sized_deallocation +void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT + __attribute__((__externally_visible__)); +void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT + __attribute__((__externally_visible__)); +#endif void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT @@ -124,6 +130,12 @@ void operator delete(void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); void operator delete[](void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); +#if __cpp_sized_deallocation +void operator delete(void*, std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT + __attribute__((__externally_visible__)); +void operator delete[](void*, std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT + __attribute__((__externally_visible__)); +#endif // Default placement versions of operator new. inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT --------------080900020404040704080700--