diff src/share/vm/utilities/debug.hpp @ 12039:3cce976666d9

Merge hs25-b46
author Gilles Duboscq <duboscq@ssw.jku.at>
date Thu, 10 Oct 2013 14:20:04 +0200
parents 6b0fd0964b87 9766f73e770d
children d8041d695d19
line wrap: on
line diff
--- a/src/share/vm/utilities/debug.hpp	Thu Oct 10 13:44:59 2013 +0200
+++ b/src/share/vm/utilities/debug.hpp	Thu Oct 10 14:20:04 2013 +0200
@@ -225,6 +225,22 @@
 
 void warning(const char* format, ...);
 
+#ifdef ASSERT
+// Compile-time asserts.
+template <bool> struct StaticAssert;
+template <> struct StaticAssert<true> {};
+
+// Only StaticAssert<true> is defined, so if cond evaluates to false we get
+// a compile time exception when trying to use StaticAssert<false>.
+#define STATIC_ASSERT(cond)                   \
+  do {                                        \
+    StaticAssert<(cond)> DUMMY_STATIC_ASSERT; \
+    (void)DUMMY_STATIC_ASSERT; /* ignore */   \
+  } while (false)
+#else
+#define STATIC_ASSERT(cond)
+#endif
+
 // out of shared space reporting
 enum SharedSpaceType {
   SharedPermGen,