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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 #undef ASSERT | 191 #undef ASSERT |
192 #endif | 192 #endif |
193 | 193 |
194 #if ASSERT_DISABLED | 194 #if ASSERT_DISABLED |
195 | 195 |
196 #define ASSERT(assertion) ((void)0) | 196 #define ASSERT(assertion) ((void)0) |
197 #define ASSERT_AT(assertion, file, line, function) ((void)0) | 197 #define ASSERT_AT(assertion, file, line, function) ((void)0) |
198 #define ASSERT_NOT_REACHED() ((void)0) | 198 #define ASSERT_NOT_REACHED() ((void)0) |
199 #define NO_RETURN_DUE_TO_ASSERT | 199 #define NO_RETURN_DUE_TO_ASSERT |
200 | 200 |
201 #if COMPILER(INTEL) && !OS(WINDOWS) | |
202 template<typename T> | |
203 inline void assertUnused(T& x) { (void)x; } | |
204 #define ASSERT_UNUSED(variable, assertion) (assertUnused(variable)) | |
205 #else | |
206 #define ASSERT_UNUSED(variable, assertion) ((void)variable) | 201 #define ASSERT_UNUSED(variable, assertion) ((void)variable) |
207 #endif | |
208 | 202 |
209 #else | 203 #else |
210 | 204 |
211 #define ASSERT(assertion) \ | 205 #define ASSERT(assertion) \ |
212 (!(assertion) ? \ | 206 (!(assertion) ? \ |
213 (WTFReportAssertionFailure(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, #ass
ertion), \ | 207 (WTFReportAssertionFailure(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, #ass
ertion), \ |
214 CRASH()) : \ | 208 CRASH()) : \ |
215 (void)0) | 209 (void)0) |
216 | 210 |
217 #define ASSERT_AT(assertion, file, line, function) \ | 211 #define ASSERT_AT(assertion, file, line, function) \ |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 if (!(assertion)) { \ | 256 if (!(assertion)) { \ |
263 WTFReportAssertionFailureWithMessage(__FILE__, __LINE__, WTF_PRETTY_FUNC
TION, #assertion, __VA_ARGS__); \ | 257 WTFReportAssertionFailureWithMessage(__FILE__, __LINE__, WTF_PRETTY_FUNC
TION, #assertion, __VA_ARGS__); \ |
264 CRASH(); \ | 258 CRASH(); \ |
265 } \ | 259 } \ |
266 while (0) | 260 while (0) |
267 #endif | 261 #endif |
268 | 262 |
269 /* ASSERT_WITH_MESSAGE_UNUSED */ | 263 /* ASSERT_WITH_MESSAGE_UNUSED */ |
270 | 264 |
271 #if ASSERT_MSG_DISABLED | 265 #if ASSERT_MSG_DISABLED |
272 #if COMPILER(INTEL) && !OS(WINDOWS) | |
273 template<typename T> | |
274 inline void assertWithMessageUnused(T& x) { (void)x; } | |
275 #define ASSERT_WITH_MESSAGE_UNUSED(variable, assertion, ...) (assertWithMessageU
nused(variable)) | |
276 #else | |
277 #define ASSERT_WITH_MESSAGE_UNUSED(variable, assertion, ...) ((void)variable) | 266 #define ASSERT_WITH_MESSAGE_UNUSED(variable, assertion, ...) ((void)variable) |
278 #endif | |
279 #else | 267 #else |
280 #define ASSERT_WITH_MESSAGE_UNUSED(variable, assertion, ...) do \ | 268 #define ASSERT_WITH_MESSAGE_UNUSED(variable, assertion, ...) do \ |
281 if (!(assertion)) { \ | 269 if (!(assertion)) { \ |
282 WTFReportAssertionFailureWithMessage(__FILE__, __LINE__, WTF_PRETTY_FUNC
TION, #assertion, __VA_ARGS__); \ | 270 WTFReportAssertionFailureWithMessage(__FILE__, __LINE__, WTF_PRETTY_FUNC
TION, #assertion, __VA_ARGS__); \ |
283 CRASH(); \ | 271 CRASH(); \ |
284 } \ | 272 } \ |
285 while (0) | 273 while (0) |
286 #endif | 274 #endif |
287 | 275 |
288 /* ASSERT_ARG */ | 276 /* ASSERT_ARG */ |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 #define RELEASE_ASSERT(assertion) (UNLIKELY(!(assertion)) ? (IMMEDIATE_CRASH())
: (void)0) | 367 #define RELEASE_ASSERT(assertion) (UNLIKELY(!(assertion)) ? (IMMEDIATE_CRASH())
: (void)0) |
380 #define RELEASE_ASSERT_WITH_MESSAGE(assertion, ...) RELEASE_ASSERT(assertion) | 368 #define RELEASE_ASSERT_WITH_MESSAGE(assertion, ...) RELEASE_ASSERT(assertion) |
381 #define RELEASE_ASSERT_NOT_REACHED() IMMEDIATE_CRASH() | 369 #define RELEASE_ASSERT_NOT_REACHED() IMMEDIATE_CRASH() |
382 #else | 370 #else |
383 #define RELEASE_ASSERT(assertion) ASSERT(assertion) | 371 #define RELEASE_ASSERT(assertion) ASSERT(assertion) |
384 #define RELEASE_ASSERT_WITH_MESSAGE(assertion, ...) ASSERT_WITH_MESSAGE(assertio
n, __VA_ARGS__) | 372 #define RELEASE_ASSERT_WITH_MESSAGE(assertion, ...) ASSERT_WITH_MESSAGE(assertio
n, __VA_ARGS__) |
385 #define RELEASE_ASSERT_NOT_REACHED() ASSERT_NOT_REACHED() | 373 #define RELEASE_ASSERT_NOT_REACHED() ASSERT_NOT_REACHED() |
386 #endif | 374 #endif |
387 | 375 |
388 #endif /* WTF_Assertions_h */ | 376 #endif /* WTF_Assertions_h */ |
OLD | NEW |