| 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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_ |
| OLD | NEW |