Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2880)

Unified Diff: base/logging.h

Issue 2653993002: Ensure all code is removed for DCHECK on Windows Official (Closed)
Patch Set: comments Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698