Skip to content

Commit f00f11b

Browse files
[libc] fix build errors (llvm#95600)
Bitfield conversion problem tested at: https://godbolt.org/z/dxjhs5Ghr
1 parent 19ad7a0 commit f00f11b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

libc/src/__support/threads/linux/rwlock.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,9 @@ class RwLock {
370370
public:
371371
LIBC_INLINE constexpr RwLock(Role preference = Role::Reader,
372372
bool is_pshared = false)
373-
: is_pshared(is_pshared), preference(static_cast<unsigned>(preference)),
374-
state(0), writer_tid(0), queue() {}
373+
: is_pshared(is_pshared),
374+
preference(static_cast<unsigned>(preference) & 1u), state(0),
375+
writer_tid(0), queue() {}
375376

376377
[[nodiscard]]
377378
LIBC_INLINE LockResult try_read_lock() {

libc/test/integration/src/pthread/pthread_rwlock_test.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
#include "src/unistd/fork.h"
3838
#include "test/IntegrationTest/test.h"
3939
#include <errno.h>
40-
#include <optional>
4140
#include <pthread.h>
4241
#include <time.h>
4342

0 commit comments

Comments
 (0)