Fixing warnings shouldn't introduce a crasher.
authorGreg Clayton <gclayton@apple.com>
Fri, 18 Jul 2014 18:32:45 +0000 (18:32 +0000)
committerGreg Clayton <gclayton@apple.com>
Fri, 18 Jul 2014 18:32:45 +0000 (18:32 +0000)
Fix the warning the correct way without making things crash when ENABLE_MUTEX_ERROR_CHECKING is non enabled.

<rdar://problem/17703039>

llvm-svn: 213394

lldb/source/Host/common/Mutex.cpp

index 4e01355..c26467f 100644 (file)
@@ -242,9 +242,9 @@ Mutex::Mutex (Mutex::Type type) :
 //----------------------------------------------------------------------
 Mutex::~Mutex()
 {
+#if ENABLE_MUTEX_ERROR_CHECKING
     int err = ::pthread_mutex_destroy (&m_mutex);
     assert(err == 0);
-#if ENABLE_MUTEX_ERROR_CHECKING
     if (err == 0)
         error_check_mutex (&m_mutex, eMutexActionDestroyed);
     else
@@ -253,6 +253,8 @@ Mutex::~Mutex()
         assert(err == 0);
     }
     memset (&m_mutex, '\xba', sizeof(m_mutex));
+#else
+    ::pthread_mutex_destroy (&m_mutex);
 #endif
 }