From: Paul Eggert Date: Sat, 25 Apr 2026 22:15:48 +0000 (-0700) Subject: thread: better nonreturn fix for gl_thread_create X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c04d5cfcd3db5d36bba85e413f7ed40825249471;p=thirdparty%2Fgnulib.git thread: better nonreturn fix for gl_thread_create * lib/glthread/thread.c (gl_thread_create): Define as a function only if multithreading. This is cleaner than my previous patch today that sometimes made it _Noreturn, as the function’s definition and declaration now always agree on noreturnedness, and it pushes the noreturnedness issue up to the caller. Also, it suppresses GCC’s “warning: function declared 'noreturn' has a 'return' statement”. --- diff --git a/ChangeLog b/ChangeLog index 336120bfe6..eac1bbe281 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2026-04-25 Paul Eggert + thread: better nonreturn fix for gl_thread_create + * lib/glthread/thread.c (gl_thread_create): + Define as a function only if multithreading. + This is cleaner than my previous patch today that sometimes made + it _Noreturn, as the function’s definition and declaration now always + agree on noreturnedness, and it pushes the noreturnedness issue up + to the caller. Also, it suppresses GCC’s “warning: function + declared 'noreturn' has a 'return' statement”. + thread: pacify gcc -Wunused-value * lib/glthread/thread.h (glthread_atfork, glthread_sigmask) (glthread_create, glthread_join): Evaluate arguments even when diff --git a/lib/glthread/thread.c b/lib/glthread/thread.c index f08a28c0da..261806c74b 100644 --- a/lib/glthread/thread.c +++ b/lib/glthread/thread.c @@ -204,10 +204,8 @@ const gl_thread_t gl_null_thread /* = { .p = NULL } */; /* ========================================================================= */ -#if !(USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS \ - || USE_WINDOWS_THREADS) -_Noreturn -#endif +#if (USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS \ + || USE_WINDOWS_THREADS) gl_thread_t gl_thread_create (void *(*func) (void *arg), void *arg) { @@ -217,3 +215,4 @@ gl_thread_create (void *(*func) (void *arg), void *arg) abort (); return thread; } +#endif