Implement aligned_alloc

This commit is contained in:
Ulrich Drepper 2011-12-23 23:49:48 -05:00
parent c0e87cc018
commit 380d7e87dc
6 changed files with 32 additions and 2 deletions

View File

@ -28,11 +28,17 @@
2011-12-23 Ulrich Drepper <drepper@gmail.com>
[BZ #13531]
* malloc/malloc.c: Define alias aligned_alloc for public_mEMALIGn.
* stdlib/stdlib.h: Declare aligned_alloc.
* Versions.def: Add GLIBC_2.16 for libc.
* malloc/Versions: Export aligned_alloc from libc for GLIBC_2.16.
[BZ 13527]
* stdlib/stdlib.h: Make at_quick_exit and quick_exit available for
ISO C11.
* include/features.h: Define __USE_ISOCXX11 when compiling ISo C++11
* include/features.h: Define __USE_ISOCXX11 when compiling ISO C++11
code.
[BZ #13528]

15
NEWS
View File

@ -9,7 +9,20 @@ Version 2.16
* The following bugs are resolved with this release:
13526, 13527, 13528, 13529
13526, 13527, 13528, 13529, 13531
* ISO C11 support:
+ define static_assert
+ do not declare gets
+ declare at_quick_exit and quick_exit also for ISO C11
+ aligned_alloc. NB: The code is deliberately allows the size parameter
to not be a multiple of the alignment. This is a moronic requirement
in the standard but it is only a requirement on the caller, not the
implementation.
Version 2.15

View File

@ -32,6 +32,7 @@ libc {
GLIBC_2.13
GLIBC_2.14
GLIBC_2.15
GLIBC_2.16
HURD_CTHREADS_0.3
%ifdef EXPORT_UNWIND_FIND_FDE
GCC_3.0

View File

@ -58,6 +58,9 @@ libc {
GLIBC_2.10 {
malloc_info;
}
GLIBC_2.16 {
aligned_alloc;
}
GLIBC_PRIVATE {
# Internal startup hook for libpthread.
__libc_malloc_pthread_startup;

View File

@ -3124,6 +3124,8 @@ public_mEMALIGn(size_t alignment, size_t bytes)
ar_ptr == arena_for_chunk(mem2chunk(p)));
return p;
}
/* For ISO C11. */
weak_alias (public_mEMALIGn, aligned_alloc)
libc_hidden_def (public_mEMALIGn)
void*

View File

@ -509,6 +509,11 @@ extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
__THROW __nonnull ((1)) __wur;
#endif
#ifdef __USE_ISOC11
/* ISO C variant of aligned allocation. */
extern int aligned_alloc (size_t __alignment, size_t __size) __THROW __wur;
#endif
__BEGIN_NAMESPACE_STD
/* Abort execution and generate a core-dump. */
extern void abort (void) __THROW __attribute__ ((__noreturn__));