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

Unified Diff: base/logging.h

Issue 1124673004: Chrome OS: Reduce NOTREACHED() overhead for release builds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 | base/logging.cc » ('j') | 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 cc0a5aa11bc4de78eaf868d1af2e289236baf4f1..cc341f97c4a601154eaffc5e0a86c475161f9116 100644
--- a/base/logging.h
+++ b/base/logging.h
@@ -653,12 +653,12 @@ const LogSeverity LOG_DCHECK = LOG_INFO;
#else // _PREFAST_
-#define DCHECK(condition) \
- LAZY_STREAM(LOG_STREAM(DCHECK), DCHECK_IS_ON() ? !(condition) : false) \
+#define DCHECK(condition) \
+ LAZY_STREAM(LOG_STREAM(DCHECK), DCHECK_IS_ON() && !(condition)) \
danakj 2015/05/04 18:21:46 This is unrelated, please don't lump multiple logi
Thiemo Nagel 2015/05/04 19:15:47 Done.
<< "Check failed: " #condition ". "
-#define DPCHECK(condition) \
- LAZY_STREAM(PLOG_STREAM(DCHECK), DCHECK_IS_ON() ? !(condition) : false) \
+#define DPCHECK(condition) \
+ LAZY_STREAM(PLOG_STREAM(DCHECK), DCHECK_IS_ON() && !(condition)) \
<< "Check failed: " #condition ". "
#endif // _PREFAST_
@@ -700,8 +700,12 @@ const LogSeverity LOG_DCHECK = LOG_INFO;
#define DCHECK_IMPLIES(val1, val2) DCHECK(!(val1) || (val2))
#if !DCHECK_IS_ON() && defined(OS_CHROMEOS)
-#define NOTREACHED() LOG(ERROR) << "NOTREACHED() hit in " << \
- __FUNCTION__ << ". "
+// Implement logging of NOTREACHED() as a dedicated function to get function
+// call overhead down to a minimum.
+void LogErrorNotReached(const char* file, int line, const char* function_name);
+#define NOTREACHED() \
+ true ? ::logging::LogErrorNotReached(__FILE__, __LINE__, __FUNCTION__) \
danakj 2015/05/04 18:27:41 what's the point of the ternary that's always true
Thiemo Nagel 2015/05/04 19:15:47 The ternary is used as a binder so that EAT_STREAM
+ : EAT_STREAM_PARAMETERS
#else
#define NOTREACHED() DCHECK(false)
#endif
« no previous file with comments | « no previous file | base/logging.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698