fix about stopping using the deprecated mallinfo function

This commit is contained in:
xia_qirong 2021-05-24 19:14:44 +08:00
parent ea6027258e
commit 96895db3dd
2 changed files with 68 additions and 1 deletions

View File

@ -0,0 +1,59 @@
From 66d12e4790b7c5e508b75e805589849fee782a49 Mon Sep 17 00:00:00 2001
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Date: Tue, 2 Feb 2021 09:38:46 -0300
Subject: [PATCH] dtagnames: Stop using the deprecated mallinfo() function
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Bulding on fedora rawhide gets us:
/home/acme/git/pahole/dtagnames.c:17:16: error: mallinfo is deprecated [-Werror=deprecated-declarations]
17 | struct mallinfo m = mallinfo();
| ^~~~~~~~
In file included from /home/acme/git/pahole/dtagnames.c:10:
/usr/include/malloc.h:118:24: note: declared here
118 | extern struct mallinfo mallinfo (void) __THROW __MALLOC_DEPRECATED;
| ^~~~~~~~
cc1: all warnings being treated as errors
glibc-2.32.9000-26.fc34.x86_64
So stop using it, was just for debugging/assessing memory usage.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
dtagnames.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/dtagnames.c b/dtagnames.c
index 0ffcbf7..6a24c37 100644
--- a/dtagnames.c
+++ b/dtagnames.c
@@ -7,18 +7,10 @@
#include <stdio.h>
#include <stdlib.h>
-#include <malloc.h>
#include "dwarves.h"
#include "dutil.h"
-static void print_malloc_stats(void)
-{
- struct mallinfo m = mallinfo();
-
- fprintf(stderr, "size: %u\n", m.uordblks);
-}
-
static int class__tag_name(struct tag *tag, struct cu *cu __unused,
void *cookie __unused)
{
@@ -54,7 +46,6 @@ int main(int argc __unused, char *argv[])
}
cus__dump_class_tag_names(cus);
- print_malloc_stats();
rc = EXIT_SUCCESS;
out:
cus__delete(cus);

View File

@ -4,7 +4,7 @@
Name: dwarves Name: dwarves
Version: 1.17 Version: 1.17
Release: 1 Release: 2
License: GPLv2 License: GPLv2
Summary: Debugging Information Manipulation Tools Summary: Debugging Information Manipulation Tools
URL: http://acmel.wordpress.com URL: http://acmel.wordpress.com
@ -16,6 +16,8 @@ BuildRequires: cmake
BuildRequires: zlib-devel BuildRequires: zlib-devel
BuildRequires: elfutils-devel >= 0.170 BuildRequires: elfutils-devel >= 0.170
Patch6000: dtagnames-stop-using-the-deprecated-mallinfo-function.patch
%description %description
dwarves is a set of tools that use the debugging information inserted in dwarves is a set of tools that use the debugging information inserted in
ELF binaries by compilers such as GCC, used by well known debuggers such as ELF binaries by compilers such as GCC, used by well known debuggers such as
@ -78,6 +80,12 @@ make install DESTDIR=%{buildroot}
%{_libdir}/%{libname}_reorganize.so %{_libdir}/%{libname}_reorganize.so
%changelog %changelog
* Mon May 24 2021 xiaqirong <xiaqirong1@huawei.com> - 1.17-2
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:bugfix about stopping using the deprecated mallinfo function
* Wed Sep 16 2020 xiaqirong <xiaqirong1@huawei.com> - 1.17-1 * Wed Sep 16 2020 xiaqirong <xiaqirong1@huawei.com> - 1.17-1
- Type:package init - Type:package init
- ID:NA - ID:NA