diff options
author | Martin Liska <mliska@suse.cz> | 2020-09-01 14:14:45 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2020-09-21 10:09:26 +0200 |
commit | 432c551b17d655823a4825855b4b966441c8cfb3 (patch) | |
tree | 3959fd2a8a6da15120a7334e5ca542e4aa0e568e /gcc | |
parent | 11da31998af6d7b7d4d6fcd3f705c17d69baf58b (diff) | |
download | gcc-432c551b17d655823a4825855b4b966441c8cfb3.zip gcc-432c551b17d655823a4825855b4b966441c8cfb3.tar.gz gcc-432c551b17d655823a4825855b4b966441c8cfb3.tar.bz2 |
Support new mallinfo2 function.
gcc/ChangeLog:
* config.in: Regenerate.
* configure: Likewise.
* configure.ac: Detect for mallinfo2.
* ggc-common.c (defined): Use it.
* system.h: Handle also HAVE_MALLINFO2.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config.in | 16 | ||||
-rwxr-xr-x | gcc/configure | 4 | ||||
-rw-r--r-- | gcc/configure.ac | 4 | ||||
-rw-r--r-- | gcc/ggc-common.c | 12 | ||||
-rw-r--r-- | gcc/system.h | 2 |
5 files changed, 28 insertions, 10 deletions
diff --git a/gcc/config.in b/gcc/config.in index 478e74f..1832c11 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -983,13 +983,19 @@ #endif -/* Define to 1 if we found a declaration for 'mallinfo', otherwise define to - 0. */ +/* Define to 1 if we found a declaration for 'mallinfo */ #ifndef USED_FOR_TARGET #undef HAVE_DECL_MALLINFO #endif +/* Define to 1 if we found a declaration for 'mallinfo2', otherwise define to + 0. */ +#ifndef USED_FOR_TARGET +#undef HAVE_DECL_MALLINFO2 +#endif + + /* Define to 1 if we found a declaration for 'malloc', otherwise define to 0. */ #ifndef USED_FOR_TARGET @@ -1665,6 +1671,12 @@ #endif +/* Define to 1 if you have the `mallinfo2' function. */ +#ifndef USED_FOR_TARGET +#undef HAVE_MALLINFO2 +#endif + + /* Define to 1 if you have the <malloc.h> header file. */ #ifndef USED_FOR_TARGET #undef HAVE_MALLOC_H diff --git a/gcc/configure b/gcc/configure index 0a09777..d33ee9f 100755 --- a/gcc/configure +++ b/gcc/configure @@ -10120,7 +10120,7 @@ fi for ac_func in times clock kill getrlimit setrlimit atoq \ popen sysconf strsignal getrusage nl_langinfo \ gettimeofday mbstowcs wcswidth mmap setlocale \ - clearerr_unlocked feof_unlocked ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked putchar_unlocked putc_unlocked madvise mallinfo + clearerr_unlocked feof_unlocked ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked putchar_unlocked putc_unlocked madvise mallinfo mallinfo2 do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -11549,7 +11549,7 @@ fi done -for ac_func in mallinfo +for ac_func in mallinfo, mallinfo2 do ac_tr_decl=`$as_echo "HAVE_DECL_$ac_func" | $as_tr_cpp` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_func is declared" >&5 diff --git a/gcc/configure.ac b/gcc/configure.ac index 6a233a3c..fedb7b2 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -1408,7 +1408,7 @@ define(gcc_UNLOCKED_FUNCS, clearerr_unlocked feof_unlocked dnl AC_CHECK_FUNCS(times clock kill getrlimit setrlimit atoq \ popen sysconf strsignal getrusage nl_langinfo \ gettimeofday mbstowcs wcswidth mmap setlocale \ - gcc_UNLOCKED_FUNCS madvise mallinfo) + gcc_UNLOCKED_FUNCS madvise mallinfo mallinfo2) if test x$ac_cv_func_mbstowcs = xyes; then AC_CACHE_CHECK(whether mbstowcs works, gcc_cv_func_mbstowcs_works, @@ -1488,7 +1488,7 @@ gcc_AC_CHECK_DECLS(getrlimit setrlimit getrusage, , ,[ #endif ]) -gcc_AC_CHECK_DECLS(mallinfo, , ,[ +gcc_AC_CHECK_DECLS([mallinfo, mallinfo2], , ,[ #include "ansidecl.h" #include "system.h" #ifdef HAVE_MALLOC_H diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c index 94da02f..6f8da30 100644 --- a/gcc/ggc-common.c +++ b/gcc/ggc-common.c @@ -1008,13 +1008,19 @@ ggc_prune_overhead_list (void) } } -/* Return memory used by heap in kb, 0 if this info is not available. */ +/* Print memory used by heap in kb if this info is available. */ void report_heap_memory_use () { -#ifdef HAVE_MALLINFO +#if defined(HAVE_MALLINFO) || defined(HAVE_MALLINFO2) +#ifdef HAVE_MALLINFO2 + #define MALLINFO_FN mallinfo2 +#else + #define MALLINFO_FN mallinfo +#endif if (!quiet_flag) - fprintf (stderr," {heap %luk}", (unsigned long)(mallinfo().arena / 1024)); + fprintf (stderr," {heap %luk}", + (unsigned long) MALLINFO_FN ().arena / ONE_K); #endif } diff --git a/gcc/system.h b/gcc/system.h index 3c543a0..4f0482b 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -732,7 +732,7 @@ extern int vsnprintf (char *, size_t, const char *, va_list); #endif #ifdef INCLUDE_MALLOC_H -#ifdef HAVE_MALLINFO +#if defined(HAVE_MALLINFO) || defined(HAVE_MALLINFO2) #include <malloc.h> #endif #endif |