| 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 |
| 11 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
| 12 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
| 13 * | 13 * |
| 14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
| 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
| 18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #ifndef WTF_Assertions_h | 27 #ifndef WTF_Assertions_h |
| 28 #define WTF_Assertions_h | 28 #define WTF_Assertions_h |
| 29 | 29 |
| 30 /* | 30 // This file uses some GCC extensions, but it should be compatible with C++ and |
| 31 No namespaces because this file has to be includable from C and Objective-C. | 31 // Objective C++. |
| 32 | 32 // |
| 33 Note, this file uses many GCC extensions, but it should be compatible with | 33 // For non-debug builds, everything is disabled by default, except for the |
| 34 C, Objective C, C++, and Objective C++. | 34 // RELEASE_ASSERT family of macros. |
| 35 | |
| 36 For non-debug builds, everything is disabled by default, except for the | |
| 37 RELEASE_ASSERT family of macros. | |
| 38 | |
| 39 Defining any of the symbols explicitly prevents this from having any effect. | |
| 40 | |
| 41 */ | |
| 42 | 35 |
| 43 #include "base/gtest_prod_util.h" | 36 #include "base/gtest_prod_util.h" |
| 44 #include "base/logging.h" | 37 #include "base/logging.h" |
| 45 #include "wtf/Compiler.h" | 38 #include "wtf/Compiler.h" |
| 46 #include "wtf/Noncopyable.h" | 39 #include "wtf/Noncopyable.h" |
| 47 #include "wtf/WTFExport.h" | 40 #include "wtf/WTFExport.h" |
| 48 #include "wtf/build_config.h" | 41 #include "wtf/build_config.h" |
| 49 #include <stdarg.h> | 42 #include <stdarg.h> |
| 50 | 43 |
| 51 #if OS(WIN) | 44 #if OS(WIN) |
| 52 #include <windows.h> | 45 #include <windows.h> |
| 53 #endif | 46 #endif |
| 54 | 47 |
| 55 // Users must test "#if ENABLE(ASSERT)", which helps ensure that code | 48 // Users must test "#if ENABLE(ASSERT)", which helps ensure that code |
| 56 // testing this macro has included this header. | 49 // testing this macro has included this header. |
| 57 #ifndef ENABLE_ASSERT | 50 #ifndef ENABLE_ASSERT |
| 58 #if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) | 51 #if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) |
| 59 /* Disable ASSERT* macros in release mode by default. */ | 52 /* Disable ASSERT* macros in release mode by default. */ |
| 60 #define ENABLE_ASSERT 0 | 53 #define ENABLE_ASSERT 0 |
| 61 #else | 54 #else |
| 62 #define ENABLE_ASSERT 1 | 55 #define ENABLE_ASSERT 1 |
| 63 #endif /* defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) */ | 56 #endif /* defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) */ |
| 64 #endif | 57 #endif |
| 65 | 58 |
| 66 #ifndef ASSERT_MSG_DISABLED | |
| 67 #define ASSERT_MSG_DISABLED !ENABLE(ASSERT) | |
| 68 #endif | |
| 69 | |
| 70 #ifndef LOG_DISABLED | 59 #ifndef LOG_DISABLED |
| 71 #define LOG_DISABLED !ENABLE(ASSERT) | 60 #define LOG_DISABLED !ENABLE(ASSERT) |
| 72 #endif | 61 #endif |
| 73 | 62 |
| 74 #if COMPILER(GCC) | 63 #if COMPILER(GCC) |
| 75 #define WTF_ATTRIBUTE_PRINTF(formatStringArgument, extraArguments) __attribute__
((__format__(printf, formatStringArgument, extraArguments))) | 64 #define WTF_ATTRIBUTE_PRINTF(formatStringArgument, extraArguments) __attribute__
((__format__(printf, formatStringArgument, extraArguments))) |
| 76 #else | 65 #else |
| 77 #define WTF_ATTRIBUTE_PRINTF(formatStringArgument, extraArguments) | 66 #define WTF_ATTRIBUTE_PRINTF(formatStringArgument, extraArguments) |
| 78 #endif | 67 #endif |
| 79 | 68 |
| 80 /* These helper functions are always declared, but not necessarily always define
d if the corresponding function is disabled. */ | 69 // These helper functions are always declared, but not necessarily always |
| 70 // defined if the corresponding function is disabled. |
| 81 | 71 |
| 82 WTF_EXPORT void WTFReportAssertionFailure(const char* file, int line, const char
* function, const char* assertion); | 72 WTF_EXPORT void WTFReportAssertionFailure(const char* file, int line, const char
* function, const char* assertion); |
| 73 // WTFLogAlways() is deprecated. crbug.com/638849 |
| 83 WTF_EXPORT void WTFLogAlways(const char* format, ...) WTF_ATTRIBUTE_PRINTF(1, 2)
; | 74 WTF_EXPORT void WTFLogAlways(const char* format, ...) WTF_ATTRIBUTE_PRINTF(1, 2)
; |
| 84 | |
| 85 WTF_EXPORT void WTFGetBacktrace(void** stack, int* size); | |
| 86 WTF_EXPORT void WTFReportBacktrace(int framesToShow = 31); | 75 WTF_EXPORT void WTFReportBacktrace(int framesToShow = 31); |
| 87 WTF_EXPORT void WTFPrintBacktrace(void** stack, int size); | |
| 88 | 76 |
| 89 namespace WTF { | 77 namespace WTF { |
| 90 | 78 |
| 91 #if LOG_DISABLED | 79 #if LOG_DISABLED |
| 92 | 80 |
| 93 #define WTF_CREATE_SCOPED_LOGGER(...) ((void) 0) | 81 #define WTF_CREATE_SCOPED_LOGGER(...) ((void) 0) |
| 94 #define WTF_CREATE_SCOPED_LOGGER_IF(...) ((void) 0) | 82 #define WTF_CREATE_SCOPED_LOGGER_IF(...) ((void) 0) |
| 95 #define WTF_APPEND_SCOPED_LOGGER(...) ((void) 0) | 83 #define WTF_APPEND_SCOPED_LOGGER(...) ((void) 0) |
| 96 | 84 |
| 97 #else | 85 #else |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 }; | 119 }; |
| 132 | 120 |
| 133 #define WTF_CREATE_SCOPED_LOGGER(name, ...) WTF::ScopedLogger name(true, __VA_AR
GS__) | 121 #define WTF_CREATE_SCOPED_LOGGER(name, ...) WTF::ScopedLogger name(true, __VA_AR
GS__) |
| 134 #define WTF_CREATE_SCOPED_LOGGER_IF(name, condition, ...) WTF::ScopedLogger name
(condition, __VA_ARGS__) | 122 #define WTF_CREATE_SCOPED_LOGGER_IF(name, condition, ...) WTF::ScopedLogger name
(condition, __VA_ARGS__) |
| 135 #define WTF_APPEND_SCOPED_LOGGER(name, ...) (name.log(__VA_ARGS__)) | 123 #define WTF_APPEND_SCOPED_LOGGER(name, ...) (name.log(__VA_ARGS__)) |
| 136 | 124 |
| 137 #endif // LOG_DISABLED | 125 #endif // LOG_DISABLED |
| 138 | 126 |
| 139 } // namespace WTF | 127 } // namespace WTF |
| 140 | 128 |
| 141 /* IMMEDIATE_CRASH() - Like CRASH() below but crashes in the fastest, simplest p
ossible way with no attempt at logging. */ | 129 // IMMEDIATE_CRASH() - Like CRASH() below but crashes in the fastest, simplest |
| 130 // possible way with no attempt at logging. |
| 142 #ifndef IMMEDIATE_CRASH | 131 #ifndef IMMEDIATE_CRASH |
| 143 #if COMPILER(GCC) || COMPILER(CLANG) | 132 #if COMPILER(GCC) || COMPILER(CLANG) |
| 144 #define IMMEDIATE_CRASH() __builtin_trap() | 133 #define IMMEDIATE_CRASH() __builtin_trap() |
| 145 #else | 134 #else |
| 146 #define IMMEDIATE_CRASH() ((void)(*(volatile char*)0 = 0)) | 135 #define IMMEDIATE_CRASH() ((void)(*(volatile char*)0 = 0)) |
| 147 #endif | 136 #endif |
| 148 #endif | 137 #endif |
| 149 | 138 |
| 150 /* OOM_CRASH() - Specialization of IMMEDIATE_CRASH which will raise a custom exc
eption on Windows to signal this is OOM and not a normal assert. */ | 139 // OOM_CRASH() - Specialization of IMMEDIATE_CRASH which will raise a custom |
| 140 // exception on Windows to signal this is OOM and not a normal assert. |
| 151 #ifndef OOM_CRASH | 141 #ifndef OOM_CRASH |
| 152 #if OS(WIN) | 142 #if OS(WIN) |
| 153 #define OOM_CRASH() do { \ | 143 #define OOM_CRASH() do { \ |
| 154 ::RaiseException(0xE0000008, EXCEPTION_NONCONTINUABLE, 0, nullptr); \ | 144 ::RaiseException(0xE0000008, EXCEPTION_NONCONTINUABLE, 0, nullptr); \ |
| 155 IMMEDIATE_CRASH(); \ | 145 IMMEDIATE_CRASH(); \ |
| 156 } while (0) | 146 } while (0) |
| 157 #else | 147 #else |
| 158 #define OOM_CRASH() IMMEDIATE_CRASH() | 148 #define OOM_CRASH() IMMEDIATE_CRASH() |
| 159 #endif | 149 #endif |
| 160 #endif | 150 #endif |
| 161 | 151 |
| 162 /* CRASH() - Raises a fatal error resulting in program termination and triggerin
g either the debugger or the crash reporter. | 152 // CRASH() - Raises a fatal error resulting in program termination and |
| 163 | 153 // triggering either the debugger or the crash reporter. |
| 164 Use CRASH() in response to known, unrecoverable errors like out-of-memory. | 154 // |
| 165 Macro is enabled in both debug and release mode. | 155 // Use CRASH() in response to known, unrecoverable errors like out-of-memory. |
| 166 To test for unknown errors and verify assumptions, use ASSERT instead, to avo
id impacting performance in release builds. | 156 // Macro is enabled in both debug and release mode. |
| 167 | 157 // To test for unknown errors and verify assumptions, use ASSERT instead, to |
| 168 Signals are ignored by the crash reporter on OS X so we must do better. | 158 // avoid impacting performance in release builds. |
| 169 */ | 159 // |
| 160 // Signals are ignored by the crash reporter on OS X so we must do better. |
| 170 #ifndef CRASH | 161 #ifndef CRASH |
| 171 #if COMPILER(MSVC) | 162 #if COMPILER(MSVC) |
| 172 #define CRASH() (__debugbreak(), IMMEDIATE_CRASH()) | 163 #define CRASH() (__debugbreak(), IMMEDIATE_CRASH()) |
| 173 #else | 164 #else |
| 174 #define CRASH() \ | 165 #define CRASH() \ |
| 175 (WTFReportBacktrace(), (*(int*)0xfbadbeef = 0), IMMEDIATE_CRASH()) | 166 (WTFReportBacktrace(), (*(int*)0xfbadbeef = 0), IMMEDIATE_CRASH()) |
| 176 #endif | 167 #endif |
| 177 #endif | 168 #endif |
| 178 | 169 |
| 179 #if COMPILER(CLANG) | 170 #if COMPILER(CLANG) |
| 180 #define NO_RETURN_DUE_TO_CRASH NO_RETURN | 171 #define NO_RETURN_DUE_TO_CRASH NO_RETURN |
| 181 #else | 172 #else |
| 182 #define NO_RETURN_DUE_TO_CRASH | 173 #define NO_RETURN_DUE_TO_CRASH |
| 183 #endif | 174 #endif |
| 184 | 175 |
| 185 // ASSERT, ASSERT_NOT_REACHED, ASSERT_UNUSED | 176 // ASSERT, ASSERT_NOT_REACHED, ASSERT_UNUSED |
| 186 // These macros are compiled out of release builds. | 177 // These macros are compiled out of release builds. |
| 187 // Expressions inside them are evaluated in debug builds only. | 178 // Expressions inside them are evaluated in debug builds only. |
| 188 // They are deprecated. We should use: | 179 // They are deprecated. We should use: |
| 189 // - DCHECK() for ASSERT() | 180 // - DCHECK() for ASSERT() |
| 190 // - NOTREACHED() for ASSERT_NOT_REACHED() | 181 // - NOTREACHED() for ASSERT_NOT_REACHED() |
| 191 // - DCHECK() and ALLOW_UNUSED_LOCAL() for ASSERT_UNUSED(). | 182 // - DCHECK() and ALLOW_UNUSED_LOCAL() for ASSERT_UNUSED(). |
| 192 #if OS(WIN) | 183 #if OS(WIN) |
| 193 /* FIXME: Change to use something other than ASSERT to avoid this conflict with
the underlying platform */ | 184 // FIXME: Change to use something other than ASSERT to avoid this conflict with |
| 185 // the underlying platform. |
| 194 #undef ASSERT | 186 #undef ASSERT |
| 195 #endif | 187 #endif |
| 196 | 188 |
| 197 #if ENABLE(ASSERT) | 189 #if ENABLE(ASSERT) |
| 198 | 190 |
| 199 #define ASSERT(assertion) \ | 191 #define ASSERT(assertion) \ |
| 200 (!(assertion) ? \ | 192 (!(assertion) ? \ |
| 201 (WTFReportAssertionFailure(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, #ass
ertion), \ | 193 (WTFReportAssertionFailure(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, #ass
ertion), \ |
| 202 CRASH()) : \ | 194 CRASH()) : \ |
| 203 (void)0) | 195 (void)0) |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 #if ENABLE_SECURITY_ASSERT | 248 #if ENABLE_SECURITY_ASSERT |
| 257 #define SECURITY_DCHECK(condition) LOG_IF(FATAL, !(condition)) << "Security chec
k failed: " #condition ". " | 249 #define SECURITY_DCHECK(condition) LOG_IF(FATAL, !(condition)) << "Security chec
k failed: " #condition ". " |
| 258 // TODO(tkent): Should we make SECURITY_CHECK different from SECURITY_DCHECK? | 250 // TODO(tkent): Should we make SECURITY_CHECK different from SECURITY_DCHECK? |
| 259 // A SECURITY_CHECK failure is actually not vulnerable. | 251 // A SECURITY_CHECK failure is actually not vulnerable. |
| 260 #define SECURITY_CHECK(condition) SECURITY_DCHECK(condition) | 252 #define SECURITY_CHECK(condition) SECURITY_DCHECK(condition) |
| 261 #else | 253 #else |
| 262 #define SECURITY_DCHECK(condition) ((void)0) | 254 #define SECURITY_DCHECK(condition) ((void)0) |
| 263 #define SECURITY_CHECK(condition) CHECK(condition) | 255 #define SECURITY_CHECK(condition) CHECK(condition) |
| 264 #endif | 256 #endif |
| 265 | 257 |
| 266 /* RELEASE_ASSERT | 258 // RELEASE_ASSERT |
| 267 | 259 // Use in places where failure of an assertion indicates a definite security |
| 268 Use in places where failure of an assertion indicates a definite security | 260 // vulnerability from which execution must not continue even in a release build. |
| 269 vulnerability from which execution must not continue even in a release build. | 261 // Please sure to file bugs for these failures using the security template: |
| 270 Please sure to file bugs for these failures using the security template: | 262 // http://code.google.com/p/chromium/issues/entry?template=Security%20Bug |
| 271 http://code.google.com/p/chromium/issues/entry?template=Security%20Bug | |
| 272 */ | |
| 273 // RELEASE_ASSERT is deprecated. We should use CHECK() instead. | 263 // RELEASE_ASSERT is deprecated. We should use CHECK() instead. |
| 274 #if ENABLE(ASSERT) | 264 #if ENABLE(ASSERT) |
| 275 #define RELEASE_ASSERT(assertion) ASSERT(assertion) | 265 #define RELEASE_ASSERT(assertion) ASSERT(assertion) |
| 276 #else | 266 #else |
| 277 #define RELEASE_ASSERT(assertion) (UNLIKELY(!(assertion)) ? (IMMEDIATE_CRASH())
: (void)0) | 267 #define RELEASE_ASSERT(assertion) (UNLIKELY(!(assertion)) ? (IMMEDIATE_CRASH())
: (void)0) |
| 278 #endif | 268 #endif |
| 279 // TODO(tkent): Move this to base/logging.h? | 269 // TODO(tkent): Move this to base/logging.h? |
| 280 #define RELEASE_NOTREACHED() LOG(FATAL) | 270 #define RELEASE_NOTREACHED() LOG(FATAL) |
| 281 | 271 |
| 282 /* DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES */ | 272 // DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES |
| 283 | 273 // Allow equality comparisons of Objects by reference or pointer, |
| 284 // Allow equality comparisons of Objects by reference or pointer, interchangeabl
y. | 274 // interchangeably. This can be only used on types whose equality makes no |
| 285 // This can be only used on types whose equality makes no other sense than point
er equality. | 275 // other sense than pointer equality. |
| 286 #define DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES(thisType) \ | 276 #define DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES(thisType) \ |
| 287 inline bool operator==(const thisType& a, const thisType& b) { return &a ==
&b; } \ | 277 inline bool operator==(const thisType& a, const thisType& b) { return &a ==
&b; } \ |
| 288 inline bool operator==(const thisType& a, const thisType* b) { return &a ==
b; } \ | 278 inline bool operator==(const thisType& a, const thisType* b) { return &a ==
b; } \ |
| 289 inline bool operator==(const thisType* a, const thisType& b) { return a == &
b; } \ | 279 inline bool operator==(const thisType* a, const thisType& b) { return a == &
b; } \ |
| 290 inline bool operator!=(const thisType& a, const thisType& b) { return !(a ==
b); } \ | 280 inline bool operator!=(const thisType& a, const thisType& b) { return !(a ==
b); } \ |
| 291 inline bool operator!=(const thisType& a, const thisType* b) { return !(a ==
b); } \ | 281 inline bool operator!=(const thisType& a, const thisType* b) { return !(a ==
b); } \ |
| 292 inline bool operator!=(const thisType* a, const thisType& b) { return !(a ==
b); } | 282 inline bool operator!=(const thisType* a, const thisType& b) { return !(a ==
b); } |
| 293 | 283 |
| 294 /* DEFINE_TYPE_CASTS */ | 284 // DEFINE_TYPE_CASTS |
| 295 | 285 // Provide static_cast<> wrappers with ASSERT_WITH_SECURITY_IMPLICATION for bad |
| 286 // casts. |
| 296 #define DEFINE_TYPE_CASTS(thisType, argumentType, argumentName, pointerPredicate
, referencePredicate) \ | 287 #define DEFINE_TYPE_CASTS(thisType, argumentType, argumentName, pointerPredicate
, referencePredicate) \ |
| 297 inline thisType* to##thisType(argumentType* argumentName) \ | 288 inline thisType* to##thisType(argumentType* argumentName) \ |
| 298 { \ | 289 { \ |
| 299 ASSERT_WITH_SECURITY_IMPLICATION(!argumentName || (pointerPredicate)); \ | 290 ASSERT_WITH_SECURITY_IMPLICATION(!argumentName || (pointerPredicate)); \ |
| 300 return static_cast<thisType*>(argumentName); \ | 291 return static_cast<thisType*>(argumentName); \ |
| 301 } \ | 292 } \ |
| 302 inline const thisType* to##thisType(const argumentType* argumentName) \ | 293 inline const thisType* to##thisType(const argumentType* argumentName) \ |
| 303 { \ | 294 { \ |
| 304 ASSERT_WITH_SECURITY_IMPLICATION(!argumentName || (pointerPredicate)); \ | 295 ASSERT_WITH_SECURITY_IMPLICATION(!argumentName || (pointerPredicate)); \ |
| 305 return static_cast<const thisType*>(argumentName); \ | 296 return static_cast<const thisType*>(argumentName); \ |
| 306 } \ | 297 } \ |
| 307 inline thisType& to##thisType(argumentType& argumentName) \ | 298 inline thisType& to##thisType(argumentType& argumentName) \ |
| 308 { \ | 299 { \ |
| 309 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \ | 300 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \ |
| 310 return static_cast<thisType&>(argumentName); \ | 301 return static_cast<thisType&>(argumentName); \ |
| 311 } \ | 302 } \ |
| 312 inline const thisType& to##thisType(const argumentType& argumentName) \ | 303 inline const thisType& to##thisType(const argumentType& argumentName) \ |
| 313 { \ | 304 { \ |
| 314 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \ | 305 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \ |
| 315 return static_cast<const thisType&>(argumentName); \ | 306 return static_cast<const thisType&>(argumentName); \ |
| 316 } \ | 307 } \ |
| 317 void to##thisType(const thisType*); \ | 308 void to##thisType(const thisType*); \ |
| 318 void to##thisType(const thisType&) | 309 void to##thisType(const thisType&) |
| 319 | 310 |
| 320 #endif /* WTF_Assertions_h */ | 311 #endif // WTF_Assertions_h |
| OLD | NEW |