[libc-commits] [libc] f7e572b - [libc][NFC] Add a check to catch mismatch in internal and public mutex types.

Siva Chandra Reddy via libc-commits libc-commits at lists.llvm.org
Sun Aug 29 21:14:02 PDT 2021


Author: Siva Chandra Reddy
Date: 2021-08-30T04:08:35Z
New Revision: f7e572b4f4a0339162f8bc168edfd9fa523c9c1e

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

LOG: [libc][NFC] Add a check to catch mismatch in internal and public mutex types.

Added: 
    

Modified: 
    libc/src/threads/linux/Mutex.h

Removed: 
    


################################################################################
diff  --git a/libc/src/threads/linux/Mutex.h b/libc/src/threads/linux/Mutex.h
index 454b8ced3054b..f6033c92eaf6e 100644
--- a/libc/src/threads/linux/Mutex.h
+++ b/libc/src/threads/linux/Mutex.h
@@ -107,6 +107,10 @@ struct Mutex {
   }
 };
 
+static_assert(sizeof(Mutex) == sizeof(mtx_t),
+              "Sizes of internal representation of mutex and the public mtx_t "
+              "do not match.");
+
 class MutexLock {
   Mutex *mutex;
 


        


More information about the libc-commits mailing list