From: Jason Merrill <jason@redhat.com>
To: gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: Re: C++ PATCH for C++14 sized deallocation
Date: Fri, 30 Oct 2015 19:41:00 -0000 [thread overview]
Message-ID: <5633C5E8.80604@redhat.com> (raw)
In-Reply-To: <548F28D2.5090505@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 889 bytes --]
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 <new>.
Jason
[-- Attachment #2: declare-sized-deletes.patch --]
[-- Type: text/x-patch, Size: 1693 bytes --]
commit d37df45bae7ad7afb1825dd294eefea0781b245f
Author: Jason Merrill <jason@redhat.com>
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
prev parent reply other threads:[~2015-10-30 19:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-15 18:31 Jason Merrill
2014-12-16 10:17 ` Andreas Schwab
2014-12-16 15:53 ` Jason Merrill
2014-12-16 16:54 ` Andreas Schwab
2014-12-16 17:11 ` Jakub Jelinek
2014-12-16 17:19 ` [PATCH] Fix " Jakub Jelinek
2014-12-16 17:49 ` Jason Merrill
2015-10-30 19:41 ` Jason Merrill [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5633C5E8.80604@redhat.com \
--to=jason@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).