From: Bruno Haible Date: Sun, 25 Jun 2023 18:18:41 +0000 (+0200) Subject: thread: Avoid compiler warnings on Solaris. X-Git-Tag: v1.0~1182 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=f4015ac6ea3e8170b16b905dcc6a508a915434f2;p=gnulib.git thread: Avoid compiler warnings on Solaris. * lib/glthread/thread.h: Include . (gl_thread_self_pointer): Do the cast from pthread_t to 'void *' via intptr_t. * modules/thread (Depends-on): Add stdint. --- diff --git a/ChangeLog b/ChangeLog index dfbdf209dc..55d348d3c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2023-06-25 Bruno Haible + + thread: Avoid compiler warnings on Solaris. + * lib/glthread/thread.h: Include . + (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 strerrorname_np: Add support for Solaris 11.4/sparc. diff --git a/lib/glthread/thread.h b/lib/glthread/thread.h index 88bc53ee7f..942ce70b5c 100644 --- a/lib/glthread/thread.h +++ b/lib/glthread/thread.h @@ -130,6 +130,9 @@ extern _Noreturn void gl_thread_exit (void *return_value); # include +/* Get intptr_t. */ +# include + /* On IRIX, pthread_atfork is declared in , not in . */ # if defined __sgi # include @@ -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) diff --git a/modules/thread b/modules/thread index 1d530b0d3a..f416807b63 100644 --- a/modules/thread +++ b/modules/thread @@ -8,6 +8,7 @@ m4/thread.m4 Depends-on: threadlib +stdint extern-inline lock windows-thread [test $gl_threads_api = windows]