Add a compile-time assertion for the size of CSSValue
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Jan 2012 00:01:07 +0000 (00:01 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Jan 2012 00:01:07 +0000 (00:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=75635

Reviewed by Tony Chang.

Tightened the compile-time assertion.

* css/CSSValue.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@104236 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/css/CSSValue.cpp

index 36c2b283eb2c934af5a359219ac12e98f8a5b1f2..47f921202ab17703fe4c03424da9500a4341fb3c 100755 (executable)
@@ -1,3 +1,14 @@
+2012-01-05  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Add a compile-time assertion for the size of CSSValue
+        https://bugs.webkit.org/show_bug.cgi?id=75635
+
+        Reviewed by Tony Chang.
+
+        Tightened the compile-time assertion.
+
+        * css/CSSValue.cpp:
+
 2012-01-05  Adam Barth  <abarth@webkit.org>
 
         [V8] CodeGeneration for SerializedScriptValue doesn't play nice with [Constructor]
index 4cefdbc5c252c296d9885418e89289de915358dc..0e83c0818ec1d3073a0f53fb9cbd9100ced93037 100644 (file)
 
 namespace WebCore {
 
-#ifdef NDEBUG
-COMPILE_ASSERT((sizeof(CSSValue) - sizeof(RefCounted<CSSValue>)) <= 4, CSS_value_packs_into_four_bytes);
-#endif
+class SameSizeAsCSSValue : public RefCounted<SameSizeAsCSSValue> {
+    unsigned char bitfields[2];
+};
+
+COMPILE_ASSERT(sizeof(CSSValue) == sizeof(SameSizeAsCSSValue), CSS_value_should_stay_small);
 
 CSSValue::Type CSSValue::cssValueType() const
 {