[libc-commits] [libc] f2a9974 - [libc] fix futex type
Michael Jones via libc-commits
libc-commits at lists.llvm.org
Thu Oct 6 15:19:50 PDT 2022
Author: Michael Jones
Date: 2022-10-06T15:19:43-07:00
New Revision: f2a99746666ec796b4bf10261727f6d96428ab66
URL: https://github.com/llvm/llvm-project/commit/f2a99746666ec796b4bf10261727f6d96428ab66
DIFF: https://github.com/llvm/llvm-project/commit/f2a99746666ec796b4bf10261727f6d96428ab66.diff
LOG: [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
Added:
Modified:
libc/include/llvm-libc-types/__futex_word.h
Removed:
################################################################################
diff --git a/libc/include/llvm-libc-types/__futex_word.h b/libc/include/llvm-libc-types/__futex_word.h
index fab08a8084f92..85130ab4976ba 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__
More information about the libc-commits
mailing list