aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2009-09-06 10:53:22 +0000
committerDuncan Sands <baldrick@free.fr>2009-09-06 10:53:22 +0000
commit3872b7ec9730d0492e40ab8c279dd8d397d71d42 (patch)
tree5162422a9c3a3699644b9f34b51fb80fa07b18d5 /include
parenta118e65f108d5222f359ff32d24a27bdcaf27eb1 (diff)
downloadexternal_llvm-3872b7ec9730d0492e40ab8c279dd8d397d71d42.zip
external_llvm-3872b7ec9730d0492e40ab8c279dd8d397d71d42.tar.gz
external_llvm-3872b7ec9730d0492e40ab8c279dd8d397d71d42.tar.bz2
Tweak code into an equivalent form for which icc
doesn't warn about unreachable instructions. Patch by Erick Tryzelaar (#111). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81110 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/System/Mutex.h36
1 files changed, 20 insertions, 16 deletions
diff --git a/include/llvm/System/Mutex.h b/include/llvm/System/Mutex.h
index 9ef5942..71d1006 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: