Implement aligned_alloc
authorUlrich Drepper <drepper@gmail.com>
Sat, 24 Dec 2011 04:49:48 +0000 (23:49 -0500)
committerUlrich Drepper <drepper@gmail.com>
Sun, 1 Jan 2012 12:17:21 +0000 (07:17 -0500)
ChangeLog
NEWS
Versions.def
malloc/Versions
malloc/malloc.c
stdlib/stdlib.h

index 02d8a2b50244cf0a1025b799ef9473b7a6bdc9f3..c75d829875462b1568d9040d3a3a1a920da87472 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 
 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]
diff --git a/NEWS b/NEWS
index 241f4b79f5788906057e8a441f746e3d9e53efff..43f02d9fd4f33e601b88e2e062d4d8d871f398e3 100644 (file)
--- 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.
 
 \f
 Version 2.15
index 6b05e5ba5dc4053ff3a592a746c936da91e2d79f..2b44f5e0bb15732abf020ec181e9e28dda3dc616 100644 (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
index cf0b1e559a8c4c0644ace1f33996cd0dfd8a8b02..7ca9bdf25fcafdf2b01080d972bbde755a4f8108 100644 (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;
index 8608083adbe65c530a0d8ac3bbf547d85586b678..300e879b8cfba94443e2fb8308a6aac018a71603 100644 (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*
index 754743f76798658fbcbd74252d27b6a738708381..55886662bc1d7e63412b202cd6dfc7c13dd6eac4 100644 (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__));