diff options
author | Michael Jones <michaelrj@google.com> | 2022-09-27 15:29:09 -0700 |
---|---|---|
committer | Michael Jones <michaelrj@google.com> | 2022-10-06 15:19:43 -0700 |
commit | f2a99746666ec796b4bf10261727f6d96428ab66 (patch) | |
tree | 4aaa2f970d8af98101f0442d724424a0f20caee8 /libc/include | |
parent | 79f0413e5e3cc775d0c116b66e3ff7fb82f1ee54 (diff) | |
download | llvm-f2a99746666ec796b4bf10261727f6d96428ab66.tar.gz |
[libc] fix futex type
Previously the futex type was defined in terms of unsigned int, now it's
uint32, which is more portable.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D135408
Diffstat (limited to 'libc/include')
-rw-r--r-- | libc/include/llvm-libc-types/__futex_word.h | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/libc/include/llvm-libc-types/__futex_word.h b/libc/include/llvm-libc-types/__futex_word.h index fab08a8084f9..85130ab4976b 100644 --- a/libc/include/llvm-libc-types/__futex_word.h +++ b/libc/include/llvm-libc-types/__futex_word.h @@ -10,16 +10,11 @@ #define __LLVM_LIBC_TYPES_FUTEX_WORD_H__ typedef struct { -#if defined(__unix__) && (defined(__x86_64__) || defined(__aarch64__)) // Futex word should be aligned appropriately to allow target atomic // instructions. This declaration mimics the internal setup. - _Alignas(sizeof(unsigned int) > _Alignof(unsigned int) - ? sizeof(unsigned int) - : _Alignof(unsigned int)) unsigned int __word; - _Static_assert(sizeof(unsigned int) == 4, "Unexpected size of unsigned int."); -#else -#error "A type to represent a futex word is not available for the target arch." -#endif + _Alignas(sizeof(__UINT32_TYPE__) > _Alignof(__UINT32_TYPE__) + ? sizeof(__UINT32_TYPE__) + : _Alignof(__UINT32_TYPE__)) __UINT32_TYPE__ __word; } __futex_word; #endif // __LLVM_LIBC_TYPES_FUTEX_WORD_H__ |