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

Side by Side Diff: runtime/platform/assert.h

Issue 11014013: Added slow_assert macro and flag for slow development assertions in the VM. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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 | « no previous file | runtime/vm/assert.h » ('j') | runtime/vm/assert.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef PLATFORM_ASSERT_H_ 5 #ifndef PLATFORM_ASSERT_H_
6 #define PLATFORM_ASSERT_H_ 6 #define PLATFORM_ASSERT_H_
7 7
8 // TODO(5411406): include sstream for now, once we have a Utils::toString() 8 // TODO(5411406): include sstream for now, once we have a Utils::toString()
9 // implemented for all the primitive types we can replace the usage of 9 // implemented for all the primitive types we can replace the usage of
10 // sstream by Utils::toString() 10 // sstream by Utils::toString()
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // error if there is no semicolon after ASSERT(condition). This 249 // error if there is no semicolon after ASSERT(condition). This
250 // ensures that we get the same behavior on DEBUG and RELEASE builds. 250 // ensures that we get the same behavior on DEBUG and RELEASE builds.
251 251
252 #define ASSERT(cond) \ 252 #define ASSERT(cond) \
253 do { \ 253 do { \
254 if (!(cond)) dart::Assert(__FILE__, __LINE__).Fail("expected: %s", #cond); \ 254 if (!(cond)) dart::Assert(__FILE__, __LINE__).Fail("expected: %s", #cond); \
255 } while (false) 255 } while (false)
256 256
257 // DEBUG_ASSERT allows identifiers in condition to be undeclared in release 257 // DEBUG_ASSERT allows identifiers in condition to be undeclared in release
258 // mode. 258 // mode.
259 #define DEBUG_ASSERT(cond) \ 259 #define DEBUG_ASSERT(cond) ASSERT(cond)
260 if (!(cond)) dart::Assert(__FILE__, __LINE__).Fail("expected: %s", #cond);
261 260
262 #else // if defined(DEBUG) 261 #else // if defined(DEBUG)
263 262
264 // In order to avoid variable unused warnings for code that only uses 263 // In order to avoid variable unused warnings for code that only uses
265 // a variable in an ASSERT or EXPECT, we make sure to use the macro 264 // a variable in an ASSERT or EXPECT, we make sure to use the macro
266 // argument. 265 // argument.
267 #define ASSERT(condition) do {} while (false && (condition)) 266 #define ASSERT(condition) do {} while (false && (condition))
268 267
269 #define DEBUG_ASSERT(cond) 268 #define DEBUG_ASSERT(cond)
270 269
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 #define WARN(error) \ 341 #define WARN(error) \
343 dart::Expect(__FILE__, __LINE__).Fail("%s", error) 342 dart::Expect(__FILE__, __LINE__).Fail("%s", error)
344 343
345 #define WARN1(format, p1) \ 344 #define WARN1(format, p1) \
346 dart::Expect(__FILE__, __LINE__).Fail(format, (p1)) 345 dart::Expect(__FILE__, __LINE__).Fail(format, (p1))
347 346
348 #define WARN2(format, p1, p2) \ 347 #define WARN2(format, p1, p2) \
349 dart::Expect(__FILE__, __LINE__).Fail(format, (p1), (p2)) 348 dart::Expect(__FILE__, __LINE__).Fail(format, (p1), (p2))
350 349
351 #endif // PLATFORM_ASSERT_H_ 350 #endif // PLATFORM_ASSERT_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/assert.h » ('j') | runtime/vm/assert.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698