Index: base/logging.h |
diff --git a/base/logging.h b/base/logging.h |
index 36c9c6f311d1615b98c7507235e0bb41ec68e4b1..0476a4450fb09453db113b38e59b71b5ff226fec 100644 |
--- a/base/logging.h |
+++ b/base/logging.h |
@@ -453,11 +453,17 @@ class CheckOpResult { |
// Make all CHECK functions discard their log strings to reduce code |
// bloat, and improve performance, for official release builds. |
-// TODO(akalin): This would be more valuable if there were some way to |
-// remove BreakDebugger() from the backtrace, perhaps by turning it |
-// into a macro (like __debugbreak() on Windows). |
+#if defined(COMPILER_GCC) || __clang__ |
+#define LOGGING_CRASH() __builtin_trap() |
+#else |
+#define LOGGING_CRASH() ((void)(*(volatile char*)0 = 0)) |
+#endif |
+ |
+// This is not calling BreakDebugger since this is called frequently, and |
+// calling an out-of-line function instead of a noreturn inline macro prevents |
+// compiler optimizations. |
#define CHECK(condition) \ |
- !(condition) ? ::base::debug::BreakDebugger() : EAT_STREAM_PARAMETERS |
+ !(condition) ? LOGGING_CRASH() : EAT_STREAM_PARAMETERS |
#define PCHECK(condition) CHECK(condition) |