[libc-commits] [libc] 32a50c6 - [libc][NFC] Add a static assert for futex size.

Siva Chandra Reddy via libc-commits libc-commits at lists.llvm.org
Tue Mar 1 14:58:14 PST 2022


Author: Siva Chandra Reddy
Date: 2022-03-01T22:56:56Z
New Revision: 32a50c6b93a7c8f661ce4ffb4bcdd855b91dac45

URL: https://github.com/llvm/llvm-project/commit/32a50c6b93a7c8f661ce4ffb4bcdd855b91dac45
DIFF: https://github.com/llvm/llvm-project/commit/32a50c6b93a7c8f661ce4ffb4bcdd855b91dac45.diff

LOG: [libc][NFC] Add a static assert for futex size.

Added: 
    

Modified: 
    libc/include/__llvm-libc-common.h
    libc/include/llvm-libc-types/__futex_word.h

Removed: 
    


################################################################################
diff  --git a/libc/include/__llvm-libc-common.h b/libc/include/__llvm-libc-common.h
index e767cb4e6988f..a9e0f6936143e 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 17b0dda8496e9..fab08a8084f92 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


        


More information about the libc-commits mailing list