Chromium Code Reviews| Index: base/logging.h |
| diff --git a/base/logging.h b/base/logging.h |
| index 7854e3934e974b4670930d6855f3ab8699a8376f..0df73ff5f87248e91eb545f11345e34904245a9c 100644 |
| --- a/base/logging.h |
| +++ b/base/logging.h |
| @@ -726,17 +726,29 @@ const LogSeverity LOG_DCHECK = LOG_INFO; |
| LAZY_STREAM(PLOG_STREAM(DCHECK), false) \ |
| << "Check failed: " #condition ". " |
| -#else // _PREFAST_ |
| +#else // _PREFAST_ && OS_WIN |
| + |
| +#if DCHECK_IS_ON() |
|
danakj
2017/01/24 21:10:52
nested #ifs are such a joy, can u use elif here
|
| -#define DCHECK(condition) \ |
| - LAZY_STREAM(LOG_STREAM(DCHECK), DCHECK_IS_ON() ? !(condition) : false) \ |
| +#define DCHECK(condition) \ |
| + LAZY_STREAM(LOG_STREAM(DCHECK), !(condition)) \ |
| << "Check failed: " #condition ". " |
| -#define DPCHECK(condition) \ |
| - LAZY_STREAM(PLOG_STREAM(DCHECK), DCHECK_IS_ON() ? !(condition) : false) \ |
| +#define DPCHECK(condition) \ |
| + LAZY_STREAM(PLOG_STREAM(DCHECK), !(condition)) \ |
| << "Check failed: " #condition ". " |
| -#endif // _PREFAST_ |
| +#else // DCHECK_IS_ON() |
| + |
| +// A separate block (as opposed to a conditional in the LAZY_STREAM) is required |
| +// to ensure that all code is remove on MSVC. See the comment near |
| +// EAT_STREAM_PARAMETERS for more detail. |
| +#define DCHECK(condition) (void)(condition), EAT_STREAM_PARAMETERS |
| +#define DPCHECK(condition) (void)(condition), EAT_STREAM_PARAMETERS |
| + |
| +#endif // DCHECK_IS_ON() |
| + |
| +#endif // _PREFAST_ && OS_WIN |
| // Helper macro for binary operators. |
| // Don't use this macro directly in your code, use DCHECK_EQ et al below. |