[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:12:08 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 1/2] [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() {
>From d6e39b61c1187525a4b8e75325845ba778ead29a Mon Sep 17 00:00:00 2001
From: Yifan Zhu <yifzhu at nvidia.com>
Date: Fri, 14 Jun 2024 14:11:57 -0700
Subject: [PATCH 2/2] [libc] fix inclusion error
---
libc/test/integration/src/pthread/pthread_rwlock_test.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/libc/test/integration/src/pthread/pthread_rwlock_test.cpp b/libc/test/integration/src/pthread/pthread_rwlock_test.cpp
index 215db1fc5addf..a2ae2281d22d0 100644
--- a/libc/test/integration/src/pthread/pthread_rwlock_test.cpp
+++ b/libc/test/integration/src/pthread/pthread_rwlock_test.cpp
@@ -37,7 +37,6 @@
#include "src/unistd/fork.h"
#include "test/IntegrationTest/test.h"
#include <errno.h>
-#include <optional>
#include <pthread.h>
#include <time.h>
More information about the libc-commits
mailing list