Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion libc/src/__support/threads/linux/rwlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class WaitingQueue final : private RawMutex {
WaitingQueue &queue;
bool is_pshared;

LIBC_INLINE constexpr Guard(WaitingQueue &queue, bool is_pshared)
LIBC_INLINE Guard(WaitingQueue &queue, bool is_pshared)
: queue(queue), is_pshared(is_pshared) {
queue.lock(cpp::nullopt, is_pshared);
}
Expand Down Expand Up @@ -189,6 +189,7 @@ class RwState {
case Role::Writer:
return !has_active_writer() && !has_pending_writer();
}
__builtin_unreachable();
} else
return !has_acitve_owner();
}
Expand Down
2 changes: 1 addition & 1 deletion libc/src/pthread/pthread_rwlock_timedrdlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ LLVM_LIBC_FUNCTION(int, pthread_rwlock_timedrdlock,
return EINVAL;
case internal::AbsTimeout::Error::BeforeEpoch:
return ETIMEDOUT;
// default: unreachable, all two cases are covered.
}
__builtin_unreachable();
}

} // namespace LIBC_NAMESPACE
2 changes: 1 addition & 1 deletion libc/src/pthread/pthread_rwlock_timedwrlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ LLVM_LIBC_FUNCTION(int, pthread_rwlock_timedwrlock,
return EINVAL;
case internal::AbsTimeout::Error::BeforeEpoch:
return ETIMEDOUT;
// default: unreachable, all two cases are covered.
}
__builtin_unreachable();
}

} // namespace LIBC_NAMESPACE
1 change: 1 addition & 0 deletions libc/test/integration/src/pthread/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ add_integration_test(
libc.src.sys.wait.waitpid
libc.src.stdlib.exit
libc.src.__support.CPP.atomic
libc.src.__support.CPP.new
libc.src.__support.threads.sleep
)

Expand Down
1 change: 1 addition & 0 deletions libc/test/integration/src/pthread/pthread_rwlock_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//

#include "src/__support/CPP/atomic.h"
#include "src/__support/CPP/new.h"
#include "src/__support/OSUtil/syscall.h"
#include "src/__support/threads/linux/raw_mutex.h"
#include "src/__support/threads/linux/rwlock.h"
Expand Down