From: Jonathan Wakely <jwakely@redhat.com>
To: Jason Merrill <jason@redhat.com>
Cc: gcc-patches List <gcc-patches@gcc.gnu.org>,
libstdc++@gcc.gnu.org,
"Joseph S. Myers" <joseph@codesourcery.com>
Subject: Re: RFA (libstdc++): PATCH to implement C++17 over-aligned new
Date: Thu, 08 Sep 2016 11:00:00 -0000 [thread overview]
Message-ID: <20160908105051.GA23306@redhat.com> (raw)
In-Reply-To: <CADzB+2kJRV14hZX1rGz5V_UCpSB7MdVQPh4OM=vYOsw6ZDUNkA@mail.gmail.com>
On 08/09/16 02:06 -0400, Jason Merrill wrote:
>This patch adds support for C++17 allocation of types with alignment
>greater than max_align_t using 'new'. This is on by default in C++17
>and can also be enabled for other -std= with -falign-new.
Nice.
>If a user wants to use a different boundary than alignof(max_align_t),
>perhaps because their malloc provides more or less alignment than
>glibc's, they can specify -falign-new=<N>.
>
>The patch also adds a warning about allocating an over-aligned type
>without using an aligned new-operator, which is enabled by -Wall.
>
>libstdc++ folk: Does my configury handling of different C library
>functions that might be usable for aligned allocation make sense?
The AC_CHECK_FUNCS is OK but our configure munges all the autoconf
macros to add _GLIBCXX_ as a prefix, so you need to check
_GLIBCXX_HAVE_ALIGNED_ALLOC not HAVE_ALIGNED_ALLOC, and similarly for
the other two macros. Otherwise you always get this case:
+// The C library doesn't provide any aligned allocation functions, declare
+// aligned_alloc and get a link failure if aligned new is used.
+extern "C" void *aligned_alloc(std::size_t, std::size_t);
So it will fail for a pre-C11 libc even if it provides posix_memalign.
>Is
>the (standard-conforming) implementation of the nothrow allocation
>function OK despite Jonathan's comment in bug 68210?
Yes. If anyone (maybe Taller Technologies?) cares about building
libstdc++ with -fno-exceptions then they can patch the new_op*.cc
files to do something different when !defined(__cpp_exceptions).
Or maybe I'll look at doing that as part of fixing 68210.
I'm still a little bothered about the try-catch overhead being
incurred for the std::nothrow_t allocation functions, but assuming
that allocation failure is rare that won't usually be a problem.
>OK for trunk?
The libstdc++ parts are OK with the s/HAVE/_GLIBCXX_HAVE/ change.
next prev parent reply other threads:[~2016-09-08 10:50 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-08 7:10 Jason Merrill
2016-09-08 8:32 ` Marc Glisse
2016-09-08 11:18 ` Jonathan Wakely
2016-09-09 21:40 ` Jason Merrill
2016-09-10 7:03 ` Christophe Lyon
2016-09-10 10:14 ` Marc Glisse
2016-09-10 10:35 ` Jonathan Wakely
2016-09-11 9:14 ` Christophe Lyon
2016-09-11 9:55 ` Jonathan Wakely
2016-09-11 9:56 ` Jonathan Wakely
2016-09-11 10:20 ` Christophe Lyon
2016-09-11 12:09 ` Jonathan Wakely
2016-09-13 13:04 ` Szabolcs Nagy
2016-09-10 10:14 ` Jonathan Wakely
2016-09-11 7:09 ` Andreas Schwab
2016-09-12 21:13 ` Jason Merrill
2016-09-13 8:41 ` Christophe Lyon
2016-09-13 12:37 ` Andreas Schwab
2016-09-13 12:54 ` Jason Merrill
2016-09-13 13:18 ` Andreas Schwab
2016-09-13 13:21 ` Jason Merrill
2016-09-14 12:13 ` Andreas Schwab
2016-09-14 16:11 ` Christophe Lyon
2016-09-14 16:37 ` Jason Merrill
2016-09-15 10:00 ` Rainer Orth
2016-09-15 12:23 ` Christophe Lyon
2016-09-15 20:09 ` Jason Merrill
2016-09-16 7:12 ` Rainer Orth
2016-09-16 8:15 ` Christophe Lyon
2016-09-16 9:14 ` Jonathan Wakely
2016-09-16 9:51 ` Marc Glisse
2016-09-16 11:12 ` Jonathan Wakely
2016-09-16 13:13 ` Jonathan Wakely
2016-09-16 13:17 ` Rainer Orth
2016-09-16 18:19 ` Jonathan Wakely
2016-09-12 14:15 ` Rainer Orth
2016-09-12 16:19 ` Jonathan Wakely
2016-09-12 18:57 ` Jason Merrill
2016-09-14 12:11 ` Rainer Orth
2016-09-08 11:00 ` Jonathan Wakely [this message]
2017-11-24 14:26 ` Marc Glisse
2017-11-29 21:23 ` Jason Merrill
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=20160908105051.GA23306@redhat.com \
--to=jwakely@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.com \
--cc=joseph@codesourcery.com \
--cc=libstdc++@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).