]> Savannah Git Hosting - gnulib.git/commitdiff
thread: Avoid compiler warnings on Solaris.
authorBruno Haible <bruno@clisp.org>
Sun, 25 Jun 2023 18:18:41 +0000 (20:18 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 25 Jun 2023 18:18:41 +0000 (20:18 +0200)
* lib/glthread/thread.h: Include <stdint.h>.
(gl_thread_self_pointer): Do the cast from pthread_t to 'void *' via
intptr_t.
* modules/thread (Depends-on): Add stdint.

ChangeLog
lib/glthread/thread.h
modules/thread

index dfbdf209dcaece4df688c305dafa0c1e84b5fd18..55d348d3c35464c7713491faf741bfef72e935d7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-06-25  Bruno Haible  <bruno@clisp.org>
+
+       thread: Avoid compiler warnings on Solaris.
+       * lib/glthread/thread.h: Include <stdint.h>.
+       (gl_thread_self_pointer): Do the cast from pthread_t to 'void *' via
+       intptr_t.
+       * modules/thread (Depends-on): Add stdint.
+
 2023-06-25  Bruno Haible  <bruno@clisp.org>
 
        strerrorname_np: Add support for Solaris 11.4/sparc.
index 88bc53ee7f2618ef224d14a28951137350bdd135..942ce70b5c6e2732216bb077014de07401355054 100644 (file)
@@ -130,6 +130,9 @@ extern _Noreturn void gl_thread_exit (void *return_value);
 
 # include <pthread.h>
 
+/* Get intptr_t.  */
+# include <stdint.h>
+
 /* On IRIX, pthread_atfork is declared in <unistd.h>, not in <pthread.h>.  */
 # if defined __sgi
 #  include <unistd.h>
@@ -233,7 +236,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_t) pthread_self () : NULL)
+     (pthread_in_use () ? (void *) (intptr_t) (pthread_t) pthread_self () : NULL)
 # endif
 # define gl_thread_exit(RETVAL) \
     (void) (pthread_in_use () ? (pthread_exit (RETVAL), 0) : 0)
index 1d530b0d3afbe5ea00edb9aa9f863463309094fd..f416807b636a94a2f6495f0f59f67bb2cd3666be 100644 (file)
@@ -8,6 +8,7 @@ m4/thread.m4
 
 Depends-on:
 threadlib
+stdint
 extern-inline
 lock
 windows-thread  [test $gl_threads_api = windows]