[libc-commits] [libc] [libc] workaround gcc bitfield assignment warning (PR #95600)
Schrodinger ZHU Yifan via libc-commits
libc-commits at lists.llvm.org
Fri Jun 14 14:05:06 PDT 2024
https://github.com/SchrodingerZhu updated https://github.com/llvm/llvm-project/pull/95600
>From 3d7732645cae27aa69772e232920754340ba258d Mon Sep 17 00:00:00 2001
From: Yifan Zhu <yifzhu at nvidia.com>
Date: Fri, 14 Jun 2024 14:03:22 -0700
Subject: [PATCH] [libc] workaround gcc bitfield assignment warning
---
libc/src/__support/threads/linux/rwlock.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libc/src/__support/threads/linux/rwlock.h b/libc/src/__support/threads/linux/rwlock.h
index 5db0590fd6aa0..1778995cf3766 100644
--- a/libc/src/__support/threads/linux/rwlock.h
+++ b/libc/src/__support/threads/linux/rwlock.h
@@ -370,8 +370,9 @@ class RwLock {
public:
LIBC_INLINE constexpr RwLock(Role preference = Role::Reader,
bool is_pshared = false)
- : is_pshared(is_pshared), preference(static_cast<unsigned>(preference)),
- state(0), writer_tid(0), queue() {}
+ : is_pshared(is_pshared),
+ preference(static_cast<unsigned>(preference) & 1u), state(0),
+ writer_tid(0), queue() {}
[[nodiscard]]
LIBC_INLINE LockResult try_read_lock() {
More information about the libc-commits
mailing list