Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: webrtc/rtc_base/checks.h

Issue 3007253002: Remove typedefs.h from webrtc/ root (part 1)
Patch Set: backwards compatible FALLTHROUGH #define Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/rtc_base/arch.h ('k') | webrtc/rtc_base/checks.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2006 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #ifndef WEBRTC_RTC_BASE_CHECKS_H_ 11 #ifndef WEBRTC_RTC_BASE_CHECKS_H_
12 #define WEBRTC_RTC_BASE_CHECKS_H_ 12 #define WEBRTC_RTC_BASE_CHECKS_H_
13 13
14 #include "webrtc/typedefs.h"
15
16 // If you for some reson need to know if DCHECKs are on, test the value of 14 // If you for some reson need to know if DCHECKs are on, test the value of
17 // RTC_DCHECK_IS_ON. (Test its value, not if it's defined; it'll always be 15 // RTC_DCHECK_IS_ON. (Test its value, not if it's defined; it'll always be
18 // defined, to either a true or a false value.) 16 // defined, to either a true or a false value.)
19 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) 17 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
20 #define RTC_DCHECK_IS_ON 1 18 #define RTC_DCHECK_IS_ON 1
21 #else 19 #else
22 #define RTC_DCHECK_IS_ON 0 20 #define RTC_DCHECK_IS_ON 0
23 #endif 21 #endif
24 22
23 // Annotate a function that will not return control flow to the caller.
24 #if defined(_MSC_VER)
25 #define RTC_NO_RETURN __declspec(noreturn)
26 #elif defined(__GNUC__)
27 #define RTC_NO_RETURN __attribute__ ((__noreturn__))
28 #else
29 #define RTC_NO_RETURN
30 #endif
31
25 #ifdef __cplusplus 32 #ifdef __cplusplus
26 extern "C" { 33 extern "C" {
27 #endif 34 #endif
28 NO_RETURN void rtc_FatalMessage(const char* file, int line, const char* msg); 35 RTC_NO_RETURN
36 void rtc_FatalMessage(const char* file, int line, const char* msg);
29 #ifdef __cplusplus 37 #ifdef __cplusplus
30 } // extern "C" 38 } // extern "C"
31 #endif 39 #endif
32 40
33 #ifdef __cplusplus 41 #ifdef __cplusplus
34 // C++ version. 42 // C++ version.
35 43
36 #include <sstream> 44 #include <sstream>
37 #include <string> 45 #include <string>
38 46
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 // TODO(ajm): Consider adding RTC_NOTIMPLEMENTED macro when 233 // TODO(ajm): Consider adding RTC_NOTIMPLEMENTED macro when
226 // base/logging.h and system_wrappers/logging.h are consolidated such that we 234 // base/logging.h and system_wrappers/logging.h are consolidated such that we
227 // can match the Chromium behavior. 235 // can match the Chromium behavior.
228 236
229 // Like a stripped-down LogMessage from logging.h, except that it aborts. 237 // Like a stripped-down LogMessage from logging.h, except that it aborts.
230 class FatalMessage { 238 class FatalMessage {
231 public: 239 public:
232 FatalMessage(const char* file, int line); 240 FatalMessage(const char* file, int line);
233 // Used for RTC_CHECK_EQ(), etc. Takes ownership of the given string. 241 // Used for RTC_CHECK_EQ(), etc. Takes ownership of the given string.
234 FatalMessage(const char* file, int line, std::string* result); 242 FatalMessage(const char* file, int line, std::string* result);
235 NO_RETURN ~FatalMessage(); 243 RTC_NO_RETURN ~FatalMessage();
236 244
237 std::ostream& stream() { return stream_; } 245 std::ostream& stream() { return stream_; }
238 246
239 private: 247 private:
240 void Init(const char* file, int line); 248 void Init(const char* file, int line);
241 249
242 std::ostringstream stream_; 250 std::ostringstream stream_;
243 }; 251 };
244 252
245 // Performs the integer division a/b and returns the result. CHECKs that the 253 // Performs the integer division a/b and returns the result. CHECKs that the
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 #define RTC_DCHECK_EQ(a, b) RTC_DCHECK((a) == (b)) 288 #define RTC_DCHECK_EQ(a, b) RTC_DCHECK((a) == (b))
281 #define RTC_DCHECK_NE(a, b) RTC_DCHECK((a) != (b)) 289 #define RTC_DCHECK_NE(a, b) RTC_DCHECK((a) != (b))
282 #define RTC_DCHECK_LE(a, b) RTC_DCHECK((a) <= (b)) 290 #define RTC_DCHECK_LE(a, b) RTC_DCHECK((a) <= (b))
283 #define RTC_DCHECK_LT(a, b) RTC_DCHECK((a) < (b)) 291 #define RTC_DCHECK_LT(a, b) RTC_DCHECK((a) < (b))
284 #define RTC_DCHECK_GE(a, b) RTC_DCHECK((a) >= (b)) 292 #define RTC_DCHECK_GE(a, b) RTC_DCHECK((a) >= (b))
285 #define RTC_DCHECK_GT(a, b) RTC_DCHECK((a) > (b)) 293 #define RTC_DCHECK_GT(a, b) RTC_DCHECK((a) > (b))
286 294
287 #endif // __cplusplus 295 #endif // __cplusplus
288 296
289 #endif // WEBRTC_RTC_BASE_CHECKS_H_ 297 #endif // WEBRTC_RTC_BASE_CHECKS_H_
OLDNEW
« no previous file with comments | « webrtc/rtc_base/arch.h ('k') | webrtc/rtc_base/checks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698