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

Side by Side Diff: Source/wtf/Assertions.h

Issue 14734009: More Compiler.h cleanups. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/wtf/Alignment.h ('k') | Source/wtf/Compiler.h » ('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 (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
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
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
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 */
OLDNEW
« no previous file with comments | « Source/wtf/Alignment.h ('k') | Source/wtf/Compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698