Fix the build with GCC and libc cleanup. (#341)

GCC is a lot more picky about extern "C" definitions in namespaces than
clang and so the `friend` declaration wasn't picked up by the version of
the function declared in the `snmalloc` namespace.  Move it out to where
GCC is happy with it.
This commit is contained in:
David Chisnall
2021-07-01 11:07:31 +01:00
committed by GitHub
parent 18d7cc99b6
commit b598add0d1

View File

@@ -254,14 +254,6 @@ namespace snmalloc
};
# ifdef SNMALLOC_USE_THREAD_CLEANUP
/**
* Entry point that allows libc to call into the allocator for per-thread
* cleanup.
*/
extern "C" void _malloc_thread_cleanup()
{
ThreadAllocLibcCleanup::inner_release();
}
using ThreadAlloc = ThreadAllocLibcCleanup;
# else
using ThreadAlloc = ThreadAllocThreadDestructor;
@@ -306,3 +298,13 @@ namespace snmalloc
}
#endif
} // namespace snmalloc
#ifdef SNMALLOC_USE_THREAD_CLEANUP
/**
* Entry point that allows libc to call into the allocator for per-thread
* cleanup.
*/
void _malloc_thread_cleanup()
{
snmalloc::ThreadAllocLibcCleanup::inner_release();
}
#endif