Merge "Nullability check for semaphore module" am: 05a48064c8
am: ee42025916
am: cf6a9427a8
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2513457 Change-Id: I93e8612cb52f8eba0fabc64829a0f73c5c376f94 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
0d8a05a12d
2 changed files with 15 additions and 13 deletions
|
@ -45,12 +45,12 @@ typedef struct {
|
|||
|
||||
#define SEM_FAILED __BIONIC_CAST(reinterpret_cast, sem_t*, 0)
|
||||
|
||||
int sem_clockwait(sem_t* __sem, clockid_t __clock, const struct timespec* __ts) __INTRODUCED_IN(30);
|
||||
int sem_destroy(sem_t* __sem);
|
||||
int sem_getvalue(sem_t* __sem, int* __value);
|
||||
int sem_init(sem_t* __sem, int __shared, unsigned int __value);
|
||||
int sem_post(sem_t* __sem);
|
||||
int sem_timedwait(sem_t* __sem, const struct timespec* __ts);
|
||||
int sem_clockwait(sem_t* _Nonnull __sem, clockid_t __clock, const struct timespec* _Nonnull __ts) __INTRODUCED_IN(30);
|
||||
int sem_destroy(sem_t* _Nonnull __sem);
|
||||
int sem_getvalue(sem_t* _Nonnull __sem, int* _Nonnull __value);
|
||||
int sem_init(sem_t* _Nonnull __sem, int __shared, unsigned int __value);
|
||||
int sem_post(sem_t* _Nonnull __sem);
|
||||
int sem_timedwait(sem_t* _Nonnull __sem, const struct timespec* _Nonnull __ts);
|
||||
/*
|
||||
* POSIX historically only supported using sem_timedwait() with CLOCK_REALTIME, however that is
|
||||
* typically inappropriate, since that clock can change dramatically, causing the timeout to either
|
||||
|
@ -59,14 +59,14 @@ int sem_timedwait(sem_t* __sem, const struct timespec* __ts);
|
|||
* Note that sem_clockwait() allows specifying an arbitrary clock and has superseded this
|
||||
* function.
|
||||
*/
|
||||
int sem_timedwait_monotonic_np(sem_t* __sem, const struct timespec* __ts) __INTRODUCED_IN(28);
|
||||
int sem_trywait(sem_t* __sem);
|
||||
int sem_wait(sem_t* __sem);
|
||||
int sem_timedwait_monotonic_np(sem_t* _Nonnull __sem, const struct timespec* _Nonnull __ts) __INTRODUCED_IN(28);
|
||||
int sem_trywait(sem_t* _Nonnull __sem);
|
||||
int sem_wait(sem_t* _Nonnull __sem);
|
||||
|
||||
/* These aren't actually implemented. */
|
||||
sem_t* sem_open(const char* __name, int _flags, ...);
|
||||
int sem_close(sem_t* __sem);
|
||||
int sem_unlink(const char* __name);
|
||||
sem_t* _Nullable sem_open(const char* _Nonnull __name, int _flags, ...);
|
||||
int sem_close(sem_t* _Nonnull __sem);
|
||||
int sem_unlink(const char* _Nonnull __name);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -165,8 +165,10 @@ TEST(semaphore, sem_clockwait) {
|
|||
TEST_F(semaphore_DeathTest, sem_timedwait_null_timeout) {
|
||||
sem_t s;
|
||||
ASSERT_EQ(0, sem_init(&s, 0, 0));
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wnonnull"
|
||||
ASSERT_EXIT(sem_timedwait(&s, nullptr), testing::KilledBySignal(SIGSEGV), "");
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
TEST(semaphore, sem_getvalue) {
|
||||
|
|
Loading…
Reference in a new issue