Revision: 5226
Author: [email protected]
Date: Tue Aug 10 02:22:49 2010
Log: Enable static assertions in release mode.
Review URL: http://codereview.chromium.org/3146004
http://code.google.com/p/v8/source/detail?r=5226
Modified:
/branches/bleeding_edge/src/checks.h
=======================================
--- /branches/bleeding_edge/src/checks.h Thu Jul 15 07:28:52 2010
+++ /branches/bleeding_edge/src/checks.h Tue Aug 10 02:22:49 2010
@@ -280,14 +280,13 @@
// The ASSERT macro is equivalent to CHECK except that it only
-// generates code in debug builds. Ditto STATIC_ASSERT.
+// generates code in debug builds.
#ifdef DEBUG
#define ASSERT_RESULT(expr) CHECK(expr)
#define ASSERT(condition) CHECK(condition)
#define ASSERT_EQ(v1, v2) CHECK_EQ(v1, v2)
#define ASSERT_NE(v1, v2) CHECK_NE(v1, v2)
#define ASSERT_GE(v1, v2) CHECK_GE(v1, v2)
-#define STATIC_ASSERT(test) STATIC_CHECK(test)
#define SLOW_ASSERT(condition) if (FLAG_enable_slow_asserts)
CHECK(condition)
#else
#define ASSERT_RESULT(expr) (expr)
@@ -295,9 +294,14 @@
#define ASSERT_EQ(v1, v2) ((void) 0)
#define ASSERT_NE(v1, v2) ((void) 0)
#define ASSERT_GE(v1, v2) ((void) 0)
-#define STATIC_ASSERT(test) ((void) 0)
#define SLOW_ASSERT(condition) ((void) 0)
#endif
+// Static asserts has no impact on runtime performance, so they can be
+// safely enabled in release mode. Moreover, the ((void) 0) expression
+// obeys different syntax rules than typedef's, e.g. it can't appear
+// inside class declaration, this leads to inconsistency between debug
+// and release compilation modes behaviour.
+#define STATIC_ASSERT(test) STATIC_CHECK(test)
#define ASSERT_TAG_ALIGNED(address) \
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev