[libc-commits] [libc] [libc][pthread] fix -Wmissing-field-initializers (PR #126314)
Michael Jones via libc-commits
libc-commits at lists.llvm.org
Tue Feb 11 14:15:16 PST 2025
================
@@ -25,8 +27,49 @@
#define PTHREAD_PROCESS_PRIVATE 0
#define PTHREAD_PROCESS_SHARED 1
-#define PTHREAD_MUTEX_INITIALIZER {0}
-#define PTHREAD_RWLOCK_INITIALIZER {0}
+#ifdef __linux__
+#define PTHREAD_MUTEX_INITIALIZER \
+ { \
+ /* .__timed = */ 0, \
+ /* .__recursive = */ 0, \
+ /* .__robust = */ 0, \
+ /* .__owner = */ NULL, \
+ /* .__lock_count = */ 0, /* .__futex_word = */ \
+ { \
+ /* .__word = */ 0, \
+ }, \
+ }
+#else
+#define PTHREAD_MUTEX_INITIALIZER \
+ { \
+ /* .__timed = */ 0, /* .__recursive = */ 0, \
+ /* .__robust = */ 0, /* .__owner = */ NULL, \
+ /* .__lock_count = */ 0, \
+ }
+#endif
+
+#define PTHREAD_RWLOCK_INITIALIZER \
+ { \
+ /* .__is_pshared = */ 0, \
+ /* .__preference = */ 0, \
+ /* .__state = */ 0, \
+ /* .__write_tid = */ 0, /* .__wait_queue_mutex = */ \
----------------
michaelrj-google wrote:
do you want these two comments to be on separate lines?
https://github.com/llvm/llvm-project/pull/126314
More information about the libc-commits
mailing list