Using clang16 without this patch, building the libpas allocator results in the following error:
/home/atn/mimalloc-bench/extern/lp/Source/bmalloc/libpas/src/libpas/pas_thread_local_cache.c:218:22: error: call to undeclared function 'pthread_getname_np'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
getname_result = pthread_getname_np(thread, thread_name, sizeof(thread_name));
Using clang16 without this patch, building the
libpas
allocator results in the following error:The
-Wimplicit-function-declaration
warning now defaults to an error in C99, C11 and C17 (https://github.com/llvm/llvm-project/blob/release/16.x/clang/docs/ReleaseNotes.rst#potentially-breaking-changes). As this function is a nonstandard GNU extension, defining the_GNU_SOURCE
symbol fixes the implicit declaration. This fix likely isn't the best way, I found https://github.com/WebKit/WebKit/pull/1309/commits which is a proper upstream fix, but I don't get why this was (afaik) not merged.