PR65122 extended alignment support in allocators
authorJonathan Wakely <redi@gcc.gnu.org>
Fri, 14 Oct 2016 12:03:47 +0000 (13:03 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Fri, 14 Oct 2016 12:03:47 +0000 (13:03 +0100)
commitace4c2f060160bd3ef9032cc151e36b84e4ba3e8
treeb1ea7c7f07360d2914b518d2a602e9c3b524547e
parentcb3ac86754e416f716e478f309f13108f9e9ac7f
PR65122 extended alignment support in allocators

PR libstdc++/65122
* include/ext/malloc_allocator.h (malloc_allocator::allocate): Use
aligned_alloc for types with extended alignment if available,
otherwise throw bad_alloc if malloc doesn't return a suitable value.
* include/ext/bitmap_allocator.h (bitmap_allocator::allocate)
(bitmap_allocator::deallocate): Use aligned new/delete for types with
extended alignment.
* include/ext/mt_allocator.h (__mt_alloc::allocate)
(__mt_alloc::deallocate): Likewise.
* include/ext/new_allocator.h (new_allocator::allocate)
(new_allocator::deallocate): Likewise.
* include/ext/pool_allocator.h (__pool_alloc::allocate)
(__pool_alloc::deallocate): Likewise.
* testsuite/20_util/allocator/overaligned.cc: New test.
* testsuite/ext/bitmap_allocator/overaligned.cc: New test.
* testsuite/ext/malloc_allocator/overaligned.cc: New test.
* testsuite/ext/mt_allocator/overaligned.cc: New test.
* testsuite/ext/new_allocator/overaligned.cc: New test.
* testsuite/ext/pool_allocator/overaligned.cc: New test.

From-SVN: r241158
12 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/include/ext/bitmap_allocator.h
libstdc++-v3/include/ext/malloc_allocator.h
libstdc++-v3/include/ext/mt_allocator.h
libstdc++-v3/include/ext/new_allocator.h
libstdc++-v3/include/ext/pool_allocator.h
libstdc++-v3/testsuite/20_util/allocator/overaligned.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/bitmap_allocator/overaligned.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/malloc_allocator/overaligned.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/mt_allocator/overaligned.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/new_allocator/overaligned.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/pool_allocator/overaligned.cc [new file with mode: 0644]