support building with --enable-gc=no

Some minor changes fixing the build without boehm.
Fixes NixOS#6250
This commit is contained in:
Rick van Schijndel 2022-12-12 23:31:30 +01:00
parent e408af82ab
commit 672ee88231

View file

@ -45,7 +45,7 @@ static char * allocString(size_t size)
#if HAVE_BOEHMGC #if HAVE_BOEHMGC
t = (char *) GC_MALLOC_ATOMIC(size); t = (char *) GC_MALLOC_ATOMIC(size);
#else #else
t = malloc(size); t = (char *) malloc(size);
#endif #endif
if (!t) throw std::bad_alloc(); if (!t) throw std::bad_alloc();
return t; return t;
@ -471,9 +471,6 @@ EvalState::EvalState(
#if HAVE_BOEHMGC #if HAVE_BOEHMGC
, valueAllocCache(std::allocate_shared<void *>(traceable_allocator<void *>(), nullptr)) , valueAllocCache(std::allocate_shared<void *>(traceable_allocator<void *>(), nullptr))
, env1AllocCache(std::allocate_shared<void *>(traceable_allocator<void *>(), nullptr)) , env1AllocCache(std::allocate_shared<void *>(traceable_allocator<void *>(), nullptr))
#else
, valueAllocCache(std::make_shared<void *>(nullptr))
, env1AllocCache(std::make_shared<void *>(nullptr))
#endif #endif
, baseEnv(allocEnv(128)) , baseEnv(allocEnv(128))
, staticBaseEnv{std::make_shared<StaticEnv>(false, nullptr)} , staticBaseEnv{std::make_shared<StaticEnv>(false, nullptr)}