diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2021-01-11 12:03:38 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2021-02-09 16:57:54 -0300 |
commit | de0e1b45b0aba18ce50de40e42028af2c50e335c (patch) | |
tree | f664f8441cd9d2a9eb696265951ca3d01e7a5bd3 /malloc/tst-dynarray.c | |
parent | c8ba52ab3350c334d6e34b1439a4c0c1431351f3 (diff) | |
download | glibc-de0e1b45b0aba18ce50de40e42028af2c50e335c.tar.gz glibc-de0e1b45b0aba18ce50de40e42028af2c50e335c.tar.xz glibc-de0e1b45b0aba18ce50de40e42028af2c50e335c.zip |
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.
Diffstat (limited to 'malloc/tst-dynarray.c')
-rw-r--r-- | malloc/tst-dynarray.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/malloc/tst-dynarray.c b/malloc/tst-dynarray.c index 6c6437b12a..c33505711f 100644 --- a/malloc/tst-dynarray.c +++ b/malloc/tst-dynarray.c @@ -110,10 +110,10 @@ test_int (void) TEST_VERIFY_EXIT (!dynarray_int_has_failed (&dyn)); TEST_VERIFY_EXIT (dynarray_int_size (&dyn) == i + 1); TEST_VERIFY_EXIT (dynarray_int_size (&dyn) - <= dyn.dynarray_header.allocated); + <= dyn.u.dynarray_header.allocated); } TEST_VERIFY_EXIT (dynarray_int_size (&dyn) == count); - TEST_VERIFY_EXIT (count <= dyn.dynarray_header.allocated); + TEST_VERIFY_EXIT (count <= dyn.u.dynarray_header.allocated); if (count > 0) { TEST_VERIFY (dynarray_int_begin (&dyn) @@ -122,7 +122,7 @@ test_int (void) == dynarray_int_at (&dyn, count - 1) + 1); } unsigned final_count; - bool heap_array = dyn.dynarray_header.array != dyn.scratch; + bool heap_array = dyn.u.dynarray_header.array != dyn.scratch; if (do_remove_last) { dynarray_int_remove_last (&dyn); @@ -146,10 +146,11 @@ test_int (void) final_count = 0; } TEST_VERIFY_EXIT (!dynarray_int_has_failed (&dyn)); - TEST_VERIFY_EXIT ((dyn.dynarray_header.array != dyn.scratch) + TEST_VERIFY_EXIT ((dyn.u.dynarray_header.array != dyn.scratch) == heap_array); TEST_VERIFY_EXIT (dynarray_int_size (&dyn) == final_count); - TEST_VERIFY_EXIT (dyn.dynarray_header.allocated >= final_count); + TEST_VERIFY_EXIT (dyn.u.dynarray_header.allocated + >= final_count); if (!do_clear) for (unsigned int i = 0; i < final_count; ++i) TEST_VERIFY_EXIT (*dynarray_int_at (&dyn, i) == base + i); @@ -238,10 +239,10 @@ test_str (void) TEST_VERIFY_EXIT (!dynarray_str_has_failed (&dyn)); TEST_VERIFY_EXIT (dynarray_str_size (&dyn) == i + 1); TEST_VERIFY_EXIT (dynarray_str_size (&dyn) - <= dyn.dynarray_header.allocated); + <= dyn.u.dynarray_header.allocated); } TEST_VERIFY_EXIT (dynarray_str_size (&dyn) == count); - TEST_VERIFY_EXIT (count <= dyn.dynarray_header.allocated); + TEST_VERIFY_EXIT (count <= dyn.u.dynarray_header.allocated); if (count > 0) { TEST_VERIFY (dynarray_str_begin (&dyn) @@ -250,7 +251,7 @@ test_str (void) == dynarray_str_at (&dyn, count - 1) + 1); } unsigned final_count; - bool heap_array = dyn.dynarray_header.array != dyn.scratch; + bool heap_array = dyn.u.dynarray_header.array != dyn.scratch; if (do_remove_last) { dynarray_str_remove_last (&dyn); @@ -274,10 +275,11 @@ test_str (void) final_count = 0; } 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) == heap_array); TEST_VERIFY_EXIT (dynarray_str_size (&dyn) == final_count); - TEST_VERIFY_EXIT (dyn.dynarray_header.allocated >= final_count); + TEST_VERIFY_EXIT (dyn.u.dynarray_header.allocated + >= final_count); if (!do_clear) for (unsigned int i = 0; i < count - do_remove_last; ++i) { |