[libc-commits] [libc] e9c9ee9 - [libc][NFC] Fix typos and reduntent code triggering compiler warinings.

Siva Chandra Reddy via libc-commits libc-commits at lists.llvm.org
Tue Mar 15 14:51:51 PDT 2022


Author: Siva Chandra Reddy
Date: 2022-03-15T21:51:12Z
New Revision: e9c9ee9fe694067ee96643d05d6ac378349386bb

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

LOG: [libc][NFC] Fix typos and reduntent code triggering compiler warinings.

Added: 
    

Modified: 
    libc/src/__support/threads/linux/mutex.h
    libc/src/threads/mtx_init.cpp

Removed: 
    


################################################################################
diff  --git a/libc/src/__support/threads/linux/mutex.h b/libc/src/__support/threads/linux/mutex.h
index feb5c0f30b7ef..9b2bfa20eb946 100644
--- a/libc/src/__support/threads/linux/mutex.h
+++ b/libc/src/__support/threads/linux/mutex.h
@@ -96,10 +96,6 @@ struct Mutex {
         continue;
       case LockState::Free:
         // If it was LockState::Free, we shouldn't be here at all.
-        [[clang::fallthrough]];
-      default:
-        // Mutex status cannot be anything else. So control should not reach
-        // here at all.
         return MutexError::BAD_LOCK_STATE;
       }
     }

diff  --git a/libc/src/threads/mtx_init.cpp b/libc/src/threads/mtx_init.cpp
index 367e91dc7ceea..f3d1ee66f1fe9 100644
--- a/libc/src/threads/mtx_init.cpp
+++ b/libc/src/threads/mtx_init.cpp
@@ -14,7 +14,7 @@
 namespace __llvm_libc {
 
 LLVM_LIBC_FUNCTION(int, mtx_init, (mtx_t * m, int type)) {
-  auto err = Mutex::init(m, type | mtx_timed, type | mtx_recursive, 0);
+  auto err = Mutex::init(m, type & mtx_timed, type & mtx_recursive, 0);
   return err == MutexError::NONE ? thrd_success : thrd_error;
 }
 


        


More information about the libc-commits mailing list