]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
malloc: Fix mallinfo deprecation declaration
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 31 Aug 2020 14:14:01 +0000 (11:14 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 31 Aug 2020 17:22:06 +0000 (14:22 -0300)
It fixes the build issue below introduced by e3960d1c57e57 (Add
mallinfo2  function that support sizes >= 4GB).  It moves the
__MALLOC_DEPRECATED to the usual place for function attributes:

  In file included from ../include/malloc.h:3,
                   from ../sysdeps/x86_64/multiarch/../../../test-skeleton.c:31,
                   from ../sysdeps/x86_64/multiarch/test-multiarch.c:96:
  ../malloc/malloc.h:118:1: error: empty declaration [-Werror]
    118 | __MALLOC_DEPRECATED;

It also adds the required deprecated warning suppression on the tests.

Checked on x86_64-linux-gnu.

malloc/malloc.h
malloc/tst-malloc-tcache-leak.c
malloc/tst-mxfast.c

index e25b33462a4da5151bab7f77f9338173a226bcb5..b2371f7704116171c04821f3675e60a058516c17 100644 (file)
@@ -115,8 +115,7 @@ struct mallinfo2
 };
 
 /* Returns a copy of the updated current mallinfo. */
-__MALLOC_DEPRECATED;
-extern struct mallinfo mallinfo (void) __THROW;
+extern struct mallinfo mallinfo (void) __THROW __MALLOC_DEPRECATED;
 
 /* Returns a copy of the updated current mallinfo. */
 extern struct mallinfo2 mallinfo2 (void) __THROW;
index f6f6023b5a3b516cab0bf073f9c2ee094a535293..2a7a0646c50cdfeec454a5db48a38f6a2e737cb6 100644 (file)
@@ -29,6 +29,7 @@
 #include <malloc.h>
 #include <pthread.h>
 #include <assert.h>
+#include <libc-diag.h>
 
 #include <support/check.h>
 #include <support/support.h>
@@ -72,6 +73,10 @@ do_test (void)
      pthread_t required to run the test.  */
   thread = (pthread_t *) xcalloc (1, sizeof (pthread_t));
 
+  /* The test below covers the deprecated mallinfo function.  */
+  DIAG_PUSH_NEEDS_COMMENT;
+  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations");
+
   info_before = mallinfo ();
 
   assert (info_before.uordblks != 0);
@@ -104,6 +109,8 @@ do_test (void)
   if (info_after.uordblks > (info_before.uordblks + threads))
     FAIL_EXIT1 ("Memory usage after threads is too high.\n");
 
+  DIAG_POP_NEEDS_COMMENT;
+
   /* Did not detect excessive memory usage.  */
   free (thread);
   exit (0);
index 57b4a0a8dccc9a1958e11c1f718c11e766150d48..8afee0f9d55deed1869454579223a4682646f85f 100644 (file)
@@ -21,6 +21,7 @@
    the fast bins.  */
 
 #include <malloc.h>
+#include <libc-diag.h>
 #include <support/check.h>
 
 int
@@ -36,8 +37,14 @@ do_test (void)
   p2 = malloc (512);
   free (p1);
 
+  /* The test below covers the deprecated mallinfo function.  */
+  DIAG_PUSH_NEEDS_COMMENT;
+  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations");
+
   m = mallinfo ();
 
+  DIAG_POP_NEEDS_COMMENT;
+
   /* This will fail if there are any blocks in the fastbins.  */
   TEST_COMPARE (m.smblks, 0);