OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 136 |
137 /* CRASH() - Raises a fatal error resulting in program termination and triggerin
g either the debugger or the crash reporter. | 137 /* CRASH() - Raises a fatal error resulting in program termination and triggerin
g either the debugger or the crash reporter. |
138 | 138 |
139 Use CRASH() in response to known, unrecoverable errors like out-of-memory. | 139 Use CRASH() in response to known, unrecoverable errors like out-of-memory. |
140 Macro is enabled in both debug and release mode. | 140 Macro is enabled in both debug and release mode. |
141 To test for unknown errors and verify assumptions, use ASSERT instead, to avo
id impacting performance in release builds. | 141 To test for unknown errors and verify assumptions, use ASSERT instead, to avo
id impacting performance in release builds. |
142 | 142 |
143 Signals are ignored by the crash reporter on OS X so we must do better. | 143 Signals are ignored by the crash reporter on OS X so we must do better. |
144 */ | 144 */ |
145 #ifndef CRASH | 145 #ifndef CRASH |
| 146 #if COMPILER(MSVC) |
| 147 #if COMPILER(CLANG) |
| 148 #define CRASH() (__debugbreak(), __builtin_unreachable()) |
| 149 #else |
| 150 #define CRASH() __debugbreak() |
| 151 #endif |
| 152 #else |
146 #define CRASH() \ | 153 #define CRASH() \ |
147 (WTFReportBacktrace(), \ | 154 (WTFReportBacktrace(), \ |
148 (*(int*)0xfbadbeef = 0), \ | 155 (*(int*)0xfbadbeef = 0), \ |
149 IMMEDIATE_CRASH()) | 156 IMMEDIATE_CRASH()) |
150 #endif | 157 #endif |
| 158 #endif |
151 | 159 |
152 #if COMPILER(CLANG) | 160 #if COMPILER(CLANG) |
153 #define NO_RETURN_DUE_TO_CRASH NO_RETURN | 161 #define NO_RETURN_DUE_TO_CRASH NO_RETURN |
154 #else | 162 #else |
155 #define NO_RETURN_DUE_TO_CRASH | 163 #define NO_RETURN_DUE_TO_CRASH |
156 #endif | 164 #endif |
157 | 165 |
158 /* BACKTRACE | 166 /* BACKTRACE |
159 | 167 |
160 Print a backtrace to the same location as ASSERT messages. | 168 Print a backtrace to the same location as ASSERT messages. |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 } \ | 401 } \ |
394 inline const thisType& to##thisType(const argumentType& argumentName) \ | 402 inline const thisType& to##thisType(const argumentType& argumentName) \ |
395 { \ | 403 { \ |
396 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \ | 404 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \ |
397 return static_cast<const thisType&>(argumentName); \ | 405 return static_cast<const thisType&>(argumentName); \ |
398 } \ | 406 } \ |
399 void to##thisType(const thisType*); \ | 407 void to##thisType(const thisType*); \ |
400 void to##thisType(const thisType&) | 408 void to##thisType(const thisType&) |
401 | 409 |
402 #endif /* WTF_Assertions_h */ | 410 #endif /* WTF_Assertions_h */ |
OLD | NEW |