From patchwork Fri Aug 24 16:25:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Glisse X-Patchwork-Id: 961924 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-484378-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=inria.fr Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="RXfB3wYW"; 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 41xmqT1ywLz9ryn for ; Sat, 25 Aug 2018 02:25:56 +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:subject:message-id:mime-version:content-type; q=dns; s= default; b=W12jdQoN75scZHP8VaQGfYlJayw70UZvxS2w5QmmHvMy9WaXSxR3A 7Y1VQ+etSOZexVW4AYMigptQ4CXgZXpqu1ECxnLme5iVEHxMb+uQQyRJ4phjxwnc xV3gIWj5w/uE5Eo76ElaLdec8NIiARsvQZL0QtTp2t8nzRhAzkj2MM= 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:subject:message-id:mime-version:content-type; s= default; bh=AehaO2C09NpT0PRX8l3bjXPpTAg=; b=RXfB3wYWvmIrlByWP2gw ZEgzwKuV0alD9t39X0kmScNlK6vzS5g+NzQqiVNbnzAu3RFHqaFqia15tFyxwk3e H6fUqxa5DdxNLc8jRiyY3metPNYlho8wNduA1hfCQ1pCU6mGDb+D08Nn4CyFUXBc oocFGECfBqow41UUgTxf74Y= Received: (qmail 130047 invoked by alias); 24 Aug 2018 16:25:41 -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 130017 invoked by uid 89); 24 Aug 2018 16:25:40 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY autolearn=ham version=3.3.2 spammy=libsupc, H*c:HHHH X-HELO: mail2-relais-roc.national.inria.fr Received: from mail2-relais-roc.national.inria.fr (HELO mail2-relais-roc.national.inria.fr) (192.134.164.83) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 24 Aug 2018 16:25:38 +0000 Received: from ip-22.net-89-2-189.rev.numericable.fr (HELO stedding) ([89.2.189.22]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 24 Aug 2018 18:25:27 +0200 Date: Fri, 24 Aug 2018 18:25:23 +0200 (CEST) From: Marc Glisse To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: new(nothrow) is malloc-like Message-ID: User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Hello, this makes the throwing and non-throwing versions of operator new more consistent with respect to __attribute__((malloc)). The throwing versions are already unconditionally declared with DECL_IS_MALLOC = 1 in the front-end. Bootstrap+regtest on powerpc64le-unknown-linux-gnu. I manually checked that the attribute has an effect. 2018-08-25 Marc Glisse PR libstdc++/86822 * libsupc++/new (operator new(size_t, nothrow_t), operator new[](size_t, nothrow_t), operator new(size_t, align_val_t, nothrow_t), operator new[](size_t, align_val_t, nothrow_t)): Add malloc attribute. Index: libstdc++-v3/libsupc++/new =================================================================== --- libstdc++-v3/libsupc++/new (revision 263834) +++ libstdc++-v3/libsupc++/new (working copy) @@ -130,40 +130,40 @@ void operator delete(void*) _GLIBCXX_USE __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__)); + __attribute__((__externally_visible__, __malloc__)); void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT - __attribute__((__externally_visible__)); + __attribute__((__externally_visible__, __malloc__)); 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_aligned_new void* operator new(std::size_t, std::align_val_t) __attribute__((__externally_visible__)); void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) - _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); + _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__, __malloc__)); void operator delete(void*, std::align_val_t) _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); void operator delete(void*, std::align_val_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); void* operator new[](std::size_t, std::align_val_t) __attribute__((__externally_visible__)); void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) - _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); + _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__, __malloc__)); void operator delete[](void*, std::align_val_t) _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); void operator delete[](void*, std::align_val_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); #if __cpp_sized_deallocation void operator delete(void*, std::size_t, std::align_val_t) _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); void operator delete[](void*, std::size_t, std::align_val_t) _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); #endif // __cpp_sized_deallocation