]> Savannah Git Hosting - gnulib.git/commitdiff
thread: pacify gcc -Wbad-function-cast
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 30 Oct 2022 19:39:08 +0000 (12:39 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 30 Oct 2022 20:25:42 +0000 (13:25 -0700)
* lib/glthread/thread.h (gl_thread_self_pointer): With POSIX
threads, cast the call to gl_thread_t before casting to void *.

ChangeLog
lib/glthread/thread.h

index 159bb007ca6e1025276d08bb309b34554e4b721c..634aa8797fd3bc598745d49301dba7697fce1cae 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2022-10-30  Paul Eggert  <eggert@cs.ucla.edu>
 
+       thread: pacify gcc -Wbad-function-cast
+       * lib/glthread/thread.h (gl_thread_self_pointer): With POSIX
+       threads, cast the call to gl_thread_t before casting to void *.
+
        test-getlogin: pacify gcc -Wshadow
        * tests/test-getlogin.h (test_getlogin_result): Rename local.
 
index 6d98f2d6aca568345becb51b79d399d0fda6f20d..bb60d8a0fbde7f5b27ae84331804da6e53275d62 100644 (file)
@@ -228,7 +228,7 @@ extern const gl_thread_t gl_null_thread;
 #  define gl_thread_self() \
      (pthread_in_use () ? pthread_self () : (pthread_t) 0)
 #  define gl_thread_self_pointer() \
-     (pthread_in_use () ? (void *) pthread_self () : NULL)
+     (pthread_in_use () ? (void *) (pthread_t) pthread_self () : NULL)
 # endif
 # define gl_thread_exit(RETVAL) \
     (void) (pthread_in_use () ? (pthread_exit (RETVAL), 0) : 0)