]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - heap/GCAssertions.h
JavaScriptCore-7600.1.4.9.tar.gz
[apple/javascriptcore.git] / heap / GCAssertions.h
index 7c7054deb1ec606e3481e08587ea3919b3bfd152..c163a190c9ba68cf971831942b9e3ba417e54196 100644 (file)
 #ifndef GCAssertions_h
 #define GCAssertions_h
 
+#include <type_traits>
 #include <wtf/Assertions.h>
 
 #if ENABLE(GC_VALIDATION)
 #define ASSERT_GC_OBJECT_LOOKS_VALID(cell) do { \
     RELEASE_ASSERT(cell);\
-    RELEASE_ASSERT(cell->unvalidatedStructure()->unvalidatedStructure() == cell->unvalidatedStructure()->unvalidatedStructure()->unvalidatedStructure()); \
+    RELEASE_ASSERT(cell->structure()->structure() == cell->structure()->structure()->structure()); \
 } while (0)
 
 #define ASSERT_GC_OBJECT_INHERITS(object, classInfo) do {\
 #define ASSERT_GC_OBJECT_INHERITS(object, classInfo) do { (void)object; (void)classInfo; } while (0)
 #endif
 
-#if COMPILER_SUPPORTS(HAS_TRIVIAL_DESTRUCTOR)
-#define ASSERT_HAS_TRIVIAL_DESTRUCTOR(klass) COMPILE_ASSERT(__has_trivial_destructor(klass), klass##_has_trivial_destructor_check)
+#if COMPILER(CLANG)
+#define STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(klass) static_assert(std::is_trivially_destructible<klass>::value, #klass " must have a trivial destructor")
+#elif COMPILER(MSVC)
+// An earlier verison of the C++11 spec used to call this type trait std::has_trivial_destructor, and that's what MSVC uses.
+#define STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(klass) static_assert(std::has_trivial_destructor<klass>::value, #klass " must have a trivial destructor")
 #else
-#define ASSERT_HAS_TRIVIAL_DESTRUCTOR(klass)
+// This is not enabled on GCC due to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52702
+#define STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(klass)
 #endif
 
 #endif // GCAssertions_h