Inline an inline function into the CHECK macro
authorsvenpanne@chromium.org <svenpanne@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 30 Jan 2012 13:02:48 +0000 (13:02 +0000)
committersvenpanne@chromium.org <svenpanne@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 30 Jan 2012 13:02:48 +0000 (13:02 +0000)
CheckHelper was only used within the macro itself. Furthermore, GCC
with -Winline was not always happy with the inline function. Simple
solution: Inline the inline function into the macro itself. Inlining
squared!

Review URL: https://chromiumcodereview.appspot.com/9295048

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10550 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/checks.h

index d93d4510f6e8a1145e7e8a73300228661443d6a8..608aa148064b9fe6ba9cb297e9c738d9c57666da 100644 (file)
@@ -51,20 +51,12 @@ extern "C" void V8_Fatal(const char* file, int line, const char* format, ...);
 #endif
 
 
-// Used by the CHECK macro -- should not be called directly.
-inline void CheckHelper(const char* file,
-                        int line,
-                        const char* source,
-                        bool condition) {
-  if (!condition)
-    V8_Fatal(file, line, "CHECK(%s) failed", source);
-}
-
-
 // The CHECK macro checks that the given condition is true; if not, it
 // prints a message to stderr and aborts.
-#define CHECK(condition) do {                                             \
-    if (!(condition)) CheckHelper(__FILE__, __LINE__, #condition, false); \
+#define CHECK(condition) do {                                       \
+    if (!(condition)) {                                             \
+      V8_Fatal(__FILE__, __LINE__, "CHECK(%s) failed", #condition); \
+    }                                                               \
   } while (0)