Skip to content

Commit c091dd4

Browse files
[libc] fix build errors (#95613)
1 parent 8f7d30a commit c091dd4

File tree

5 files changed

+6
-3
lines changed

5 files changed

+6
-3
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class WaitingQueue final : private RawMutex {
6363
WaitingQueue &queue;
6464
bool is_pshared;
6565

66-
LIBC_INLINE constexpr Guard(WaitingQueue &queue, bool is_pshared)
66+
LIBC_INLINE Guard(WaitingQueue &queue, bool is_pshared)
6767
: queue(queue), is_pshared(is_pshared) {
6868
queue.lock(cpp::nullopt, is_pshared);
6969
}
@@ -189,6 +189,7 @@ class RwState {
189189
case Role::Writer:
190190
return !has_active_writer() && !has_pending_writer();
191191
}
192+
__builtin_unreachable();
192193
} else
193194
return !has_acitve_owner();
194195
}

libc/src/pthread/pthread_rwlock_timedrdlock.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ LLVM_LIBC_FUNCTION(int, pthread_rwlock_timedrdlock,
4242
return EINVAL;
4343
case internal::AbsTimeout::Error::BeforeEpoch:
4444
return ETIMEDOUT;
45-
// default: unreachable, all two cases are covered.
4645
}
46+
__builtin_unreachable();
4747
}
4848

4949
} // namespace LIBC_NAMESPACE

libc/src/pthread/pthread_rwlock_timedwrlock.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ LLVM_LIBC_FUNCTION(int, pthread_rwlock_timedwrlock,
3636
return EINVAL;
3737
case internal::AbsTimeout::Error::BeforeEpoch:
3838
return ETIMEDOUT;
39-
// default: unreachable, all two cases are covered.
4039
}
40+
__builtin_unreachable();
4141
}
4242

4343
} // namespace LIBC_NAMESPACE

libc/test/integration/src/pthread/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ add_integration_test(
5353
libc.src.sys.wait.waitpid
5454
libc.src.stdlib.exit
5555
libc.src.__support.CPP.atomic
56+
libc.src.__support.CPP.new
5657
libc.src.__support.threads.sleep
5758
)
5859

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "src/__support/CPP/atomic.h"
10+
#include "src/__support/CPP/new.h"
1011
#include "src/__support/OSUtil/syscall.h"
1112
#include "src/__support/threads/linux/raw_mutex.h"
1213
#include "src/__support/threads/linux/rwlock.h"

0 commit comments

Comments
 (0)