1
0
mirror of https://https.git.savannah.gnu.org/git/gnulib.git synced 2026-04-28 06:33:36 +00:00

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”.
This commit is contained in:
Paul Eggert
2026-04-25 15:15:48 -07:00
parent 6bce2d2f70
commit c04d5cfcd3
2 changed files with 12 additions and 4 deletions

View File

@@ -1,5 +1,14 @@
2026-04-25 Paul Eggert <eggert@cs.ucla.edu>
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 functions definition and declaration now always
agree on noreturnedness, and it pushes the noreturnedness issue up
to the caller. Also, it suppresses GCCs “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

View File

@@ -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