Chromium Code Reviews| Index: src/base/logging.h |
| diff --git a/src/base/logging.h b/src/base/logging.h |
| index 50fceca88b3a6adf99835c49d5c3e4a9f04e8002..5697b05ea4334d1ffef8b7082d21aa291d868f71 100644 |
| --- a/src/base/logging.h |
| +++ b/src/base/logging.h |
| @@ -49,6 +49,18 @@ namespace base { |
| } \ |
| } while (0) |
| +// CHECK_EXTRA is like CHECK, but has two or more arguments: a boolean |
| +// expression, a format string, and any number of extra arguments. The boolean |
| +// expression will be evaluated at runtime. If it evaluates to false, then an |
| +// error message will be shown containing the condition, as well as the extra |
| +// info formatted like with printf. |
| +#define CHECK_EXTRA(condition, fmt, ...) \ |
| + do { \ |
| + if (V8_UNLIKELY(!(condition))) { \ |
| + V8_Fatal(__FILE__, __LINE__, "Check failed: %s. Extra info: " fmt, \ |
| + #condition, ##__VA_ARGS__); \ |
| + } \ |
| + } while (0) |
|
bgeron
2016/08/11 10:56:18
Removed from next patchset.
|
| #ifdef DEBUG |
| @@ -152,6 +164,8 @@ void DumpBacktrace(); |
| // generates code in debug builds. |
| #ifdef DEBUG |
| #define DCHECK(condition) CHECK(condition) |
| +#define DCHECK_EXTRA(condition, fmt, ...) \ |
| + CHECK_EXTRA(condition, fmt, ##__VA_ARGS__) |
| #define DCHECK_EQ(v1, v2) CHECK_EQ(v1, v2) |
| #define DCHECK_NE(v1, v2) CHECK_NE(v1, v2) |
| #define DCHECK_GT(v1, v2) CHECK_GT(v1, v2) |
| @@ -163,6 +177,7 @@ void DumpBacktrace(); |
| #define DCHECK_IMPLIES(v1, v2) CHECK_IMPLIES(v1, v2) |
| #else |
| #define DCHECK(condition) ((void) 0) |
| +#define DCHECK_EXTRA(condition, fmt, ...) ((void)0) |
| #define DCHECK_EQ(v1, v2) ((void) 0) |
| #define DCHECK_NE(v1, v2) ((void) 0) |
| #define DCHECK_GT(v1, v2) ((void) 0) |