diff options
author | Sam James <sam@gentoo.org> | 2022-09-13 19:37:59 +0100 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2022-09-15 20:45:42 +0300 |
commit | 4489757f1cc1fe4aa98d4c1ebbe0789b2b308e11 (patch) | |
tree | 0c2db842b736ebd346658677c6d8d8575e8efd66 /include | |
parent | afbb7e51cb286d899d48f67119f1dfa8e956715e (diff) | |
download | bdwgc-4489757f1cc1fe4aa98d4c1ebbe0789b2b308e11.tar.gz |
Fix 'call to undeclared pthread_setname_np' errors in configure and cmake
Issue #474 (bdwgc).
Clang 15 makes implicit function declarations an error by default
which leads to configure (and cmake script) falsely thinking
pthread_setname_np symbol is not present.
* CMakeLists.txt [CMAKE_USE_PTHREADS_INIT] (check_c_source_compiles):
Always define _GNU_SOURCE before include pthread.h (regardless of
__CYGWIN__, __linux__, __GLIBC__, __GNU__ macros).
* configure.ac [$THREADS==posix] (AC_COMPILE_IFELSE): Likewise.
* include/private/gc_priv.h [!_GNU_SOURCE
&& (HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID
|| HAVE_PTHREAD_SETNAME_NP_WITH_TID_AND_ARG
|| HAVE_PTHREAD_SETNAME_NP_WITH_TID)] (_GNU_SOURCE): Define.
Co-authored-by: Ivan Maidanski <ivmai@mail.ru>
Diffstat (limited to 'include')
-rw-r--r-- | include/private/gc_priv.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index 0743cd28..01970193 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -27,7 +27,9 @@ #endif #if (defined(__linux__) || defined(__GLIBC__) || defined(__GNU__) \ - || defined(__CYGWIN__)) && !defined(_GNU_SOURCE) + || defined(__CYGWIN__) || defined(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID) \ + || defined(HAVE_PTHREAD_SETNAME_NP_WITH_TID_AND_ARG) \ + || defined(HAVE_PTHREAD_SETNAME_NP_WITH_TID)) && !defined(_GNU_SOURCE) /* Can't test LINUX, since this must be defined before other includes. */ # define _GNU_SOURCE 1 #endif |