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

Unified Diff: src/checks.h

Issue 8256011: Provide fast-path for CHECK macro. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 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: src/checks.h
diff --git a/src/checks.h b/src/checks.h
index 2f359f6cd84efdd30f82ab6568a95657c6754edc..55206d4bae3afde09a46e978d912dea0f3152b8a 100644
--- a/src/checks.h
+++ b/src/checks.h
@@ -63,7 +63,9 @@ static inline void CheckHelper(const char* file,
// The CHECK macro checks that the given condition is true; if not, it
// prints a message to stderr and aborts.
-#define CHECK(condition) CheckHelper(__FILE__, __LINE__, #condition, condition)
+#define CHECK(condition) do { \
+ if (!(condition)) CheckHelper(__FILE__, __LINE__, #condition, false); \
+ } while(0)
// Helper function used by the CHECK_EQ function when given int
« 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