JavaScriptCore:
Reviewed by Adam Roben.
Fix crashes on ARM due to different struct packing. Based on a patch
by Mike Emmel.
* kjs/ustring.cpp: compile-time assert to make sure sizeof(UChar) == 2
* kjs/ustring.h: pack UChar struct to ensure that sizeof(UChar) == 2
* wtf/Assertions.h: add COMPILE_ASSERT macro for compile-time assertions
WebCore:
Reviewed by Adam Roben.
Fix crashes on ARM due to different struct packing. Based on a patch
from Mike Emmel.
* platform/DeprecatedString.cpp: compile-time assert to make sure sizeof(DeprecatedChar) == 2
* platform/DeprecatedString.h: pack DeprecatedChar struct to ensure that
sizeof(DeprecatedChar) == 2. Move _internalBuffer in DeprecatedStringData
to the end, to avoid crashes on ARM due to different struct packing.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@19679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/wtf/Assertions.h b/JavaScriptCore/wtf/Assertions.h
index 940e023..805c4bb 100644
--- a/JavaScriptCore/wtf/Assertions.h
+++ b/JavaScriptCore/wtf/Assertions.h
@@ -155,6 +155,11 @@
#endif
+/* COMPILE_ASSERT */
+#ifndef COMPILE_ASSERT
+#define COMPILE_ASSERT(exp, name) typedef int dummy##name [(exp) ? 1 : -1];
+#endif
+
/* FATAL */
#if FATAL_DISABLED