1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-17 13:01:12 +03:00

malloc: Sync dynarray with gnulib

It syncs with gnulib version a8bac4d49.  The main changes are:

  - Remove the usage of anonymous union within DYNARRAY_STRUCT.
  - Use DYNARRAY_FREE instead of DYNARRAY_NAME (free) so that
    Gnulib does not change 'free' to 'rpl_free'.
  - Use __nonnull instead of __attribute__ ((nonnull ())).
  - Use __attribute_maybe_unused__ instead of
    __attribute__ ((unused, nonnull (1))).
  - Use of _Noreturn instead of _attribute__ ((noreturn)).

The only difference with gnulib is:

--- glibc
+++ gnulib
@@ -18,6 +18,7 @@

 #include <dynarray.h>
 #include <stdio.h>
+#include <stdlib.h>

 void
 __libc_dynarray_at_failure (size_t size, size_t index)
@@ -27,7 +28,6 @@
   __snprintf (buf, sizeof (buf), "Fatal glibc error: "
               "array index %zu not less than array length %zu\n",
               index, size);
- __libc_fatal (buf);
 #else
  abort ();
 #endif

It seems a wrong sync from gnulib (the code is used on loader and
thus it requires __libc_fatal instead of abort).

Checked on x86_64-linux-gnu.
This commit is contained in:
Adhemerval Zanella
2021-01-11 12:03:38 -03:00
parent c8ba52ab33
commit de0e1b45b0
9 changed files with 95 additions and 84 deletions

View File

@@ -249,9 +249,9 @@ test_str_fail (void)
else
dynarray_str_free (&dyn);
TEST_VERIFY_EXIT (!dynarray_str_has_failed (&dyn));
TEST_VERIFY_EXIT (dyn.dynarray_header.array == dyn.scratch);
TEST_VERIFY_EXIT (dyn.u.dynarray_header.array == dyn.scratch);
TEST_VERIFY_EXIT (dynarray_str_size (&dyn) == 0);
TEST_VERIFY_EXIT (dyn.dynarray_header.allocated > 0);
TEST_VERIFY_EXIT (dyn.u.dynarray_header.allocated > 0);
}
/* Exercise failure in finalize. */
@@ -278,9 +278,9 @@ test_str_fail (void)
TEST_VERIFY_EXIT (result.array == (char **) (uintptr_t) -1);
TEST_VERIFY_EXIT (result.length == (size_t) -1);
TEST_VERIFY_EXIT (!dynarray_str_has_failed (&dyn));
TEST_VERIFY_EXIT (dyn.dynarray_header.array == dyn.scratch);
TEST_VERIFY_EXIT (dyn.u.dynarray_header.array == dyn.scratch);
TEST_VERIFY_EXIT (dynarray_str_size (&dyn) == 0);
TEST_VERIFY_EXIT (dyn.dynarray_header.allocated > 0);
TEST_VERIFY_EXIT (dyn.u.dynarray_header.allocated > 0);
free_fill_heap (heap_filler);
}