mirror of
https://github.com/Z3Prover/z3
synced 2025-07-29 15:37:58 +00:00
Add cmake option for malloc_usable_size.
This commit is contained in:
parent
a3f35b6830
commit
77724bf7e0
2 changed files with 14 additions and 5 deletions
|
@ -207,6 +207,17 @@ list(APPEND Z3_COMPONENT_EXTRA_INCLUDE_DIRS
|
||||||
"${PROJECT_SOURCE_DIR}/src"
|
"${PROJECT_SOURCE_DIR}/src"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# malloc_usable_size()
|
||||||
|
################################################################################
|
||||||
|
option(Z3_USE_MALLOC_USABLE_SIZE "Use malloc_usable_size (or equivalents like malloc_size or _msize)" ON)
|
||||||
|
if (Z3_USE_MALLOC_USABLE_SIZE)
|
||||||
|
message(STATUS "Using malloc_usable_size")
|
||||||
|
list(APPEND Z3_COMPONENT_CXX_DEFINES "-DHAS_MALLOC_USABLE_SIZE")
|
||||||
|
else()
|
||||||
|
message(STATUS "Not using malloc_usable_size")
|
||||||
|
endif()
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# GNU multiple precision library support
|
# GNU multiple precision library support
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
|
@ -13,19 +13,17 @@ Copyright (c) 2015 Microsoft Corporation
|
||||||
#include "util/error_codes.h"
|
#include "util/error_codes.h"
|
||||||
#include "util/debug.h"
|
#include "util/debug.h"
|
||||||
#include "util/scoped_timer.h"
|
#include "util/scoped_timer.h"
|
||||||
#ifdef __GLIBC__
|
#ifndef HAS_MALLOC_USABLE_SIZE
|
||||||
|
// drop calls to malloc_usable_size
|
||||||
|
#elif defined(__GLIBC__)
|
||||||
# include <malloc.h>
|
# include <malloc.h>
|
||||||
# define HAS_MALLOC_USABLE_SIZE
|
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
# include <malloc/malloc.h>
|
# include <malloc/malloc.h>
|
||||||
# define HAS_MALLOC_USABLE_SIZE
|
|
||||||
# define malloc_usable_size malloc_size
|
# define malloc_usable_size malloc_size
|
||||||
#elif defined(__FreeBSD__)
|
#elif defined(__FreeBSD__)
|
||||||
# include <malloc_np.h>
|
# include <malloc_np.h>
|
||||||
# define HAS_MALLOC_USABLE_SIZE
|
|
||||||
#elif defined(_WINDOWS)
|
#elif defined(_WINDOWS)
|
||||||
# include <malloc.h>
|
# include <malloc.h>
|
||||||
# define HAS_MALLOC_USABLE_SIZE
|
|
||||||
# define malloc_usable_size _msize
|
# define malloc_usable_size _msize
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue