Title: [107581] trunk/Source/_javascript_Core
Revision
107581
Author
[email protected]
Date
2012-02-13 09:47:25 -0800 (Mon, 13 Feb 2012)

Log Message

Use C11's _Static_assert for COMPILE_ASSERT if it is available
https://bugs.webkit.org/show_bug.cgi?id=78506

Rubber-stamped by Antti Koivisto.

Use C11's _Static_assert for COMPILE_ASSERT if it is available to give slightly
better error messages.

* wtf/Assertions.h:
Use _Static_assert if it is available.

* wtf/Compiler.h:
Add COMPILER_SUPPORTS support for _Static_assert when using the LLVM Compiler.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (107580 => 107581)


--- trunk/Source/_javascript_Core/ChangeLog	2012-02-13 17:44:20 UTC (rev 107580)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-02-13 17:47:25 UTC (rev 107581)
@@ -1,3 +1,19 @@
+2012-02-13  Sam Weinig  <[email protected]>
+
+        Use C11's _Static_assert for COMPILE_ASSERT if it is available
+        https://bugs.webkit.org/show_bug.cgi?id=78506
+
+        Rubber-stamped by Antti Koivisto.
+
+        Use C11's _Static_assert for COMPILE_ASSERT if it is available to give slightly
+        better error messages.
+
+        * wtf/Assertions.h:
+        Use _Static_assert if it is available.
+
+        * wtf/Compiler.h:
+        Add COMPILER_SUPPORTS support for _Static_assert when using the LLVM Compiler.
+
 2012-02-13  Mario Sanchez Prada  <[email protected]>
 
         [GTK] Add GSList to the list of GObject types in GOwnPtr

Modified: trunk/Source/_javascript_Core/wtf/Assertions.h (107580 => 107581)


--- trunk/Source/_javascript_Core/wtf/Assertions.h	2012-02-13 17:44:20 UTC (rev 107580)
+++ trunk/Source/_javascript_Core/wtf/Assertions.h	2012-02-13 17:47:25 UTC (rev 107581)
@@ -322,8 +322,12 @@
 
 /* COMPILE_ASSERT */
 #ifndef COMPILE_ASSERT
+#if COMPILER_SUPPORTS(C_STATIC_ASSERT)
+#define COMPILE_ASSERT(exp, name) _Static_assert((exp), #name)
+#else
 #define COMPILE_ASSERT(exp, name) typedef int dummy##name [(exp) ? 1 : -1]
 #endif
+#endif
 
 /* FATAL */
 

Modified: trunk/Source/_javascript_Core/wtf/Compiler.h (107580 => 107581)


--- trunk/Source/_javascript_Core/wtf/Compiler.h	2012-02-13 17:44:20 UTC (rev 107580)
+++ trunk/Source/_javascript_Core/wtf/Compiler.h	2012-02-13 17:47:25 UTC (rev 107581)
@@ -48,6 +48,7 @@
 #define WTF_COMPILER_SUPPORTS_CXX_DELETED_FUNCTIONS __has_feature(cxx_deleted_functions)
 #define WTF_COMPILER_SUPPORTS_CXX_NULLPTR __has_feature(cxx_nullptr)
 #define WTF_COMPILER_SUPPORTS_BLOCKS __has_feature(blocks)
+#define WTF_COMPILER_SUPPORTS_C_STATIC_ASSERT __has_extension(c_static_assert)
 
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to