From: Paul Eggert Date: Sun, 30 Oct 2022 19:39:08 +0000 (-0700) Subject: thread: pacify gcc -Wbad-function-cast X-Git-Tag: v1.0~1979 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=37e0cb5e7e027dfcf2011d2f8a236d4ee0562f05;p=gnulib.git 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 *. --- diff --git a/ChangeLog b/ChangeLog index 159bb007ca..634aa8797f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2022-10-30 Paul Eggert + 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. diff --git a/lib/glthread/thread.h b/lib/glthread/thread.h index 6d98f2d6ac..bb60d8a0fb 100644 --- a/lib/glthread/thread.h +++ b/lib/glthread/thread.h @@ -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)