Fix still non getentropy platform builds

This commit is contained in:
David Carlier
2021-05-30 00:12:47 +01:00
committed by Matthew Parkinson
parent aefd149f0a
commit 9e88691ce6
2 changed files with 6 additions and 11 deletions

View File

@@ -177,9 +177,7 @@ if(USE_POSIX_COMMIT_CHECKS)
endif()
if(SNMALLOC_PLATFORM_HAS_GETENTROPY)
target_compile_definitions(snmalloc_lib INTERFACE -DSNMALLOC_PLATFORM_HAS_GETENTROPY=Entropy)
else()
target_compile_definitions(snmalloc_lib INTERFACE -DSNMALLOC_PLATFORM_HAS_GETENTROPY=0)
target_compile_definitions(snmalloc_lib INTERFACE -DSNMALLOC_PLATFORM_HAS_GETENTROPY)
endif()
if(CONST_QUALIFIED_MALLOC_USABLE_SIZE)

View File

@@ -19,12 +19,6 @@
# include <unistd.h>
#endif
// default value for builds not using CMake
#ifndef SNMALLOC_PLATFORM_HAS_GETENTROPY
# define SNMALLOC_PLATFORM_HAS_GETENTROPY 0
# warning snmalloc not using entropy source. To silence this warning please define SNMALLOC_PLATFORM_HAS_GETENTROPY to 0, or to Entropy if your platform implements getentropy().
#endif
extern "C" int puts(const char* str);
namespace snmalloc
@@ -126,8 +120,11 @@ namespace snmalloc
* POSIX systems are assumed to support lazy commit. The build system checks
* getentropy is available, only then this PAL supports Entropy.
*/
static constexpr uint64_t pal_features =
LazyCommit | SNMALLOC_PLATFORM_HAS_GETENTROPY;
static constexpr uint64_t pal_features = LazyCommit
#if defined(SNMALLOC_PLATFORM_HAS_GETENTROPY)
| Entropy
#endif
;
static constexpr size_t page_size = Aal::smallest_page_size;