diff options
author | Siva Chandra Reddy <sivachandra@google.com> | 2022-03-02 01:53:46 +0300 |
---|---|---|
committer | Siva Chandra Reddy <sivachandra@google.com> | 2022-03-02 01:56:56 +0300 |
commit | 32a50c6b93a7c8f661ce4ffb4bcdd855b91dac45 (patch) | |
tree | b4db95637ab553d79a18d1054ae77c4f32dbf6d3 /libc | |
parent | d75ac5811705941eb254995acb90ac88fda895ad (diff) |
[libc][NFC] Add a static assert for futex size.
Diffstat (limited to 'libc')
-rw-r--r-- | libc/include/__llvm-libc-common.h | 3 | ||||
-rw-r--r-- | libc/include/llvm-libc-types/__futex_word.h | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/libc/include/__llvm-libc-common.h b/libc/include/__llvm-libc-common.h index e767cb4e6988..a9e0f6936143 100644 --- a/libc/include/__llvm-libc-common.h +++ b/libc/include/__llvm-libc-common.h @@ -23,6 +23,9 @@ #undef _Alignas #define _Alignas alignas +#undef _Static_assert +#define _Static_assert static_assert + #undef _Alignof #define _Alignof alignof diff --git a/libc/include/llvm-libc-types/__futex_word.h b/libc/include/llvm-libc-types/__futex_word.h index 17b0dda8496e..fab08a8084f9 100644 --- a/libc/include/llvm-libc-types/__futex_word.h +++ b/libc/include/llvm-libc-types/__futex_word.h @@ -16,6 +16,7 @@ typedef struct { _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 |