WebKit Bugzilla
Attachment 339378 Details for
Bug 185232
: [Win] Use C++17 in MSVC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185232-20180503113021.patch (text/plain), 5.43 KB, created by
Yusuke Suzuki
on 2018-05-02 19:30:22 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Yusuke Suzuki
Created:
2018-05-02 19:30:22 PDT
Size:
5.43 KB
patch
obsolete
>Subversion Revision: 231292 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index 20a76abda0d5e0f675e3a6782c3b25dd862e5490..cac1c94d639c718f8cf513f35d769e2056cf0303 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,17 @@ >+2018-05-02 Yusuke Suzuki <utatane.tea@gmail.com> >+ >+ [Win] Use C++17 in MSVC >+ https://bugs.webkit.org/show_bug.cgi?id=185232 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * jit/BinarySwitch.cpp: >+ (JSC::RandomNumberGenerator::RandomNumberGenerator): >+ (JSC::RandomNumberGenerator::operator()): >+ (JSC::RandomNumberGenerator::min): >+ (JSC::RandomNumberGenerator::max): >+ (JSC::BinarySwitch::build): >+ > 2018-05-02 Yusuke Suzuki <utatane.tea@gmail.com> > > Unreviewed, fix build failure in ARM, ARMv7 and MIPS >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index f0f705544e654e89acc8635ea392675f720c1c1b..15a47ea7c8d993e6129479c212289c7b8a5dd425 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,13 @@ >+2018-05-02 Yusuke Suzuki <utatane.tea@gmail.com> >+ >+ [Win] Use C++17 in MSVC >+ https://bugs.webkit.org/show_bug.cgi?id=185232 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * wtf/Optional.h: >+ * wtf/StdLibExtras.h: >+ > 2018-05-02 Commit Queue <commit-queue@webkit.org> > > Unreviewed, rolling out r231251. >diff --git a/Source/JavaScriptCore/jit/BinarySwitch.cpp b/Source/JavaScriptCore/jit/BinarySwitch.cpp >index 0eab5651925329e17b3f5ca25db134ab4dd9a672..e8e657e444b5cc2998205943d16ad49862a36275 100644 >--- a/Source/JavaScriptCore/jit/BinarySwitch.cpp >+++ b/Source/JavaScriptCore/jit/BinarySwitch.cpp >@@ -137,6 +137,27 @@ bool BinarySwitch::advance(MacroAssembler& jit) > } > } > >+class RandomNumberGenerator { >+public: >+ using result_type = uint32_t; >+ >+ RandomNumberGenerator(WeakRandom& weakRandom) >+ : m_weakRandom(weakRandom) >+ { >+ } >+ >+ uint32_t operator()() >+ { >+ return m_weakRandom.getUint32(); >+ } >+ >+ static constexpr uint32_t min() { return std::numeric_limits<uint32_t>::min(); } >+ static constexpr uint32_t max() { return std::numeric_limits<uint32_t>::max(); } >+ >+private: >+ WeakRandom& m_weakRandom; >+}; >+ > void BinarySwitch::build(unsigned start, bool hardStart, unsigned end) > { > if (BinarySwitchInternal::verbose) >@@ -195,13 +216,9 @@ void BinarySwitch::build(unsigned start, bool hardStart, unsigned end) > for (unsigned i = 0; i < size; ++i) > localCaseIndices.append(start + i); > >- std::random_shuffle( >+ std::shuffle( > localCaseIndices.begin(), localCaseIndices.end(), >- [this] (unsigned n) { >- // We use modulo to get a random number in the range we want fully knowing that >- // this introduces a tiny amount of bias, but we're fine with such tiny bias. >- return m_weakRandom.getUint32() % n; >- }); >+ RandomNumberGenerator(m_weakRandom)); > > for (unsigned i = 0; i < size - 1; ++i) { > append(BranchCode(NotEqualToPush, localCaseIndices[i])); >diff --git a/Source/WTF/wtf/Optional.h b/Source/WTF/wtf/Optional.h >index aac45a71c1b2f343c8bfd615a226d1b2334831f5..c13adc668c45a07ff5959b6baabff691454c4039 100644 >--- a/Source/WTF/wtf/Optional.h >+++ b/Source/WTF/wtf/Optional.h >@@ -47,11 +47,11 @@ > # include <wtf/Compiler.h> > # include <wtf/StdLibExtras.h> > >-#if !COMPILER(MSVC) && __has_include(<optional>) >+#if COMPILER(MSVC) || __has_include(<optional>) > # include <optional> > #endif > >-#if !COMPILER(MSVC) && defined(__cpp_lib_optional) && __cpp_lib_optional >= 201603 >+#if COMPILER(MSVC) || (defined(__cpp_lib_optional) && __cpp_lib_optional >= 201603) > > // Use default std::optional. > >diff --git a/Source/WTF/wtf/StdLibExtras.h b/Source/WTF/wtf/StdLibExtras.h >index 49f2e2988d926bc56595ebc9a0ce927184087abe..676f9c6c0ee358e46291fc9ddfe83eb7e66933b8 100644 >--- a/Source/WTF/wtf/StdLibExtras.h >+++ b/Source/WTF/wtf/StdLibExtras.h >@@ -543,7 +543,7 @@ template<class B0, class B1, class B2, class... Bn> struct wtf_conjunction_impl< > template<class... _Args> struct conjunction : wtf_conjunction_impl<_Args...> { }; > #endif > >-#if __cplusplus < 201703L >+#if __cplusplus < 201703L && (!defined(_MSC_FULL_VER) || _MSC_FULL_VER < 190023918) > > // These are inline variable for C++17 and later. > #define __IN_PLACE_INLINE_VARIABLE static const >diff --git a/Source/cmake/OptionsMSVC.cmake b/Source/cmake/OptionsMSVC.cmake >index 7f378ff8aa9f76cfbc6b6111f9f983d62f636605..23b167c9f7a36d2b9eeb8f8d3e31e355742fd0b3 100644 >--- a/Source/cmake/OptionsMSVC.cmake >+++ b/Source/cmake/OptionsMSVC.cmake >@@ -29,6 +29,10 @@ endif () > # Turn off certain link features > add_compile_options(/Gy- /openmp- /GF-) > >+# Enable C++17 >+# https://msdn.microsoft.com/en-us/library/mt490614.aspx >+add_compile_options(/std:c++latest) >+ > # Specify the source code encoding > add_compile_options(/utf-8 /validate-charset) > >diff --git a/ChangeLog b/ChangeLog >index 85d1fcaa499532312d706865e020a60cf2c79ce4..9ab42d0775af3754c86d0191e0c99024bff01cfc 100644 >--- a/ChangeLog >+++ b/ChangeLog >@@ -1,3 +1,12 @@ >+2018-05-02 Yusuke Suzuki <utatane.tea@gmail.com> >+ >+ [Win] Use C++17 in MSVC >+ https://bugs.webkit.org/show_bug.cgi?id=185232 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Source/cmake/OptionsMSVC.cmake: >+ > 2018-05-02 Valerie R Young <valerie@bocoup.com> > > test262/Runner.pm: save summary to file
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185232
:
339374
|
339375
|
339378
|
339386
|
339395
|
339400
|
339499
|
339675
|
339677
|
339678
|
339679
|
339680
|
339682
|
339685
|
340336