[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/2] thread: pacify gcc -Wbad-function-cast
From: |
Paul Eggert |
Subject: |
[PATCH 2/2] thread: pacify gcc -Wbad-function-cast |
Date: |
Sun, 30 Oct 2022 13:26:05 -0700 |
* lib/glthread/thread.h (gl_thread_self_pointer): With POSIX
threads, cast the call to gl_thread_t before casting to void *.
---
ChangeLog | 4 ++++
lib/glthread/thread.h | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 159bb007ca..634aa8797f 100644
--- 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.
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)
--
2.37.3