diff --git a/include/llvm/System/Mutex.h b/include/llvm/System/Mutex.h index 9ef5942a702..71d10067c30 100644 --- a/include/llvm/System/Mutex.h +++ b/include/llvm/System/Mutex.h @@ -93,32 +93,36 @@ namespace llvm MutexImpl(rec), acquired(0), recursive(rec) { } bool acquire() { - if (!mt_only || llvm_is_multithreaded()) + if (!mt_only || llvm_is_multithreaded()) { return MutexImpl::acquire(); - - // Single-threaded debugging code. This would be racy in multithreaded - // mode, but provides not sanity checks in single threaded mode. - assert((recursive || acquired == 0) && "Lock already acquired!!"); - ++acquired; - return true; + } else { + // Single-threaded debugging code. This would be racy in + // multithreaded mode, but provides not sanity checks in single + // threaded mode. + assert((recursive || acquired == 0) && "Lock already acquired!!"); + ++acquired; + return true; + } } bool release() { - if (!mt_only || llvm_is_multithreaded()) + if (!mt_only || llvm_is_multithreaded()) { return MutexImpl::release(); - - // Single-threaded debugging code. This would be racy in multithreaded - // mode, but provides not sanity checks in single threaded mode. - assert(((recursive && acquired) || (acquired == 1)) && - "Lock not acquired before release!"); - --acquired; - return true; + } else { + // Single-threaded debugging code. This would be racy in + // multithreaded mode, but provides not sanity checks in single + // threaded mode. + assert(((recursive && acquired) || (acquired == 1)) && + "Lock not acquired before release!"); + --acquired; + return true; + } } bool tryacquire() { if (!mt_only || llvm_is_multithreaded()) return MutexImpl::tryacquire(); - return true; + else return true; } private: diff --git a/lib/System/Mutex.cpp b/lib/System/Mutex.cpp index a5e9920ae3f..8ccd6e52c4d 100644 --- a/lib/System/Mutex.cpp +++ b/lib/System/Mutex.cpp @@ -115,8 +115,7 @@ MutexImpl::acquire() int errorcode = pthread_mutex_lock(mutex); return errorcode == 0; - } - return false; + } else return false; } bool @@ -129,8 +128,7 @@ MutexImpl::release() int errorcode = pthread_mutex_unlock(mutex); return errorcode == 0; - } - return false; + } else return false; } bool @@ -143,8 +141,7 @@ MutexImpl::tryacquire() int errorcode = pthread_mutex_trylock(mutex); return errorcode == 0; - } - return false; + } else return false; } } diff --git a/lib/System/RWMutex.cpp b/lib/System/RWMutex.cpp index 15d98cb8f41..5faf220eb91 100644 --- a/lib/System/RWMutex.cpp +++ b/lib/System/RWMutex.cpp @@ -117,8 +117,7 @@ RWMutexImpl::reader_acquire() int errorcode = pthread_rwlock_rdlock(rwlock); return errorcode == 0; - } - return false; + } else return false; } bool @@ -131,8 +130,7 @@ RWMutexImpl::reader_release() int errorcode = pthread_rwlock_unlock(rwlock); return errorcode == 0; - } - return false; + } else return false; } bool @@ -145,8 +143,7 @@ RWMutexImpl::writer_acquire() int errorcode = pthread_rwlock_wrlock(rwlock); return errorcode == 0; - } - return false; + } else return false; } bool @@ -159,8 +156,7 @@ RWMutexImpl::writer_release() int errorcode = pthread_rwlock_unlock(rwlock); return errorcode == 0; - } - return false; + } else return false; } } diff --git a/lib/System/Unix/Process.inc b/lib/System/Unix/Process.inc index c4ce35a208f..774783f8ad0 100644 --- a/lib/System/Unix/Process.inc +++ b/lib/System/Unix/Process.inc @@ -181,25 +181,28 @@ void Process::PreventCoreFiles() { bool Process::StandardInIsUserInput() { #if HAVE_ISATTY return isatty(0); -#endif +#else // If we don't have isatty, just return false. return false; +#endif } bool Process::StandardOutIsDisplayed() { #if HAVE_ISATTY return isatty(1); -#endif +#else // If we don't have isatty, just return false. return false; +#endif } bool Process::StandardErrIsDisplayed() { #if HAVE_ISATTY return isatty(2); -#endif +#else // If we don't have isatty, just return false. return false; +#endif } static unsigned getColumns(int FileID) {