llvm.org GIT mirror llvm / 740eb53
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 Duncan Sands 11 years ago
4 changed file(s) with 33 addition(s) and 33 deletion(s). Raw diff Collapse all Expand all
9292 MutexImpl(rec), acquired(0), recursive(rec) { }
9393
9494 bool acquire() {
95 if (!mt_only || llvm_is_multithreaded())
95 if (!mt_only || llvm_is_multithreaded()) {
9696 return MutexImpl::acquire();
97
98 // Single-threaded debugging code. This would be racy in multithreaded
99 // mode, but provides not sanity checks in single threaded mode.
100 assert((recursive || acquired == 0) && "Lock already acquired!!");
101 ++acquired;
102 return true;
97 } else {
98 // Single-threaded debugging code. This would be racy in
99 // multithreaded mode, but provides not sanity checks in single
100 // threaded mode.
101 assert((recursive || acquired == 0) && "Lock already acquired!!");
102 ++acquired;
103 return true;
104 }
103105 }
104106
105107 bool release() {
106 if (!mt_only || llvm_is_multithreaded())
108 if (!mt_only || llvm_is_multithreaded()) {
107109 return MutexImpl::release();
108
109 // Single-threaded debugging code. This would be racy in multithreaded
110 // mode, but provides not sanity checks in single threaded mode.
111 assert(((recursive && acquired) || (acquired == 1)) &&
112 "Lock not acquired before release!");
113 --acquired;
114 return true;
110 } else {
111 // Single-threaded debugging code. This would be racy in
112 // multithreaded mode, but provides not sanity checks in single
113 // threaded mode.
114 assert(((recursive && acquired) || (acquired == 1)) &&
115 "Lock not acquired before release!");
116 --acquired;
117 return true;
118 }
115119 }
116120
117121 bool tryacquire() {
118122 if (!mt_only || llvm_is_multithreaded())
119123 return MutexImpl::tryacquire();
120 return true;
124 else return true;
121125 }
122126
123127 private:
114114
115115 int errorcode = pthread_mutex_lock(mutex);
116116 return errorcode == 0;
117 }
118 return false;
117 } else return false;
119118 }
120119
121120 bool
128127
129128 int errorcode = pthread_mutex_unlock(mutex);
130129 return errorcode == 0;
131 }
132 return false;
130 } else return false;
133131 }
134132
135133 bool
142140
143141 int errorcode = pthread_mutex_trylock(mutex);
144142 return errorcode == 0;
145 }
146 return false;
143 } else return false;
147144 }
148145
149146 }
116116
117117 int errorcode = pthread_rwlock_rdlock(rwlock);
118118 return errorcode == 0;
119 }
120 return false;
119 } else return false;
121120 }
122121
123122 bool
130129
131130 int errorcode = pthread_rwlock_unlock(rwlock);
132131 return errorcode == 0;
133 }
134 return false;
132 } else return false;
135133 }
136134
137135 bool
144142
145143 int errorcode = pthread_rwlock_wrlock(rwlock);
146144 return errorcode == 0;
147 }
148 return false;
145 } else return false;
149146 }
150147
151148 bool
158155
159156 int errorcode = pthread_rwlock_unlock(rwlock);
160157 return errorcode == 0;
161 }
162 return false;
158 } else return false;
163159 }
164160
165161 }
180180 bool Process::StandardInIsUserInput() {
181181 #if HAVE_ISATTY
182182 return isatty(0);
183 #endif
183 #else
184184 // If we don't have isatty, just return false.
185185 return false;
186 #endif
186187 }
187188
188189 bool Process::StandardOutIsDisplayed() {
189190 #if HAVE_ISATTY
190191 return isatty(1);
191 #endif
192 #else
192193 // If we don't have isatty, just return false.
193194 return false;
195 #endif
194196 }
195197
196198 bool Process::StandardErrIsDisplayed() {
197199 #if HAVE_ISATTY
198200 return isatty(2);
199 #endif
201 #else
200202 // If we don't have isatty, just return false.
201203 return false;
204 #endif
202205 }
203206
204207 static unsigned getColumns(int FileID) {