From patchwork Fri Oct 30 19:32:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 538488 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 6B09D1402B8 for ; Sat, 31 Oct 2015 06:33:07 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=ZO9lOyHL; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=qGVwRNgOGBHtG4odS em6io88gu9crd3WafDrpy0RLmyffTvt4091PMCbyNKcAdZh++VNtZFcR2+Pc8ip1 7CAr07W/Q2YSSG2YRzb/eHBB+qU76dNk6SGU7fI5EXbC52atFL78+jUVeNmVf/C2 cRr7q9GrogCfZKBlI2YWWHzEDM= 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 :subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=lnIaNuVKs57AoMlCkByy/Vq F1mo=; b=ZO9lOyHLEcSTV1/bIMxNowvPkihK2snipZ8zxM4edmvkgq3CINiSgKY y/NfEdmvMOrMNz1+CQ3r3XQvI2Jr8pd7w4NvbdQdoXa1PyIReWycvOfUn2Ncdvef /jVV/xJn2GavfwrRZQNas63KDH388GLJMgdGSY210WlAOm1ctOnU= 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-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 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 15:32:56 -0400 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> 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 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