Title: [204433] trunk/Source/WTF
- Revision
- 204433
- Author
- commit-qu...@webkit.org
- Date
- 2016-08-12 16:35:17 -0700 (Fri, 12 Aug 2016)
Log Message
Make variant only available when compiling for C++14 or greater
https://bugs.webkit.org/show_bug.cgi?id=160813
Patch by Sam Weinig <s...@webkit.org> on 2016-08-12
Reviewed by Anders Carlsson.
* wtf/Compiler.h:
* wtf/StdLibExtras.h:
* wtf/Variant.h:
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (204432 => 204433)
--- trunk/Source/WTF/ChangeLog 2016-08-12 23:34:27 UTC (rev 204432)
+++ trunk/Source/WTF/ChangeLog 2016-08-12 23:35:17 UTC (rev 204433)
@@ -1,3 +1,14 @@
+2016-08-12 Sam Weinig <s...@webkit.org>
+
+ Make variant only available when compiling for C++14 or greater
+ https://bugs.webkit.org/show_bug.cgi?id=160813
+
+ Reviewed by Anders Carlsson.
+
+ * wtf/Compiler.h:
+ * wtf/StdLibExtras.h:
+ * wtf/Variant.h:
+
2016-08-11 Maureen Daum <md...@apple.com>
Add NSButtonType to AppKitCompatibilityDeclarations.h.
Modified: trunk/Source/WTF/wtf/Compiler.h (204432 => 204433)
--- trunk/Source/WTF/wtf/Compiler.h 2016-08-12 23:34:27 UTC (rev 204432)
+++ trunk/Source/WTF/wtf/Compiler.h 2016-08-12 23:35:17 UTC (rev 204433)
@@ -54,8 +54,17 @@
#define WTF_COMPILER_SUPPORTS_CXX_USER_LITERALS __has_feature(cxx_user_literals)
#define WTF_COMPILER_SUPPORTS_FALLTHROUGH_WARNINGS __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough")
#define WTF_COMPILER_SUPPORTS_CXX_EXCEPTIONS __has_feature(cxx_exceptions)
+
+#ifdef __cplusplus
+#if __cplusplus <= 201103L
+#define WTF_CPP_STD_VER 11
+#elif __cplusplus <= 201402L
+#define WTF_CPP_STD_VER 14
#endif
+#endif
+#endif
+
/* COMPILER(GCC_OR_CLANG) - GNU Compiler Collection or Clang */
#if defined(__GNUC__)
#define WTF_COMPILER_GCC_OR_CLANG 1
Modified: trunk/Source/WTF/wtf/StdLibExtras.h (204432 => 204433)
--- trunk/Source/WTF/wtf/StdLibExtras.h 2016-08-12 23:34:27 UTC (rev 204432)
+++ trunk/Source/WTF/wtf/StdLibExtras.h 2016-08-12 23:35:17 UTC (rev 204433)
@@ -403,6 +403,8 @@
return move(forward<T>(value));
}
+#if !COMPILER(CLANG) || WTF_CPP_STD_VER >= 14
+
template<typename... Types>
using variant = std::experimental::variant<Types...>;
@@ -411,6 +413,8 @@
using std::experimental::holds_alternative;
using std::experimental::visit;
+#endif
+
} // namespace std
#define WTFMove(value) std::move<WTF::CheckMoveParameter>(value)
Modified: trunk/Source/WTF/wtf/Variant.h (204432 => 204433)
--- trunk/Source/WTF/wtf/Variant.h 2016-08-12 23:34:27 UTC (rev 204432)
+++ trunk/Source/WTF/wtf/Variant.h 2016-08-12 23:35:17 UTC (rev 204433)
@@ -57,6 +57,8 @@
#pragma warning(disable:4814)
#endif
+#if !COMPILER(CLANG) || WTF_CPP_STD_VER >= 14
+
namespace std {
namespace experimental {
@@ -2058,6 +2060,8 @@
} // namespace std
+#endif // !COMPILER(CLANG) || WTF_CPP_STD_VER >= 14
+
#if COMPILER(MSVC)
#pragma warning(pop)
#endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes