bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] windows-thread: set return type of glwthread_thread_exit to


From: Bruno Haible
Subject: Re: [PATCH] windows-thread: set return type of glwthread_thread_exit to void
Date: Wed, 17 Jun 2020 01:59:58 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-179-generic; KDE/5.18.0; x86_64; ; )

I added two more changes that should help avoid warnings.


2020-06-16  Bruno Haible  <bruno@clisp.org>

        thread, thrd: Avoid a compiler warning.
        * lib/windows-thread.h (glwthread_thread_exit): Mark as non-returning.

diff --git a/lib/windows-thread.h b/lib/windows-thread.h
index 9633874..90da7bd 100644
--- a/lib/windows-thread.h
+++ b/lib/windows-thread.h
@@ -46,7 +46,7 @@ extern int glwthread_thread_create (glwthread_thread_t 
*threadp,
 extern int glwthread_thread_join (glwthread_thread_t thread, void **retvalp);
 extern int glwthread_thread_detach (glwthread_thread_t thread);
 extern glwthread_thread_t glwthread_thread_self (void);
-extern void glwthread_thread_exit (void *retval);
+extern _Noreturn void glwthread_thread_exit (void *retval);
 
 #ifdef __cplusplus
 }


2020-06-16  Bruno Haible  <bruno@clisp.org>

        thread: Avoid possible compiler warnings in uses of gl_thread_exit.
        * lib/glthread/thread.h (gl_thread_exit): Add a cast to void.

diff --git a/lib/glthread/thread.h b/lib/glthread/thread.h
index 99a5074..4077b45 100644
--- a/lib/glthread/thread.h
+++ b/lib/glthread/thread.h
@@ -237,7 +237,7 @@ extern const gl_thread_t gl_null_thread;
      (pthread_in_use () ? (void *) pthread_self () : NULL)
 # endif
 # define gl_thread_exit(RETVAL) \
-    (pthread_in_use () ? pthread_exit (RETVAL) : 0)
+    (void) (pthread_in_use () ? (pthread_exit (RETVAL), 0) : 0)
 
 # if HAVE_PTHREAD_ATFORK
 #  define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) \
@@ -301,7 +301,7 @@ typedef int gl_thread_t;
 # define gl_thread_self() 0
 # define gl_thread_self_pointer() \
     ((void *) gl_thread_self ())
-# define gl_thread_exit(RETVAL) 0
+# define gl_thread_exit(RETVAL) (void)0
 # define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0
 
 #endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]