]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
thread: better nonreturn fix for gl_thread_create
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 25 Apr 2026 22:15:48 +0000 (15:15 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 25 Apr 2026 22:39:32 +0000 (15:39 -0700)
* 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”.

ChangeLog
lib/glthread/thread.c

index 336120bfe6f191736dc312205e54cc767624ef13..eac1bbe2816b561cb2ea2e6f6d1f98c5aa8543b5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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 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
index f08a28c0daccd4de6216d059f77813885931d546..261806c74b42f9c458ce5a8996bfaa2de72a9de8 100644 (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