src/share/vm/utilities/debug.hpp

changeset 5515
9766f73e770d
parent 5365
59b052799158
child 6462
e2722a66aba7
     1.1 --- a/src/share/vm/utilities/debug.hpp	Fri Aug 09 01:39:11 2013 -0700
     1.2 +++ b/src/share/vm/utilities/debug.hpp	Fri May 31 14:32:44 2013 +0200
     1.3 @@ -225,6 +225,22 @@
     1.4  
     1.5  void warning(const char* format, ...);
     1.6  
     1.7 +#ifdef ASSERT
     1.8 +// Compile-time asserts.
     1.9 +template <bool> struct StaticAssert;
    1.10 +template <> struct StaticAssert<true> {};
    1.11 +
    1.12 +// Only StaticAssert<true> is defined, so if cond evaluates to false we get
    1.13 +// a compile time exception when trying to use StaticAssert<false>.
    1.14 +#define STATIC_ASSERT(cond)                   \
    1.15 +  do {                                        \
    1.16 +    StaticAssert<(cond)> DUMMY_STATIC_ASSERT; \
    1.17 +    (void)DUMMY_STATIC_ASSERT; /* ignore */   \
    1.18 +  } while (false)
    1.19 +#else
    1.20 +#define STATIC_ASSERT(cond)
    1.21 +#endif
    1.22 +
    1.23  // out of shared space reporting
    1.24  enum SharedSpaceType {
    1.25    SharedPermGen,

mercurial