[LLVMdev] [PATCH] Enable malloc_zone_statistics() in Mac OS X (cmake)

Jjgod Jiang gzjjgod at gmail.com
Tue Nov 11 23:01:32 PST 2008

For Mac OS X, we have malloc_zone_statistics() defined
<malloc/malloc.h>, however, if we don't define
HAVE_MALLOC_ZONE_STATISTICS, that function won't be used
and we will get warnings like:

lib/System/Unix/Process.inc:68:2: warning: #warning Cannot get
malloc info on this platform

This patch enables this function in cmake build.
 cmake/config-ix.cmake              |    1 +
 include/llvm/Config/config.h.cmake |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index b8be58e..1f178c7 100755
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -49,6 +49,7 @@ check_symbol_exists(isnan math.h HAVE_ISNAN_IN_MATH_H)
 check_symbol_exists(ceilf math.h HAVE_CEILF)
 check_symbol_exists(floorf math.h HAVE_FLOORF)
 check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO)
+check_symbol_exists(malloc_zone_statistics malloc/malloc.h HAVE_MALLOC_ZONE_STATISTICS)
 check_symbol_exists(pthread_mutex_lock pthread.h HAVE_PTHREAD_MUTEX_LOCK)
 check_symbol_exists(strtoll stdlib.h HAVE_STRTOLL)
diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake
index e5f908a..8709518 100644
--- a/include/llvm/Config/config.h.cmake
+++ b/include/llvm/Config/config.h.cmake
@@ -231,7 +231,7 @@
 /* Define to 1 if you have the `malloc_zone_statistics' function. */
 /* Define to 1 if you have the `memcpy' function. */

More information about the llvm-dev mailing list