| OLD | NEW |
| 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 247 |
| 248 #define FATAL3(format, p1, p2, p3) \ | 248 #define FATAL3(format, p1, p2, p3) \ |
| 249 dart::Assert(__FILE__, __LINE__).Fail(format, (p1), (p2), (p3)) | 249 dart::Assert(__FILE__, __LINE__).Fail(format, (p1), (p2), (p3)) |
| 250 | 250 |
| 251 #define UNIMPLEMENTED() \ | 251 #define UNIMPLEMENTED() \ |
| 252 FATAL("unimplemented code") | 252 FATAL("unimplemented code") |
| 253 | 253 |
| 254 #define UNREACHABLE() \ | 254 #define UNREACHABLE() \ |
| 255 FATAL("unreachable code") | 255 FATAL("unreachable code") |
| 256 | 256 |
| 257 #define OUT_OF_MEMORY() \ |
| 258 FATAL("Out of memory.") |
| 259 |
| 257 | 260 |
| 258 #if defined(DEBUG) | 261 #if defined(DEBUG) |
| 259 // DEBUG binaries use assertions in the code. | 262 // DEBUG binaries use assertions in the code. |
| 260 // Note: We wrap the if statement in a do-while so that we get a compile | 263 // Note: We wrap the if statement in a do-while so that we get a compile |
| 261 // error if there is no semicolon after ASSERT(condition). This | 264 // error if there is no semicolon after ASSERT(condition). This |
| 262 // ensures that we get the same behavior on DEBUG and RELEASE builds. | 265 // ensures that we get the same behavior on DEBUG and RELEASE builds. |
| 263 | 266 |
| 264 #define ASSERT(cond) \ | 267 #define ASSERT(cond) \ |
| 265 do { \ | 268 do { \ |
| 266 if (!(cond)) dart::Assert(__FILE__, __LINE__).Fail("expected: %s", #cond); \ | 269 if (!(cond)) dart::Assert(__FILE__, __LINE__).Fail("expected: %s", #cond); \ |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 | 373 |
| 371 #define FAIL1(format, p1) \ | 374 #define FAIL1(format, p1) \ |
| 372 dart::Expect(__FILE__, __LINE__).Fail(format, (p1)) | 375 dart::Expect(__FILE__, __LINE__).Fail(format, (p1)) |
| 373 | 376 |
| 374 #define FAIL2(format, p1, p2) \ | 377 #define FAIL2(format, p1, p2) \ |
| 375 dart::Expect(__FILE__, __LINE__).Fail(format, (p1), (p2)) | 378 dart::Expect(__FILE__, __LINE__).Fail(format, (p1), (p2)) |
| 376 | 379 |
| 377 #endif // defined(TESTING) | 380 #endif // defined(TESTING) |
| 378 | 381 |
| 379 #endif // PLATFORM_ASSERT_H_ | 382 #endif // PLATFORM_ASSERT_H_ |
| OLD | NEW |