<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/123434>123434</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[libc] PTHREAD_RWLOCK_INITIALIZER needs to initialize all members of `pthread_rwlock_t`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
libc
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
vinay-deshmukh
</td>
</tr>
</table>
<pre>
Building `llvm-libc`, when disabling `-Wno-missing-field-initializers` gives:
```
/home/runner/work/llvm-project/llvm-project/libc/test/integration/src/pthread/pthread_rwlock_test.cpp:59:29: error: missing field '__preference' initializer [-Werror,-Wmissing-field-initializers]
59 | pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER;
| ^
/home/runner/work/llvm-project/llvm-project/build/libc/include/llvm-libc-macros/pthread-macros.h:29:38: note: expanded from macro 'PTHREAD_RWLOCK_INITIALIZER'
29 | #define PTHREAD_RWLOCK_INITIALIZER {0}
| ^
/home/runner/work/llvm-project/llvm-project/libc/test/integration/src/pthread/pthread_rwlock_test.cpp:76:29: error: missing field '__preference' initializer [-Werror,-Wmissing-field-initializers]
76 | pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER;
| ^
/home/runner/work/llvm-project/llvm-project/build/libc/include/llvm-libc-macros/pthread-macros.h:29:38: note: expanded from macro 'PTHREAD_RWLOCK_INITIALIZER'
29 | #define PTHREAD_RWLOCK_INITIALIZER {0}
| ^
/home/runner/work/llvm-project/llvm-project/libc/test/integration/src/pthread/pthread_rwlock_test.cpp:86:29: error: missing field '__preference' initializer [-Werror,-Wmissing-field-initializers]
86 | pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER;
| ^
/home/runner/work/llvm-project/llvm-project/build/libc/include/llvm-libc-macros/pthread-macros.h:29:38: note: expanded from macro 'PTHREAD_RWLOCK_INITIALIZER'
29 | #define PTHREAD_RWLOCK_INITIALIZER {0}
| ^
/home/runner/work/llvm-project/llvm-project/libc/test/integration/src/pthread/pthread_rwlock_test.cpp:103:29: error: missing field '__preference' initializer [-Werror,-Wmissing-field-initializers]
103 | pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER;
| ^
/home/runner/work/llvm-project/llvm-project/build/libc/include/llvm-libc-macros/pthread-macros.h:29:38: note: expanded from macro 'PTHREAD_RWLOCK_INITIALIZER'
29 | #define PTHREAD_RWLOCK_INITIALIZER {0}
| ^
/home/runner/work/llvm-project/llvm-project/libc/test/integration/src/pthread/pthread_rwlock_test.cpp:133:29: error: missing field '__preference' initializer [-Werror,-Wmissing-field-initializers]
133 | pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER;
| ^
/home/runner/work/llvm-project/llvm-project/build/libc/include/llvm-libc-macros/pthread-macros.h:29:38: note: expanded from macro 'PTHREAD_RWLOCK_INITIALIZER'
29 | #define PTHREAD_RWLOCK_INITIALIZER {0}
| ^
/home/runner/work/llvm-project/llvm-project/libc/test/integration/src/pthread/pthread_rwlock_test.cpp:166:29: error: missing field '__preference' initializer [-Werror,-Wmissing-field-initializers]
166 | pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER;
| ^
/home/runner/work/llvm-project/llvm-project/build/libc/include/llvm-libc-macros/pthread-macros.h:29:38: note: expanded from macro 'PTHREAD_RWLOCK_INITIALIZER'
29 | #define PTHREAD_RWLOCK_INITIALIZER {0}
| ^
/home/runner/work/llvm-project/llvm-project/libc/test/integration/src/pthread/pthread_rwlock_test.cpp:207:29: error: missing field '__preference' initializer [-Werror,-Wmissing-field-initializers]
207 | pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER;
| ^
/home/runner/work/llvm-project/llvm-project/build/libc/include/llvm-libc-macros/pthread-macros.h:29:38: note: expanded from macro 'PTHREAD_RWLOCK_INITIALIZER'
29 | #define PTHREAD_RWLOCK_INITIALIZER {0}
```
Also, see: https://github.com/llvm/llvm-project/pull/122835#issuecomment-2597223393
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzsmF2L4zYUhn_N8Y1wkI8if1z4wknGdOjSlmFhoDfBH8exOrIUJHum219f7GSZ7bYEyg65CAETZEeSz_v4AcGpvFcHQ5SD3IDcBdU09tblr8pUX8KWfD9ML31Q2_ZLvpmUbpU5MIi51q9DqFXdQMwBt-ytJ8Na5atan2eEz8aGg_JemUPYKdJtqIwaVaXVX-Q8xJwd1Ct5EAXw5Yr5-eIFYNnbgQBLNxlDDrB8s-4FsFxefHT2D2rG_7idK8JyJD_fKTPSwVWjsgaw9G7-6zj2jqr2fbR3b9o2L_t5zao5HkEUMgNR4PzDyDnr5sE5CVuSMMBkvz866siRaQgwYd-EYyA34fNpKW7D5wsU5A54wRiTGYNkyxj7vip2GjAQO_bb55-eHord_un506_bn_ePvzx-fiw-Pf7-8ARic9qHsWUfkA8_QLGeP_Q7TWUaPbX0dd78NByqxln_TvH8YNV_JSfSmZqxIy0Y_zxWpqWWdc4ObJk7M7wQCJNTIDyBARQtdcrQBQgMkg2HZPeBJD7GpyS-uk9JfPfpZn1Kr-9Tevfpdn2KuLi2UBEXd6FuVyhxfaHEXagbFiq--pEXxfcj73aFQp5cWyjkyV2oDxTqH_0CXhTaW8At87RU04_jcektYAlYHtTYT_WqscM54b-BHCetAcsIMRUSUCjvJ2rsMJAZQ5RZgihEJoI2F20msiqgPEpEEsUyEjLo8yTtujrNOp5GKW_qdJ3wmpp03SRdF3WyDlSOHCWPopRHEiO5qgWXUUNNmvEsTjsJa05DpfRqrmxl3SFYasgjFGuxDnRVk_ZLnwbx9NkQ5C5w-ZKkng4e1lwrP_r3HUY16qW3syyQl_xihqj1bLTfaM4qrdlAQ03OM9sxiPn38kLMg8np_H8DX8L5BfmS7zXHvwMAAP__2xLixQ">