From 3a7f96db56cc9821055cbc769d3065db86b8b4c9 Mon Sep 17 00:00:00 2001 From: Julien Voisin Date: Mon, 7 Feb 2022 07:56:15 +0100 Subject: [PATCH] mallinfo is only defined on glibc and android (#764) It currently prevents compilation under musl: ``` [ 90%] Building CXX object src/tbbmalloc_proxy/CMakeFiles/tbbmalloc_proxy.dir/proxy.cpp.o /__w/mimalloc-bench/mimalloc-bench/extern/tbb/src/tbbmalloc_proxy/proxy.cpp:263:26: error: return type 'struct mallinfo' is incomplete 263 | struct mallinfo mallinfo() __THROW | ^ compilation terminated due to -Wfatal-errors. `` --- src/tbbmalloc_proxy/proxy.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tbbmalloc_proxy/proxy.cpp b/src/tbbmalloc_proxy/proxy.cpp index e58e55e0b8..23b9c19c1c 100644 --- a/src/tbbmalloc_proxy/proxy.cpp +++ b/src/tbbmalloc_proxy/proxy.cpp @@ -260,6 +260,7 @@ int mallopt(int /*param*/, int /*value*/) __THROW return 1; } +#if defined(__GLIBC__) || defined(__ANDROID__) struct mallinfo mallinfo() __THROW { struct mallinfo m; @@ -267,6 +268,7 @@ struct mallinfo mallinfo() __THROW return m; } +#endif #if __ANDROID__ // Android doesn't have malloc_usable_size, provide it to be compatible