[PATCH] D59249: [llvm] [Support] mallctl() is in malloc.h on NetBSD

Kamil Rytarowski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 12 10:32:59 PDT 2019


krytarowski added inline comments.


================
Comment at: llvm/cmake/config-ix.cmake:32
 check_include_file(malloc/malloc.h HAVE_MALLOC_MALLOC_H)
+check_include_file(malloc_np.h HAVE_MALLOC_NP_H)
 if( NOT PURE_WINDOWS )
----------------
Please add another check for `malloc.h`


================
Comment at: llvm/lib/Support/Unix/Process.inc:39
 #if defined(HAVE_MALLCTL)
-#include <malloc_np.h>
+#  if defined(HAVE_MALLOC_NP_H)
+#    include <malloc_np.h>
----------------
I really prefer:

```
#if defined(HAVE_MALLOC_H)
#include <malloc.h>
#endif
#if defined(HAVE_MALLOC_NP_H)
#include <malloc_np.h>
#endif
```

And use conditionals for MALLINFO/MALLCTL in code using the APIs.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59249/new/

https://reviews.llvm.org/D59249





More information about the llvm-commits mailing list