Skip to content

Commit a1e66fe

Browse files
Yifan ZhuSchrodingerZhu
authored andcommitted
address CRs
1 parent 5a6a429 commit a1e66fe

File tree

7 files changed

+302
-256
lines changed

7 files changed

+302
-256
lines changed

libc/include/llvm-libc-types/pthread_rwlock_t.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
#include "llvm-libc-types/__futex_word.h"
1313
#include "llvm-libc-types/pid_t.h"
1414
typedef struct {
15-
bool __is_pshared;
16-
char __preference;
15+
unsigned __is_pshared : 1;
16+
unsigned __preference : 1;
1717
int __state;
1818
pid_t __writier_tid;
1919
__futex_word __wait_queue_mutex;
20-
__futex_word __pending_reader;
21-
__futex_word __pending_writer;
20+
__futex_word __pending_readers;
21+
__futex_word __pending_writers;
2222
__futex_word __reader_serialization;
2323
__futex_word __writer_serialization;
2424
} pthread_rwlock_t;

libc/spec/posix.td

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ def POSIX : StandardSpec<"POSIX"> {
113113
NamedType PThreadRWLockAttrTType = NamedType<"pthread_rwlockattr_t">;
114114
PtrType PThreadRWLockAttrTPtr = PtrType<PThreadRWLockAttrTType>;
115115
ConstType ConstPThreadRWLockAttrTPtr = ConstType<PThreadRWLockAttrTPtr>;
116-
ConstType ConstRestrictedPThreadRWLockAttrTPtr = ConstType<RestrictedPtrType<PThreadRWLockAttrTType>>;
116+
RestrictedPtrType RestrictedPThreadRWLockAttrTPtr = RestrictedPtrType<PThreadRWLockAttrTType>;
117+
ConstType ConstRestrictedPThreadRWLockAttrTPtr = ConstType<RestrictedPThreadRWLockAttrTPtr>;
117118

118119
NamedType PThreadMutexAttrTType = NamedType<"pthread_mutexattr_t">;
119120
PtrType PThreadMutexAttrTPtr = PtrType<PThreadMutexAttrTType>;
@@ -1283,12 +1284,12 @@ def POSIX : StandardSpec<"POSIX"> {
12831284
FunctionSpec<
12841285
"pthread_rwlock_timedrdlock",
12851286
RetValSpec<IntType>,
1286-
[ArgSpec<RestrictedPThreadRWLockTPtr>, ArgSpec<ConstRestructTimeSpecPtr>]
1287+
[ArgSpec<RestrictedPThreadRWLockTPtr>, ArgSpec<ConstRestrictStructTimeSpecPtr>]
12871288
>,
12881289
FunctionSpec<
12891290
"pthread_rwlock_timedwrlock",
12901291
RetValSpec<IntType>,
1291-
[ArgSpec<RestrictedPThreadRWLockTPtr>, ArgSpec<ConstRestructTimeSpecPtr>]
1292+
[ArgSpec<RestrictedPThreadRWLockTPtr>, ArgSpec<ConstRestrictStructTimeSpecPtr>]
12921293
>,
12931294
FunctionSpec<
12941295
"pthread_rwlock_rdlock",

libc/spec/spec.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ def TimeTType : NamedType<"time_t">;
126126
def StructTimeSpec : NamedType<"struct timespec">;
127127
def StructTimeSpecPtr : PtrType<StructTimeSpec>;
128128
def ConstStructTimeSpecPtr : ConstType<StructTimeSpecPtr>;
129-
def ConstRestructTimeSpecPtr : ConstType<RestrictedPtrType<StructTimeSpec>>;
129+
def RestrictStructTimeSpecPtr : RestrictedPtrType<StructTimeSpec>;
130+
def ConstRestrictStructTimeSpecPtr : ConstType<RestrictStructTimeSpecPtr>;
130131

131132
def BSearchCompareT : NamedType<"__bsearchcompare_t">;
132133
def QSortCompareT : NamedType<"__qsortcompare_t">;

libc/src/__support/macros/attributes.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,10 @@
4242
#define LIBC_CONSTINIT
4343
#endif
4444

45+
#ifdef __clang__
46+
#define LIBC_PREFERED_TYPE(TYPE) [[clang::preferred_type(TYPE)]]
47+
#else
48+
#define LIBC_PREFERED_TYPE(TYPE)
49+
#endif
50+
4551
#endif // LLVM_LIBC_SRC___SUPPORT_MACROS_ATTRIBUTES_H

libc/src/__support/threads/linux/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ add_header_library(
5454
.raw_mutex
5555
libc.src.__support.common
5656
libc.src.__support.OSUtil.osutil
57+
libc.src.__support.CPP.limits
5758
COMPILE_OPTIONS
5859
-DLIBC_COPT_RWLOCK_DEFAULT_SPIN_COUNT=${LIBC_CONF_RWLOCK_DEFAULT_SPIN_COUNT}
5960
${monotonicity_flags}

0 commit comments

Comments
 (0)