Title: [149961] releases/WebKitGTK/webkit-2.0/Source/WTF
- Revision
- 149961
- Author
- [email protected]
- Date
- 2013-05-12 08:22:02 -0700 (Sun, 12 May 2013)
Log Message
Merge r146993 - Support C++11 static_assert
https://bugs.webkit.org/show_bug.cgi?id=113308
Reviewed by Alexey Proskuryakov.
Use the C++11 static_assert for COMPILE_ASSERT when it is available. Note that
even when compiling with C++11 support, static_assert will not always be available
since Assertions.h may also be used outside of C++.
C11 _Static_assert is enabled for GCC when it has C11 support (gcc>=4.7 -std=c11).
* wtf/Assertions.h:
* wtf/Compiler.h:
Modified Paths
Diff
Modified: releases/WebKitGTK/webkit-2.0/Source/WTF/ChangeLog (149960 => 149961)
--- releases/WebKitGTK/webkit-2.0/Source/WTF/ChangeLog 2013-05-12 15:12:51 UTC (rev 149960)
+++ releases/WebKitGTK/webkit-2.0/Source/WTF/ChangeLog 2013-05-12 15:22:02 UTC (rev 149961)
@@ -1,3 +1,19 @@
+2013-03-27 Allan Sandfeld Jensen <[email protected]>
+
+ Support C++11 static_assert
+ https://bugs.webkit.org/show_bug.cgi?id=113308
+
+ Reviewed by Alexey Proskuryakov.
+
+ Use the C++11 static_assert for COMPILE_ASSERT when it is available. Note that
+ even when compiling with C++11 support, static_assert will not always be available
+ since Assertions.h may also be used outside of C++.
+
+ C11 _Static_assert is enabled for GCC when it has C11 support (gcc>=4.7 -std=c11).
+
+ * wtf/Assertions.h:
+ * wtf/Compiler.h:
+
2013-03-13 Allan Sandfeld Jensen <[email protected]>
Support C++11 features in GCC <4.6
Modified: releases/WebKitGTK/webkit-2.0/Source/WTF/wtf/Assertions.h (149960 => 149961)
--- releases/WebKitGTK/webkit-2.0/Source/WTF/wtf/Assertions.h 2013-05-12 15:12:51 UTC (rev 149960)
+++ releases/WebKitGTK/webkit-2.0/Source/WTF/wtf/Assertions.h 2013-05-12 15:22:02 UTC (rev 149961)
@@ -345,7 +345,10 @@
/* COMPILE_ASSERT */
#ifndef COMPILE_ASSERT
#if COMPILER_SUPPORTS(C_STATIC_ASSERT)
+/* Unlike static_assert below, this also works in plain C code. */
#define COMPILE_ASSERT(exp, name) _Static_assert((exp), #name)
+#elif COMPILER_SUPPORTS(CXX_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
Modified: releases/WebKitGTK/webkit-2.0/Source/WTF/wtf/Compiler.h (149960 => 149961)
--- releases/WebKitGTK/webkit-2.0/Source/WTF/wtf/Compiler.h 2013-05-12 15:12:51 UTC (rev 149960)
+++ releases/WebKitGTK/webkit-2.0/Source/WTF/wtf/Compiler.h 2013-05-12 15:22:02 UTC (rev 149961)
@@ -60,6 +60,7 @@
#define WTF_COMPILER_SUPPORTS_CXX_EXPLICIT_CONVERSIONS __has_feature(cxx_explicit_conversions)
#define WTF_COMPILER_SUPPORTS_BLOCKS __has_feature(blocks)
#define WTF_COMPILER_SUPPORTS_C_STATIC_ASSERT __has_extension(c_static_assert)
+#define WTF_COMPILER_SUPPORTS_CXX_STATIC_ASSERT __has_extension(cxx_static_assert)
#define WTF_COMPILER_SUPPORTS_CXX_OVERRIDE_CONTROL __has_extension(cxx_override_control)
#define WTF_COMPILER_SUPPORTS_HAS_TRIVIAL_DESTRUCTOR __has_extension(has_trivial_destructor)
#define WTF_COMPILER_SUPPORTS_CXX_STRONG_ENUMS __has_extension(cxx_strong_enums)
@@ -122,9 +123,15 @@
/* Specific compiler features */
#if COMPILER(GCC) && !COMPILER(CLANG)
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
+/* C11 support */
+#define WTF_COMPILER_SUPPORTS_C_STATIC_ASSERT 1
+#endif
#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__cplusplus) && __cplusplus >= 201103L)
+/* C++11 support */
#if GCC_VERSION_AT_LEAST(4, 3, 0)
#define WTF_COMPILER_SUPPORTS_CXX_RVALUE_REFERENCES 1
+#define WTF_COMPILER_SUPPORTS_CXX_STATIC_ASSERT 1
#define WTF_COMPILER_SUPPORTS_CXX_VARIADIC_TEMPLATES 1
#endif
#if GCC_VERSION_AT_LEAST(4, 4, 0)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes