From: Ulrich Drepper Date: Sat, 24 Dec 2011 04:49:48 +0000 (-0500) Subject: Implement aligned_alloc X-Git-Tag: glibc-2.16-tps~1127^2~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=380d7e87dc80978581e73063dff0e264283c0306;p=thirdparty%2Fglibc.git Implement aligned_alloc --- diff --git a/ChangeLog b/ChangeLog index 02d8a2b5024..c75d8298754 100644 --- a/ChangeLog +++ b/ChangeLog @@ -28,11 +28,17 @@ 2011-12-23 Ulrich Drepper + [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] diff --git a/NEWS b/NEWS index 241f4b79f57..43f02d9fd4f 100644 --- a/NEWS +++ b/NEWS @@ -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 diff --git a/Versions.def b/Versions.def index 6b05e5ba5dc..2b44f5e0bb1 100644 --- a/Versions.def +++ b/Versions.def @@ -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 diff --git a/malloc/Versions b/malloc/Versions index cf0b1e559a8..7ca9bdf25fc 100644 --- a/malloc/Versions +++ b/malloc/Versions @@ -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; diff --git a/malloc/malloc.c b/malloc/malloc.c index 8608083adbe..300e879b8cf 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -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* diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h index 754743f7679..55886662bc1 100644 --- a/stdlib/stdlib.h +++ b/stdlib/stdlib.h @@ -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__));