Chromium Code Reviews| Index: base/logging.h |
| diff --git a/base/logging.h b/base/logging.h |
| index f06535dada056725121d0a31c0c745bca9c8f0f0..14b1ddd7a083e84c1134feb1d8633cff91b91779 100644 |
| --- a/base/logging.h |
| +++ b/base/logging.h |
| @@ -610,12 +610,6 @@ DEFINE_CHECK_OP_IMPL(GT, > ) |
| #define CHECK_GT(val1, val2) CHECK_OP(GT, > , val1, val2) |
| #if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) |
| -#define ENABLE_DLOG 0 |
| -#else |
| -#define ENABLE_DLOG 1 |
| -#endif |
| - |
| -#if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) |
| #define DCHECK_IS_ON() 0 |
| #else |
| #define DCHECK_IS_ON() 1 |
| @@ -623,7 +617,7 @@ DEFINE_CHECK_OP_IMPL(GT, > ) |
| // Definitions for DLOG et al. |
| -#if ENABLE_DLOG |
| +#if DCHECK_IS_ON() |
| #define DLOG_IS_ON(severity) LOG_IS_ON(severity) |
| #define DLOG_IF(severity, condition) LOG_IF(severity, condition) |
| @@ -632,12 +626,11 @@ DEFINE_CHECK_OP_IMPL(GT, > ) |
| #define DVLOG_IF(verboselevel, condition) VLOG_IF(verboselevel, condition) |
| #define DVPLOG_IF(verboselevel, condition) VPLOG_IF(verboselevel, condition) |
| -#else // ENABLE_DLOG |
| +#else // DCHECK_IS_ON() |
| -// If ENABLE_DLOG is off, we want to avoid emitting any references to |
| -// |condition| (which may reference a variable defined only if NDEBUG |
| -// is not defined). Contrast this with DCHECK et al., which has |
| -// different behavior. |
| +// If !DCHECK_IS_ON(), we want to avoid emitting any references to |condition| |
| +// (which may reference a variable defined only if NDEBUG is not defined). |
|
danakj
2016/07/20 20:03:03
This comment looks a bit wrong wtf NDBUG right? Sh
gab
2016/07/20 21:01:29
Done.
|
| +// Contrast this with DCHECK et al., which has different behavior. |
| #define DLOG_IS_ON(severity) false |
| #define DLOG_IF(severity, condition) EAT_STREAM_PARAMETERS |
| @@ -646,19 +639,14 @@ DEFINE_CHECK_OP_IMPL(GT, > ) |
| #define DVLOG_IF(verboselevel, condition) EAT_STREAM_PARAMETERS |
| #define DVPLOG_IF(verboselevel, condition) EAT_STREAM_PARAMETERS |
| -#endif // ENABLE_DLOG |
| +#endif // DCHECK_IS_ON() |
| -// DEBUG_MODE is for uses like |
| +// DEBUG_MODE is for runtime uses like |
| // if (DEBUG_MODE) foo.CheckThatFoo(); |
| -// instead of |
| -// #ifndef NDEBUG |
| -// foo.CheckThatFoo(); |
| -// #endif |
| +// We tie its state to DCHECK_IS_ON(). |
| // |
| -// We tie its state to ENABLE_DLOG. |
| -enum { DEBUG_MODE = ENABLE_DLOG }; |
| - |
| -#undef ENABLE_DLOG |
| +// For compile-time checks, #if DCHECK_IS_ON() can be used. |
| +enum { DEBUG_MODE = DCHECK_IS_ON() }; |
| #define DLOG(severity) \ |
| LAZY_STREAM(LOG_STREAM(severity), DLOG_IS_ON(severity)) |