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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 #if ASSERT_DISABLED | 369 #if ASSERT_DISABLED |
370 #define RELEASE_ASSERT(assertion) (UNLIKELY(!(assertion)) ? (IMMEDIATE_CRASH())
: (void)0) | 370 #define RELEASE_ASSERT(assertion) (UNLIKELY(!(assertion)) ? (IMMEDIATE_CRASH())
: (void)0) |
371 #define RELEASE_ASSERT_WITH_MESSAGE(assertion, ...) RELEASE_ASSERT(assertion) | 371 #define RELEASE_ASSERT_WITH_MESSAGE(assertion, ...) RELEASE_ASSERT(assertion) |
372 #define RELEASE_ASSERT_NOT_REACHED() IMMEDIATE_CRASH() | 372 #define RELEASE_ASSERT_NOT_REACHED() IMMEDIATE_CRASH() |
373 #else | 373 #else |
374 #define RELEASE_ASSERT(assertion) ASSERT(assertion) | 374 #define RELEASE_ASSERT(assertion) ASSERT(assertion) |
375 #define RELEASE_ASSERT_WITH_MESSAGE(assertion, ...) ASSERT_WITH_MESSAGE(assertio
n, __VA_ARGS__) | 375 #define RELEASE_ASSERT_WITH_MESSAGE(assertion, ...) ASSERT_WITH_MESSAGE(assertio
n, __VA_ARGS__) |
376 #define RELEASE_ASSERT_NOT_REACHED() ASSERT_NOT_REACHED() | 376 #define RELEASE_ASSERT_NOT_REACHED() ASSERT_NOT_REACHED() |
377 #endif | 377 #endif |
378 | 378 |
| 379 /* DEFINE_TYPE_CASTS */ |
| 380 |
| 381 #define DEFINE_TYPE_CASTS(thisType, argumentType, argumentName, pointerPredicate
, referencePredicate) \ |
| 382 inline thisType* to##thisType(argumentType* argumentName) \ |
| 383 { \ |
| 384 ASSERT_WITH_SECURITY_IMPLICATION(!argumentName || (pointerPredicate)); \ |
| 385 return static_cast<thisType*>(argumentName); \ |
| 386 } \ |
| 387 inline const thisType* to##thisType(const argumentType* argumentName) \ |
| 388 { \ |
| 389 ASSERT_WITH_SECURITY_IMPLICATION(!argumentName || (pointerPredicate)); \ |
| 390 return static_cast<const thisType*>(argumentName); \ |
| 391 } \ |
| 392 inline thisType& to##thisType(argumentType& argumentName) \ |
| 393 { \ |
| 394 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \ |
| 395 return static_cast<thisType&>(argumentName); \ |
| 396 } \ |
| 397 inline const thisType& to##thisType(const argumentType& argumentName) \ |
| 398 { \ |
| 399 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \ |
| 400 return static_cast<const thisType&>(argumentName); \ |
| 401 } \ |
| 402 void to##thisType(const thisType*); \ |
| 403 void to##thisType(const thisType&) |
| 404 |
379 #endif /* WTF_Assertions_h */ | 405 #endif /* WTF_Assertions_h */ |
OLD | NEW |